Skip to content

Conversation

@ChrisLovering
Copy link
Member

@ChrisLovering ChrisLovering commented Jul 25, 2023

This PR adds BotBase.wait_until_bot_started which can be used to hold a process until all extensions are loaded.
This will also wait until all app commands have synced, if sync_app_commands was set when calling BotBase.load_extensions.

I have also overwritten discord.ext.commands.Bot.process_commands to first call pydis_core.BotBase.wait_until_bot_started to ensure no commands are processed until all extensions are loaded.

@netlify
Copy link

netlify bot commented Jul 25, 2023

Deploy Preview for bot-core ready!

Name Link
🔨 Latest commit 2da733d
🔍 Latest deploy log https://app.netlify.com/sites/bot-core/deploys/64bfcbd67a3ef6000872013f
😎 Deploy Preview https://deploy-preview-190--bot-core.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ChrisLovering ChrisLovering force-pushed the wait_until_bot_started branch 2 times, most recently from 487f04f to b8bb6cf Compare July 25, 2023 10:59
@ChrisLovering ChrisLovering changed the title Add BotBase.wait_until_bot_started which can be used to hold a proces… Don't process comands until extensions are loaded Jul 25, 2023
Copy link
Member

@shtlrs shtlrs left a comment

Choose a reason for hiding this comment

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

This currently throws TypeError: object NoneType can't be used in 'await' expression

The .set method is not async, so you shouldn't await it since calling it returns None instead of a coro.

@ChrisLovering
Copy link
Member Author

This currently throws TypeError: object NoneType can't be used in 'await' expression

The .set method is not a coro, so you shouldn't await it since calling it returns None.

Hah yea, my bad. Fixed in a fixup

Copy link
Member

@shtlrs shtlrs left a comment

Choose a reason for hiding this comment

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

All good, thanks.

@ChrisLovering ChrisLovering force-pushed the wait_until_bot_started branch from b327ac0 to ab03dbf Compare July 25, 2023 12:00
@ChrisLovering ChrisLovering force-pushed the wait_until_bot_started branch from 550e9be to 0213817 Compare July 25, 2023 12:22
@shtlrs
Copy link
Member

shtlrs commented Jul 25, 2023

Thanks Chris !

@ChrisLovering ChrisLovering merged commit fc8af5e into main Jul 25, 2023
@ChrisLovering ChrisLovering deleted the wait_until_bot_started branch July 25, 2023 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants