From f44b106b60ca90d125ff54e5e39c2b9eb916dce9 Mon Sep 17 00:00:00 2001 From: bmintz Date: Tue, 31 Jul 2018 18:02:44 -0500 Subject: [PATCH] add invite command --- cogs/meta.py | 28 ++++++++++++++++++++++++++++ config.example.py | 1 + 2 files changed, 29 insertions(+) create mode 100644 cogs/meta.py diff --git a/cogs/meta.py b/cogs/meta.py new file mode 100644 index 0000000..7172c3e --- /dev/null +++ b/cogs/meta.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 +# encoding: utf-8 + +import discord +from discord.ext import commands + + +class Meta: + def __init__(self, bot): + self.bot = bot + + @commands.command(aliases=['inv']) + async def invite(self, context): + """Gives you a link to add me to your server.""" + permissions = discord.Permissions() + permissions.update(**dict.fromkeys(( + 'read_messages', + 'send_messages', + 'add_reactions', + 'external_emojis', + 'manage_emojis', + 'embed_links', + ), True)) + + await context.send('<%s>' % discord.utils.oauth_url(self.bot.user.id, permissions)) + +def setup(bot): + bot.add_cog(Meta(bot)) diff --git a/config.example.py b/config.example.py index 8f33607..e5ce8c4 100644 --- a/config.example.py +++ b/config.example.py @@ -1,6 +1,7 @@ { 'cogs': ( 'cogs.emote', + 'cogs.meta', 'ben_cogs.debug', 'ben_cogs.misc', 'ben_cogs.debug'