Moved the startup ping response to a module, so it will only reply if the modules are enabled
This commit is contained in:
16
bot.py
16
bot.py
@@ -253,10 +253,6 @@ class Bot(commands.Bot):
|
||||
await self.check_for_modules()
|
||||
print("Bot started!")
|
||||
|
||||
@self.event
|
||||
async def on_message(message):
|
||||
await self.check_and_reply_to_ping(message)
|
||||
|
||||
# Check to see if other bots are online
|
||||
async def check_other_bots_online(self):
|
||||
print('Checking if other bots are online')
|
||||
@@ -272,7 +268,7 @@ class Bot(commands.Bot):
|
||||
await self.wait_until_ready()
|
||||
|
||||
# Send the ping command with the prefix the current bot is using
|
||||
await channel.send(f"{self.Command_Prefix}ping")
|
||||
await channel.send(f"{self.Command_Prefix}check_modules")
|
||||
|
||||
seconds_waited = 0
|
||||
while seconds_waited < 3:
|
||||
@@ -480,13 +476,3 @@ class Bot(commands.Bot):
|
||||
message_body += f"Squelch: {self.squelch}"
|
||||
|
||||
return message_body
|
||||
|
||||
# Check if message is a ping request and respond even if it is a bot
|
||||
async def check_and_reply_to_ping(self, message):
|
||||
if "ping" in message.content:
|
||||
ctx = await self.get_context(message)
|
||||
await self.invoke(ctx)
|
||||
return True
|
||||
else:
|
||||
await self.process_commands(message)
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user