add ?invite command

fixes #356
This commit is contained in:
Abigail G 2021-03-16 20:33:45 -04:00
parent fa82610469
commit df8d258446
No known key found for this signature in database
GPG Key ID: 6BE0755918A4C7F5
3 changed files with 17 additions and 0 deletions

View File

@ -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`.

View File

@ -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,

View File

@ -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"