*insert Dinner Party vasectomy quote here*

This commit is contained in:
Ske 2018-12-11 21:02:30 +01:00
parent ea07e931fc
commit 63ccfc1215
2 changed files with 11 additions and 2 deletions

View File

@ -11,6 +11,7 @@ services:
- CLIENT_ID - CLIENT_ID
- TOKEN - TOKEN
- LOG_CHANNEL - LOG_CHANNEL
- TUPPERWARE_ID
- "DATABASE_USER=postgres" - "DATABASE_USER=postgres"
- "DATABASE_PASS=postgres" - "DATABASE_PASS=postgres"
- "DATABASE_NAME=postgres" - "DATABASE_NAME=postgres"

View File

@ -1,8 +1,15 @@
import os
from datetime import datetime from datetime import datetime
from pluralkit.bot.commands import * from pluralkit.bot.commands import *
def default_tupperware_id():
if "TUPPERWARE_ID" in os.environ:
return int(os.environ["TUPPERWARE_ID"])
return 431544605209788416
async def import_root(ctx: CommandContext): async def import_root(ctx: CommandContext):
# Only one import method rn, so why not default to Tupperware? # Only one import method rn, so why not default to Tupperware?
await import_tupperware(ctx) await import_tupperware(ctx)
@ -11,7 +18,7 @@ async def import_root(ctx: CommandContext):
async def import_tupperware(ctx: CommandContext): async def import_tupperware(ctx: CommandContext):
# Check if there's a Tupperware bot on the server # Check if there's a Tupperware bot on the server
# Main instance of TW has that ID, at least # Main instance of TW has that ID, at least
tupperware_id = 431544605209788416 tupperware_id = default_tupperware_id()
if ctx.has_next(): if ctx.has_next():
try: try:
id_str = ctx.pop_str() id_str = ctx.pop_str()
@ -24,7 +31,8 @@ async def import_tupperware(ctx: CommandContext):
raise CommandError( raise CommandError(
"""This command only works in a server where the Tupperware bot is also present. """This command only works in a server where the Tupperware bot is also present.
If you're trying to import from a Tupperware instance other than the main one (which has the ID 431544605209788416), pass the ID of that instance as a parameter.""") If you're trying to import from a Tupperware instance other than the main one (which has the ID {}), pass the ID of that instance as a parameter.""".format(
default_tupperware_id()))
# Make sure at the bot has send/read permissions here # Make sure at the bot has send/read permissions here
channel_permissions = ctx.message.channel.permissions_for(tupperware_member) channel_permissions = ctx.message.channel.permissions_for(tupperware_member)