Finished the bot. Requires testing.

Wrote up documentation. Readme needs finishing.
Future development needs to use global listeners for processes.
This commit is contained in:
2021-07-23 15:55:27 +01:00
parent 2f974f9f8f
commit 5bb9af12c9
9 changed files with 334 additions and 81 deletions

View File

@ -28,20 +28,19 @@ class on_message(commands.Cog, name='On Message Events'):
guild = message.guild
guildStr = str(guild.id)
if 'notifications' in conf[guildStr]:
if 'help' in conf[guildStr]['notifications']:
if conf[guildStr]['notifications']['help']:
if 'help' in conf[guildStr]['channels'] and 'committee' in conf[guildStr]['roles']:
if message.channel.id == conf[guildStr]['channels']['help'] and isinstance(guild.get_role(conf[guildStr]['roles']['committee']), discord.Role):
modChannel = self.client.get_channel(conf[guildStr]['channels']['mod'])
committeeRole = guild.get_role(conf[guildStr]['roles']['committee'])
embed = discord.Embed(
title = f'[New Query in Help]({message.jump_url})',
description = message.content,
colour = discord.Colour.orange()
)
embed.set_footer(text=datetime.now().strftime('%a %-d %b %y, %-I:%M %p'))
embed.set_author(name=message.author.display_name, icon_url=message.author.avatar_url)
await modChannel.send(f'{committeeRole.mention}\n```There has been a new help query posted.```\n{message.author.mention}` posted in `{message.channel.mention}`.`', embed = embed)
if conf[guildStr]['notifications'].get('help', False):
if 'help' in conf[guildStr]['channels'] and 'committee' in conf[guildStr]['roles']:
if message.channel.id == conf[guildStr]['channels']['help'] and isinstance(guild.get_role(conf[guildStr]['roles']['committee']), discord.Role):
modChannel = self.client.get_channel(conf[guildStr]['channels']['mod'])
committeeRole = guild.get_role(conf[guildStr]['roles']['committee'])
embed = discord.Embed(
title = f'[New Query in Help]({message.jump_url})',
description = message.content,
colour = discord.Colour.orange()
)
embed.set_footer(text=datetime.now().strftime('%a %-d %b %y, %-I:%M %p'))
embed.set_author(name=message.author.display_name, icon_url=message.author.avatar_url)
await modChannel.send(f'{committeeRole.mention}\n```There has been a new help query posted.```\n{message.author.mention}` posted in `{message.channel.mention}`.`', embed = embed)
def setup(client):
client.add_cog(on_message(client))