Skip to content
This repository has been archived by the owner on Dec 26, 2022. It is now read-only.

🐛 command can now accept Optional[T] as a type #480

Merged
merged 2 commits into from
Jun 10, 2022
Merged

🐛 command can now accept Optional[T] as a type #480

merged 2 commits into from
Jun 10, 2022

Conversation

ooliver1
Copy link
Contributor

@ooliver1 ooliver1 commented Jun 3, 2022

Changes

Check off the following

  • I have tested my changes with the current requirements
  • My Code follows the pep8 code style.

Test code

from os import getenv
from time import perf_counter
from typing import Annotated, Optional

from dotenv import load_dotenv

from pincer import Client
from pincer.commands import Description, command
from pincer.objects import MessageContext

marker = perf_counter()
load_dotenv("./dev/.env")


class Bot(Client):
    @Client.event
    async def on_ready(self):
        print(
            f"Logged in as {client.bot} after {perf_counter() - marker} seconds"
        )

    @command(guild=802586580766162964)
    async def cmd(
        self,
        ctx: MessageContext,
        content: Annotated[Optional[str], Description["..."]] = None,
    ) -> str:
        return f"{ctx.author.mention} h: {content}"


token = getenv("TOKEN")
assert token is not None
client = Bot(token)
client.run()

@codecov
Copy link

codecov bot commented Jun 3, 2022

Codecov Report

Merging #480 (58ad6e5) into main (96bddae) will decrease coverage by 0.05%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main     #480      +/-   ##
==========================================
- Coverage   64.83%   64.78%   -0.06%     
==========================================
  Files         184      184              
  Lines        5984     5989       +5     
==========================================
  Hits         3880     3880              
- Misses       2104     2109       +5     
Impacted Files Coverage Δ
pincer/commands/commands.py 23.01% <0.00%> (-0.96%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 96bddae...58ad6e5. Read the comment docs.

@ooliver1
Copy link
Contributor Author

ooliver1 commented Jun 3, 2022

there is no commands dir so i cant really do much about coverage

@Enderchief
Copy link
Member

Can you update this with the latest code on the main branch. There won't be any conflict, I would just like to see this pass the latest workflows.

@Enderchief Enderchief added the enhancement New feature or request label Jun 3, 2022
@ooliver1
Copy link
Contributor Author

ooliver1 commented Jun 3, 2022

@Endercheif Done

@ooliver1
Copy link
Contributor Author

ooliver1 commented Jun 3, 2022

I think

@Sigmanificient Sigmanificient requested review from Enderchief, Sigmanificient and Arthurdw and removed request for Enderchief June 3, 2022 18:44
Copy link
Member

@Sigmanificient Sigmanificient left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nox is failling, did you ran black & flake8?

@Sigmanificient Sigmanificient merged commit d414853 into Pincer-org:main Jun 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants