add support command

This commit is contained in:
bmintz 2018-08-10 08:01:15 -05:00
parent 85eb1ce741
commit 402da00cd9
2 changed files with 19 additions and 0 deletions

View File

@ -1,6 +1,8 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# encoding: utf-8 # encoding: utf-8
import contextlib
import discord import discord
from discord.ext import commands from discord.ext import commands
@ -24,5 +26,20 @@ class Meta:
await context.send('<%s>' % discord.utils.oauth_url(self.bot.user.id, permissions)) await context.send('<%s>' % discord.utils.oauth_url(self.bot.user.id, permissions))
@commands.command()
async def support(self, context):
"""Directs you to the support server."""
try:
await context.author.send(self.bot.config['support_server_invite'])
with contextlib.suppress(discord.HTTPException):
await context.message.add_reaction('📬')
except discord.Forbidden:
with contextlib.suppress(discord.HTTPException):
await context.message.add_reaction('')
await context.send('Unable to send invite in DMs. Please allow DMs from server members.')
def setup(bot): def setup(bot):
bot.add_cog(Meta(bot)) bot.add_cog(Meta(bot))
if not bot.config.get('support_server_invite'):
bot.remove_command('support')

View File

@ -4,6 +4,8 @@
'NOTE: Most commands will be unavailable until both you and the bot have the ' 'NOTE: Most commands will be unavailable until both you and the bot have the '
'"Manage Emojis" permission.', '"Manage Emojis" permission.',
'support_server_invite': 'https://discord.gg/some-invite',
'cogs': ( 'cogs': (
'cogs.emote', 'cogs.emote',
'cogs.meta', 'cogs.meta',