Moved the startup ping response to a module, so it will only reply if the modules are enabled
This commit is contained in:
@@ -2,7 +2,7 @@ import re
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
import random
|
||||
from BotResources import PDB_KNOWN_BOT_IDS
|
||||
from BotResources import PDB_KNOWN_BOT_IDS, check_and_reply_to_ping
|
||||
|
||||
regex_link = re.compile('(http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)')
|
||||
|
||||
@@ -71,7 +71,7 @@ class LinkCop(commands.Cog):
|
||||
print(f"Link Cop Error: '{err}'")
|
||||
print(f"Bot or other non-user that has not been whitelisted sent a message")
|
||||
|
||||
await self.bot.check_and_reply_to_ping(ctx)
|
||||
await check_and_reply_to_ping(self.bot, ctx)
|
||||
|
||||
async def send_message(self, message):
|
||||
send_channel = self.bot.get_channel(id=self.reply_channel_id)
|
||||
|
||||
24
modules/ModuleProbe/cog.py
Normal file
24
modules/ModuleProbe/cog.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from discord.ext import commands
|
||||
from BotResources import check_and_reply_to_ping
|
||||
|
||||
|
||||
class ModuleProbe(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self.channel_id = 767303243285790721
|
||||
|
||||
self.add_events()
|
||||
|
||||
def add_events(self):
|
||||
@self.bot.event
|
||||
async def on_message(message):
|
||||
await check_and_reply_to_ping(self.bot, message)
|
||||
|
||||
@commands.command(help="This command is used by other bots to test if there are any bots online with modules.")
|
||||
async def check_modules(self, ctx):
|
||||
if ctx.author.id != self.bot.user.id:
|
||||
await ctx.send('pong')
|
||||
|
||||
|
||||
def setup(bot: commands.Bot):
|
||||
bot.add_cog(ModuleProbe(bot))
|
||||
Reference in New Issue
Block a user