aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2019-12-20 21:05:03 -0800
committerGravatar MarkKoz <[email protected]>2020-02-12 10:07:44 -0800
commit04d8e1410d8839e4147522094ca40e41fe6e48e7 (patch)
treef4f604df112b376e7536a0b9e83f25dd5552bda3
parentBot: make the connector attribute private (diff)
Use wait_until_guild_available instead of wait_until_ready
It has a much better guarantee that the cache will be available.
-rw-r--r--bot/cogs/antispam.py2
-rw-r--r--bot/cogs/defcon.py2
-rw-r--r--bot/cogs/doc.py2
-rw-r--r--bot/cogs/duck_pond.py2
-rw-r--r--bot/cogs/logging.py2
-rw-r--r--bot/cogs/moderation/scheduler.py2
-rw-r--r--bot/cogs/off_topic_names.py2
-rw-r--r--bot/cogs/reddit.py4
-rw-r--r--bot/cogs/reminders.py2
-rw-r--r--bot/cogs/sync/cog.py2
-rw-r--r--bot/cogs/verification.py2
-rw-r--r--bot/cogs/watchchannels/watchchannel.py2
12 files changed, 13 insertions, 13 deletions
diff --git a/bot/cogs/antispam.py b/bot/cogs/antispam.py
index f67ef6f05..baa6b9459 100644
--- a/bot/cogs/antispam.py
+++ b/bot/cogs/antispam.py
@@ -123,7 +123,7 @@ class AntiSpam(Cog):
async def alert_on_validation_error(self) -> None:
"""Unloads the cog and alerts admins if configuration validation failed."""
- await self.bot.wait_until_ready()
+ await self.bot.wait_until_guild_available()
if self.validation_errors:
body = "**The following errors were encountered:**\n"
body += "\n".join(f"- {error}" for error in self.validation_errors.values())
diff --git a/bot/cogs/defcon.py b/bot/cogs/defcon.py
index 3e7350fcc..b97e2356f 100644
--- a/bot/cogs/defcon.py
+++ b/bot/cogs/defcon.py
@@ -59,7 +59,7 @@ class Defcon(Cog):
async def sync_settings(self) -> None:
"""On cog load, try to synchronize DEFCON settings to the API."""
- await self.bot.wait_until_ready()
+ await self.bot.wait_until_guild_available()
self.channel = await self.bot.fetch_channel(Channels.defcon)
try:
diff --git a/bot/cogs/doc.py b/bot/cogs/doc.py
index 6e7c00b6a..204cffb37 100644
--- a/bot/cogs/doc.py
+++ b/bot/cogs/doc.py
@@ -157,7 +157,7 @@ class Doc(commands.Cog):
async def init_refresh_inventory(self) -> None:
"""Refresh documentation inventory on cog initialization."""
- await self.bot.wait_until_ready()
+ await self.bot.wait_until_guild_available()
await self.refresh_inventory()
async def update_single(
diff --git a/bot/cogs/duck_pond.py b/bot/cogs/duck_pond.py
index 345d2856c..1f84a0609 100644
--- a/bot/cogs/duck_pond.py
+++ b/bot/cogs/duck_pond.py
@@ -22,7 +22,7 @@ class DuckPond(Cog):
async def fetch_webhook(self) -> None:
"""Fetches the webhook object, so we can post to it."""
- await self.bot.wait_until_ready()
+ await self.bot.wait_until_guild_available()
try:
self.webhook = await self.bot.fetch_webhook(self.webhook_id)
diff --git a/bot/cogs/logging.py b/bot/cogs/logging.py
index d1b7dcab3..dbd76672f 100644
--- a/bot/cogs/logging.py
+++ b/bot/cogs/logging.py
@@ -20,7 +20,7 @@ class Logging(Cog):
async def startup_greeting(self) -> None:
"""Announce our presence to the configured devlog channel."""
- await self.bot.wait_until_ready()
+ await self.bot.wait_until_guild_available()
log.info("Bot connected!")
embed = Embed(description="Connected!")
diff --git a/bot/cogs/moderation/scheduler.py b/bot/cogs/moderation/scheduler.py
index e14c302cb..a332fefa5 100644
--- a/bot/cogs/moderation/scheduler.py
+++ b/bot/cogs/moderation/scheduler.py
@@ -38,7 +38,7 @@ class InfractionScheduler(Scheduler):
async def reschedule_infractions(self, supported_infractions: t.Container[str]) -> None:
"""Schedule expiration for previous infractions."""
- await self.bot.wait_until_ready()
+ await self.bot.wait_until_guild_available()
log.trace(f"Rescheduling infractions for {self.__class__.__name__}.")
diff --git a/bot/cogs/off_topic_names.py b/bot/cogs/off_topic_names.py
index bf777ea5a..81511f99d 100644
--- a/bot/cogs/off_topic_names.py
+++ b/bot/cogs/off_topic_names.py
@@ -88,7 +88,7 @@ class OffTopicNames(Cog):
async def init_offtopic_updater(self) -> None:
"""Start off-topic channel updating event loop if it hasn't already started."""
- await self.bot.wait_until_ready()
+ await self.bot.wait_until_guild_available()
if self.updater_task is None:
coro = update_names(self.bot)
self.updater_task = self.bot.loop.create_task(coro)
diff --git a/bot/cogs/reddit.py b/bot/cogs/reddit.py
index aa487f18e..4f6584aba 100644
--- a/bot/cogs/reddit.py
+++ b/bot/cogs/reddit.py
@@ -48,7 +48,7 @@ class Reddit(Cog):
async def init_reddit_ready(self) -> None:
"""Sets the reddit webhook when the cog is loaded."""
- await self.bot.wait_until_ready()
+ await self.bot.wait_until_guild_available()
if not self.webhook:
self.webhook = await self.bot.fetch_webhook(Webhooks.reddit)
@@ -208,7 +208,7 @@ class Reddit(Cog):
await asyncio.sleep(seconds_until)
- await self.bot.wait_until_ready()
+ await self.bot.wait_until_guild_available()
if not self.webhook:
await self.bot.fetch_webhook(Webhooks.reddit)
diff --git a/bot/cogs/reminders.py b/bot/cogs/reminders.py
index 45bf9a8f4..89066e5d4 100644
--- a/bot/cogs/reminders.py
+++ b/bot/cogs/reminders.py
@@ -35,7 +35,7 @@ class Reminders(Scheduler, Cog):
async def reschedule_reminders(self) -> None:
"""Get all current reminders from the API and reschedule them."""
- await self.bot.wait_until_ready()
+ await self.bot.wait_until_guild_available()
response = await self.bot.api_client.get(
'bot/reminders',
params={'active': 'true'}
diff --git a/bot/cogs/sync/cog.py b/bot/cogs/sync/cog.py
index 4e6ed156b..9ef3b0c54 100644
--- a/bot/cogs/sync/cog.py
+++ b/bot/cogs/sync/cog.py
@@ -34,7 +34,7 @@ class Sync(Cog):
async def sync_guild(self) -> None:
"""Syncs the roles/users of the guild with the database."""
- await self.bot.wait_until_ready()
+ await self.bot.wait_until_guild_available()
guild = self.bot.get_guild(self.SYNC_SERVER_ID)
if guild is not None:
for syncer in self.ON_READY_SYNCERS:
diff --git a/bot/cogs/verification.py b/bot/cogs/verification.py
index 988e0d49a..07838c7bd 100644
--- a/bot/cogs/verification.py
+++ b/bot/cogs/verification.py
@@ -223,7 +223,7 @@ class Verification(Cog):
@periodic_ping.before_loop
async def before_ping(self) -> None:
"""Only start the loop when the bot is ready."""
- await self.bot.wait_until_ready()
+ await self.bot.wait_until_guild_available()
def cog_unload(self) -> None:
"""Cancel the periodic ping task when the cog is unloaded."""
diff --git a/bot/cogs/watchchannels/watchchannel.py b/bot/cogs/watchchannels/watchchannel.py
index eb787b083..3667a80e8 100644
--- a/bot/cogs/watchchannels/watchchannel.py
+++ b/bot/cogs/watchchannels/watchchannel.py
@@ -91,7 +91,7 @@ class WatchChannel(metaclass=CogABCMeta):
async def start_watchchannel(self) -> None:
"""Starts the watch channel by getting the channel, webhook, and user cache ready."""
- await self.bot.wait_until_ready()
+ await self.bot.wait_until_guild_available()
try:
self.channel = await self.bot.fetch_channel(self.destination)