You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Another idea for this one is to dispatch a cog_ready event inside add_cog. Right now most of the cogs use the on_ready listener to do any async stuff (or not) that needs doing when loading cogs, however, this fails if:
Something needs to be re-done once the cog has been reloaded (eg. fetching + setting a channel/webhook attribute)
The cog is not loaded on startup (for whatever reason) and is loaded later
A background loop is started before on_ready has completed.
@mathsman5133 With #488 practically done, I don't think this is needed. Also, I feel __init__ is basically the same as the proposed cog_ready would be anyway.
No, not currently. I was waiting on other PRs and eventually forgot about this. If you would like to work on this now, you can. Otherwise, I will try to get started today or tomorrow.
I don't think we're in a hurry, but I was reminded of it from people having some issues with their IDE not recognizing some of the attributes we set dynamically (e.g, api_client). Having a custom Bot class would solve that.
I can work on it, but if you like to work on it, that's fine as well.
🤔 Where should it go? __main__ would be weird to import from. __init__ already cluttered. bot.py would be weird to import from (cause the package is also named bot).
Activity
SebastiaanZ commentedon Oct 1, 2019
Yes, we should. I think it would also be a good idea to override the
closemethod to close theaiohttpsession correctly.(this is in reference to #244)
mathsman5133 commentedon Oct 10, 2019
Another idea for this one is to dispatch a
cog_readyevent insideadd_cog. Right now most of the cogs use theon_readylistener to do any async stuff (or not) that needs doing when loading cogs, however, this fails if:on_readyhas completed.MarkKoz commentedon Oct 10, 2019
@mathsman5133 With #488 practically done, I don't think this is needed. Also, I feel
__init__is basically the same as the proposedcog_readywould be anyway.mathsman5133 commentedon Oct 10, 2019
Sure 👍 the difference being
cog_readycould be a coro so fetching webhooks and the like would be simple, but seems like that PR does the same jobSebastiaanZ commentedon Nov 6, 2019
@MarkKoz Are you currently working on this?
MarkKoz commentedon Nov 6, 2019
No, not currently. I was waiting on other PRs and eventually forgot about this. If you would like to work on this now, you can. Otherwise, I will try to get started today or tomorrow.
SebastiaanZ commentedon Nov 6, 2019
I don't think we're in a hurry, but I was reminded of it from people having some issues with their IDE not recognizing some of the attributes we set dynamically (e.g,
api_client). Having a customBotclass would solve that.I can work on it, but if you like to work on it, that's fine as well.
MarkKoz commentedon Nov 7, 2019
🤔 Where should it go?
__main__would be weird to import from.__init__already cluttered.bot.pywould be weird to import from (cause the package is also namedbot).scragly commentedon Nov 15, 2019
Define it in
bot/bot.py. Sure it might feel a little odd but it's the most appropriate place for it.