diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ed496b..7598096 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - The ability to answer ❓ to a HamStudy question to get the answer. - The list of available prefixes to `?help` when there is more than one. - `?donate` command to show ways to support qrm's development. +- `?invite` command to invite qrm to your server. ### Changed - New colour theme for `?greyline`. - Moved great circle distance and bearing calculation from `?ungrid` to `?griddistance`. diff --git a/exts/base.py b/exts/base.py index e787095..5e2c6d5 100644 --- a/exts/base.py +++ b/exts/base.py @@ -125,6 +125,8 @@ class BaseCog(commands.Cog): "Ko-Fi": "https://ko-fi.com/miaowware", "LiberaPay": "https://liberapay.com/miaowware", } + self.bot_invite = (f"https://discordapp.com/oauth2/authorize?client_id={self.bot.user.id}" + f"&scope=bot&permissions={opt.invite_perms}") @commands.command(name="info", aliases=["about"]) async def _info(self, ctx: commands.Context): @@ -212,6 +214,14 @@ class BaseCog(commands.Cog): embed.add_field(name=title, value=url, inline=False) await ctx.send(embed=embed) + @commands.command(name="invite", enabled=opt.enable_invite_cmd) + async def _invite(self, ctx: commands.Context): + """Generates a link to invite the bot to a server.""" + embed = cmn.embed_factory(ctx) + embed.title = "Invite qrm to Your Server!" + embed.description = self.bot_invite + await ctx.send(embed=embed) + @commands.command(name="echo", aliases=["e"], category=cmn.cat.admin) @commands.check(cmn.check_if_owner) async def _echo(self, ctx: commands.Context, diff --git a/templates/data/options.py b/templates/data/options.py index c9ca65e..1a19563 100644 --- a/templates/data/options.py +++ b/templates/data/options.py @@ -46,6 +46,12 @@ exts = [ "propagation", ] +# enable a command that provides a link to add the bot to a server +enable_invite_cmd = True + +# the default permissions for the bot, to be included in the invite link for ?invite +# this probably does not need to be changed +invite_perms = 67488832 # Either "time", "random", or "fixed" (first item in statuses) status_mode = "fixed"