Add command to show invite link

This commit is contained in:
Ske 2018-07-14 21:39:51 +02:00
parent 5bdd9af2e2
commit e965bc2913
2 changed files with 21 additions and 1 deletions

View File

@ -1,9 +1,11 @@
from datetime import datetime from datetime import datetime
import itertools import itertools
import os
import re import re
from urllib.parse import urlparse from urllib.parse import urlparse
import discord import discord
from discord.utils import oauth_url
import humanize import humanize
from pluralkit import db from pluralkit import db
@ -581,4 +583,21 @@ async def import_tupperware(conn, message, args):
await db.update_member_field(conn, member_id=existing_member["id"], field="birthday", value=member_birthdate) await db.update_member_field(conn, member_id=existing_member["id"], field="birthday", value=member_birthdate)
await db.update_member_field(conn, member_id=existing_member["id"], field="description", value=member_description) await db.update_member_field(conn, member_id=existing_member["id"], field="description", value=member_description)
return True, "System information imported. Try using `pk;system` now.\nYou should probably remove your members from Tupperware to avoid double-posting." return True, "System information imported. Try using `pk;system` now.\nYou should probably remove your members from Tupperware to avoid double-posting."
@command(cmd="invite", description="Generates an invite link for this bot.")
async def invite_link(conn, message, args):
client_id = os.environ["CLIENT_ID"]
permissions = discord.Permissions()
permissions.manage_webhooks = True
permissions.send_messages = True
permissions.manage_messages = True
permissions.embed_links = True
permissions.attach_files = True
permissions.read_message_history = True
permissions.add_reactions = True
url = oauth_url(client_id, permissions)
logger.debug("Sending invite URL: {}".format(url))
return True, url

View File

@ -5,6 +5,7 @@ services:
depends_on: depends_on:
- db - db
environment: environment:
- CLIENT_ID
- TOKEN - TOKEN
db: db:
image: postgres:alpine image: postgres:alpine