[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:
Kowlin
2019-05-14 06:33:05 +02:00
committed by Michael H
parent 3b6d4d9df6
commit 3de1a265ea
2 changed files with 22 additions and 8 deletions

View File

@@ -119,13 +119,25 @@ def init_events(bot, cli_flags):
"Outdated version! {} is available "
"but you're using {}".format(data["info"]["version"], red_version)
)
owner = await bot.fetch_user(bot.owner_id)
await owner.send(
"Your Red instance is out of date! {} is the current "
"version, however you are using {}!".format(
data["info"]["version"], red_version
)
)
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(
"Your Red instance is out of date! {} is the current "
"version, however you are using {}!".format(
data["info"]["version"], red_version
)
)
INFO2 = []
mongo_enabled = storage_type() != "JSON"