Exemplo n.º 1
0
async def on_reaction_add(reaction, user):
    if reaction.message.author == bot.user:
        if has_admin_perms(user):
            if reaction.emoji == '🗑️':
                for field in reaction.message.embeds[0].to_dict()["fields"]:
                    if field["name"] == "Message ID:":
                        messageID = int(field["value"])
                    elif field["name"] == "Channel:":
                        channelID = int(re.sub('[^0-9]', '', field["value"]))
                channel = bot.get_channel(channelID)
                message = await channel.fetch_message(messageID)
                if await check_if_can_delete(user, channel.guild):
                    await message.delete()
                    await reaction.message.edit(embed=embedAppender(
                        reaction.message.embeds[0], "Actions taken:",
                        ", message deleted", "Message deleted"))
            elif reaction.emoji == '🔨':
                for field in reaction.message.embeds[0].to_dict()["fields"]:
                    if field["name"] == "ID:":
                        memberID = int(field["value"])
                    elif field["name"] == "Channel:":
                        channelID = int(re.sub('[^0-9]', '', field["value"]))
                channel = bot.get_channel(channelID)
                member = await channel.guild.fetch_member(memberID)
                if await check_if_can_ban(user, channel.guild):
                    await member.ban(reason="Caught spamming by FireFighter")
                    await reaction.message.edit(embed=embedAppender(
                        reaction.message.embeds[0], "Actions taken:",
                        ", banned", "Banned"))
Exemplo n.º 2
0
async def restart(ctx):
    if ctx.guild.id == 733383903544606800:
        if has_admin_perms(ctx.author):
            await ctx.channel.send("Restarting!")
            await global_channel.send("Bot is restarting!")
            sys.exit()
Exemplo n.º 3
0
async def init(ctx):
    if has_admin_perms(ctx.author):
        conf.Config[str(ctx.guild.id)] = conf.Config["baseConfig"]
Exemplo n.º 4
0
async def load_conf(ctx):
    if has_admin_perms(ctx.author):
        print("Loading config")
        conf.save_conf()
Exemplo n.º 5
0
async def save_conf(ctx):
    if has_admin_perms(ctx.author):
        print("Saving config")
        conf.open_conf()
Exemplo n.º 6
0
async def config(ctx, arg1, arg2):
    if has_admin_perms(ctx.author):
        try:
            conf.Config[str(ctx.guild.id)][arg1] = int(arg2)
        except ValueError:
            conf.Config[str(ctx.guild.id)][arg1] = arg2