1
0

stop.py 800 B

123456789101112131415161718192021222324
  1. import discord.ext.commands as discord_cmds
  2. import myanimebot.utils as utils
  3. import myanimebot.globals as globals
  4. import myanimebot.commands.permissions as permissions
  5. @discord_cmds.command(name="stop")
  6. @discord_cmds.check(permissions.in_allowed_role)
  7. async def stop_cmd(ctx):
  8. ''' Processes the command "stop" and unregisters a channel '''
  9. server = ctx.guild
  10. if utils.is_server_in_db(server.id):
  11. # Remove server from DB
  12. cursor = globals.conn.cursor(buffered=True)
  13. cursor.execute("DELETE FROM t_servers WHERE server = {}".format(server.id))
  14. globals.conn.commit()
  15. await ctx.send("Server **{}** is now unregistered from our database.".format(server))
  16. else:
  17. await ctx.send("Server **{}** was already not registered.".format(server))