ZeLarpMaster / ZeCogsV3

My personal https://github.com/Twentysix26/Red-DiscordBot repo for V3 cogs
GNU General Public License v3.0
15 stars 17 forks source link

[Birthdays] Guild chunking depreciation #43

Open aikaterna opened 3 years ago

aikaterna commented 3 years ago

Hey there, I'm getting /.../Red-DiscordBot/cogs/CogManager/cogs/birthdays/birthdays.py:171: DeprecationWarning: request_offline_members is deprecated, use Guild.chunk instead. in my console.

This may be able to be fixed by just using await guild.chunk on the affected guilds instead of https://github.com/ZeLarpMaster/ZeCogsV3/blob/71562b347374c664537c3b39dc306ee8423922bc/birthdays/birthdays.py#L252 but this may cause issues for bots without specific presences as chunking can take a very long time in certain circumstances.

I'm also not sure if a guild.chunked check needs to be considered for addition to: https://github.com/ZeLarpMaster/ZeCogsV3/blob/71562b347374c664537c3b39dc306ee8423922bc/birthdays/birthdays.py#L250

Figured I'd open an issue to see how you'd like to go about changing that or if you have time to take a look. If not no big deal, I may be able to do some experimenting and see how this can work.

ZeLarpMaster commented 3 years ago

I think the best thing to do would be to stop using those functions. The only reason why that was necessary was because maybe_update_guild was immediately followed by a guild.get_member for usage in role changes as seen here: https://github.com/ZeLarpMaster/ZeCogsV3/blob/71562b347374c664537c3b39dc306ee8423922bc/birthdays/birthdays.py#L168-L172 Both of those aren't necessary if we instead update the roles by ids. Unfortunately discord.py only has APIs through its classes so we'll need to bypass those to make it work, but I think that's a worthy price to pay considering discord.py's lack of alternative options... This also has the side effect of removing the request of guild members and thus not making the bot wait for that before removing roles.

If you have better suggestions, I'm open for discussion