mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[Core] Added co-owners to outdated message warnings (#2664)
* Added co-owners to potentially DMd users * Fetch the cached of every guild, see comments of #2664 * Ensure owners can be DM'd. * Refactoring try block.
This commit is contained in:
parent
3b6d4d9df6
commit
3de1a265ea
@ -104,7 +104,9 @@ def main():
|
|||||||
log.debug("Data Path: %s", data_manager._base_data_path())
|
log.debug("Data Path: %s", data_manager._base_data_path())
|
||||||
log.debug("Storage Type: %s", data_manager.storage_type())
|
log.debug("Storage Type: %s", data_manager.storage_type())
|
||||||
|
|
||||||
red = Red(cli_flags=cli_flags, description=description, dm_help=None)
|
red = Red(
|
||||||
|
cli_flags=cli_flags, description=description, dm_help=None, fetch_offline_members=True
|
||||||
|
)
|
||||||
init_global_checks(red)
|
init_global_checks(red)
|
||||||
init_events(red, cli_flags)
|
init_events(red, cli_flags)
|
||||||
red.add_cog(Core(red))
|
red.add_cog(Core(red))
|
||||||
|
|||||||
@ -119,7 +119,19 @@ def init_events(bot, cli_flags):
|
|||||||
"Outdated version! {} is available "
|
"Outdated version! {} is available "
|
||||||
"but you're using {}".format(data["info"]["version"], red_version)
|
"but you're using {}".format(data["info"]["version"], red_version)
|
||||||
)
|
)
|
||||||
owner = await bot.fetch_user(bot.owner_id)
|
|
||||||
|
owners = []
|
||||||
|
owner = bot.get_user(bot.owner_id)
|
||||||
|
if owner is not None:
|
||||||
|
owners.append(owner)
|
||||||
|
|
||||||
|
for co_owner in bot._co_owners:
|
||||||
|
co_owner = await bot.get_user(co_owner)
|
||||||
|
if co_owner is not None:
|
||||||
|
owners.append(co_owner)
|
||||||
|
|
||||||
|
for owner in owners:
|
||||||
|
with contextlib.suppress(discord.HTTPException):
|
||||||
await owner.send(
|
await owner.send(
|
||||||
"Your Red instance is out of date! {} is the current "
|
"Your Red instance is out of date! {} is the current "
|
||||||
"version, however you are using {}!".format(
|
"version, however you are using {}!".format(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user