Skip to content

Conversation

@JustaSqu1d
Copy link
Member

@JustaSqu1d JustaSqu1d commented Oct 10, 2022

Summary

It adds a warning on the documentation about overriding on_connect. Also fixes a few related broken references.

Preview: https://pycord-squid-branch.readthedocs.io/en/latest/api.html#discord.Bot.auto_sync_commands
https://pycord-squid-branch.readthedocs.io/en/latest/api.html#discord.on_connect

Information

  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed).
  • This PR is not a code change (e.g. documentation, README, typehinting,
    examples, ...).

Checklist

  • I have searched the open pull requests for duplicates.
  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why.

@JustaSqu1d JustaSqu1d marked this pull request as draft October 10, 2022 00:35
@JustaSqu1d JustaSqu1d marked this pull request as ready for review October 10, 2022 01:43
@Elitesparkle
Copy link

Elitesparkle commented Oct 10, 2022

If we really want to do something on_connect(), we can do it this way.

@bot.event
async def on_connect():
    if bot.auto_sync_commands:
        await bot.sync_commands()
    print(f"{bot.user.name} connected.")

I think it's worth including a note about this possibility in the warning.

Right now there is no example and it's only being mentioned for sync_commands().

By default, this coroutine is called inside the on_connect() event. If you choose to override the on_connect() event, then you should invoke this coroutine as well.

@Lulalaby Lulalaby added documentation Improvements or additions to documentation priority: low Low Priority labels Oct 11, 2022
@BobDotCom BobDotCom enabled auto-merge (squash) October 14, 2022 03:16
@Lulalaby Lulalaby disabled auto-merge October 16, 2022 17:18
@Lulalaby Lulalaby enabled auto-merge (squash) October 16, 2022 17:19
@Lulalaby Lulalaby merged commit 7eb8dc8 into Pycord-Development:master Oct 16, 2022
@JustaSqu1d JustaSqu1d deleted the patch-1 branch December 10, 2022 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation priority: low Low Priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants