From fa911485385012c0a8ac06e4b8cbf549f51acbe6 Mon Sep 17 00:00:00 2001 From: FO-nTTaX Date: Wed, 25 Aug 2021 02:08:34 +0200 Subject: [PATCH] use guild commands for moderation stuff --- ftsbot/cogs/channelmoderation.py | 9 +++++---- ftsbot/cogs/rolecommands.py | 6 +++--- ftsbot/config.py | 5 +++++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/ftsbot/cogs/channelmoderation.py b/ftsbot/cogs/channelmoderation.py index bec5ed5..9713416 100644 --- a/ftsbot/cogs/channelmoderation.py +++ b/ftsbot/cogs/channelmoderation.py @@ -16,10 +16,11 @@ def __init__(self, bot): @slash_commands.has_any_role('Discord Admins', 'Liquipedia Employee', 'Administrator') @slash_commands.command(description='Purge channel (admin only)', options=[ Option('channel', 'Which channel do you want to purge?', Type.CHANNEL) - ]) + ], guild_ids=config.guild_ids) async def channelpurge(self, ctx, channel=None): if channel is None: channel = ctx.channel + await ctx.send(embed=discord.Embed(colour=discord.Colour(0x00ff00), description='Channel ' + channel.name + ' is being purged')) if channel is None or not channel.name.startswith('temp_'): await ctx.send(embed=discord.Embed(colour=discord.Colour(0xff0000), description='Invalid channel')) else: @@ -29,7 +30,7 @@ async def channelpurge(self, ctx, channel=None): @slash_commands.has_any_role('Discord Admins', 'Liquipedia Employee', 'Administrator') @slash_commands.command(description='Creates a temp. private channel and invites the specified user to it (admin only)', options=[ Option('member', 'Who do you want to invite?', Type.USER, required=True) - ]) + ], guild_ids=config.guild_ids) async def channelcreate(self, ctx, member): await ctx.send(embed=discord.Embed(colour=discord.Colour(0x00ff00), description='Channel with ' + member.name + ' is being created')) guild = ctx.guild @@ -53,7 +54,7 @@ async def channelcreate(self, ctx, member): @slash_commands.has_any_role('Discord Admins', 'Liquipedia Employee', 'Administrator') @slash_commands.command(description='Copies the specified temp. or active channel to the archive (admin only)', options=[ Option('channel', 'Where do you want to copy things from?', Type.CHANNEL) - ]) + ], guild_ids=config.guild_ids) async def channelcopy(self, ctx, channel=None): if channel is None: channel = ctx.channel @@ -79,7 +80,7 @@ async def channelcopy(self, ctx, channel=None): @slash_commands.has_any_role('Discord Admins', 'Liquipedia Employee', 'Administrator') @slash_commands.command(description='Copies the specified temp. or active channel to the archive and deletes it (admin only)', options=[ Option('channel', 'Which do you want to delete?', Type.CHANNEL) - ]) + ], guild_ids=config.guild_ids) async def channelkill(self, ctx, channel=None): if channel is None: channel = ctx.channel diff --git a/ftsbot/cogs/rolecommands.py b/ftsbot/cogs/rolecommands.py index f04321f..bf55153 100644 --- a/ftsbot/cogs/rolecommands.py +++ b/ftsbot/cogs/rolecommands.py @@ -8,7 +8,7 @@ import discord from dislash import * from discord.ext import commands -from ftsbot import data +from ftsbot import config, data from ftsbot.functions import rolefunctions class rolecommands(commands.Cog): @@ -19,7 +19,7 @@ def __init__(self, bot): async def discordid(self, ctx): await ctx.send(embed=discord.Embed(colour=discord.Colour(0x00ffff), description='User "' + ctx.author.name + '" has ID "' + str(ctx.author.id) + '"')) - @slash_commands.command(description='Get your wiki roles') + @slash_commands.command(description='Get your wiki roles', guild_ids=config.guild_ids) async def wikiroles(self, ctx): apidata = rolefunctions.wikiroles(ctx.author.id) if apidata == False: @@ -44,7 +44,7 @@ async def wikiroles(self, ctx): await message.delete(delay=30) @slash_commands.is_owner() - @slash_commands.command(description='Form setup (admin only)') + @slash_commands.command(description='Form setup (admin only)', guild_ids=config.guild_ids) async def setup(self, ctx): # Clean up channel async for message in ctx.channel.history(): diff --git a/ftsbot/config.py b/ftsbot/config.py index 000c841..36d30e9 100644 --- a/ftsbot/config.py +++ b/ftsbot/config.py @@ -4,5 +4,10 @@ # Copyright 2016-2021 Alex Winkler # Version 3.0.0 +guild_ids = [ + 93055209017729024, + 223949725068427264 +] + logtarget = 339287109988909057 # Here the channel id of the channel we want the private channel logs to be stored in privcat = 360564294401916929 # This is the id of the "Private Channels" Category