Thanks to visit codestin.com
Credit goes to github.com

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

Conversation

@Enderchief
Copy link
Member

Changes

  • adds:
    • Ability to have commands with yield (sends a webhook to respond). see API docs for implementation
    • When creating the command, it checks if it is coroutine or asyncgenerator
    • API Exception includes a JSON property to see the response when using try-except. (this is taken advantage of in this pr)
    • A separate function to convert a message to a Message object

Check off the following

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

f"interactions/{interaction.id}/{interaction.token}/callback",
msg.to_dict()
)
await sleep(0.3)
Copy link
Member

Choose a reason for hiding this comment

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

why await sleep(.3)?

Copy link
Member Author

@Enderchief Enderchief Sep 19, 2021

Choose a reason for hiding this comment

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

The delay is needed otherwise there will be a RateLimitError. 0.3 is the "sweet spot" as 0.25 does not always help and 0.5 is too slow.

return "on_interaction_create", [interaction]


def convert_message(self, message: Union[Embed, Message, str]) -> Message:
Copy link
Member

Choose a reason for hiding this comment

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

Extraction this to a function is a great idea. Tho, when we'll have more and more thing to convert to message (button, list, ...) we might want to use a dictionary and bind type key to convert function or something like?

@Sigmanificient Sigmanificient added the enhancement New feature or request label Sep 19, 2021
@Sigmanificient Sigmanificient merged commit c2e443f into Pincer-org:main Sep 19, 2021
@Sigmanificient Sigmanificient changed the title Yieldable commands ✨ Yieldable commands Oct 3, 2021
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.

2 participants