Ejemplo n.º 1
0
    async def setup_mod_channel(self,
                                ctx,
                                channel_id,
                                too_many_arguments=None):
        """
        Add a mod channel to the current guild

        :param ctx: The discord context
        :param channel_id: The designated channel id for message details
        :param too_many_arguments: Used to check if too many arguments have been given
        :return:
        """
        error = "Channel not found or too many arguments, please try again: `k!setupModChannel [channel_id]`"
        channel = self.bot.get_channel(int(extract_id(channel_id)))
        if channel is not None and too_many_arguments is None:
            self.tf_database_manager.new_mod_channel(ctx.guild.id, channel.id)
            await ctx.channel.send(
                embed=build_moderation_channel_embed(ctx, channel, "Added"))
            return
        raise (Exception(error))
Ejemplo n.º 2
0
 async def remove_role(self, ctx):
     """
     Remove a role from a list of people to send the announcement to
     :param ctx: The context of the bot
     :return:
     """
     if self.has_active_msg(ctx.guild.id):
         await ctx.send(
             "Please enter the roles you want to remove separated by space, I'll wait for 60 seconds, no rush."
         )
         message, channel = await wait_for_message(self.bot, ctx)
         if not message:
             await channel.send("Okay, I'll cancel the command.")
             return
         for new_role in message.content.split():
             role_id = extract_id(new_role)
             if role_id in self.roles[ctx.guild.id]:
                 self.roles[ctx.guild.id].remove(role_id)
         await ctx.send(self.receiver_msg(ctx.guild))
     else:
         await ctx.send("There is currently no active announcement")
Ejemplo n.º 3
0
    async def remove_mod_channel(self,
                                 ctx,
                                 channel_id,
                                 too_many_arguments=None):
        """
        Remove a mod channel from the guild

        :param ctx: The discord context
        :param channel_id: The designated channel id to be removed
        :param too_many_arguments: Used to check if too many arguments have been given
        :return:
        """
        error = """Missing Channel ID or too many arguments remove a mod channel. If you don't know your Channel ID,
                use `k!listModChannels` to get information on your mod channels."""
        channel = self.bot.get_channel(int(extract_id(channel_id)))
        if channel is not None and too_many_arguments is None:
            self.tf_database_manager.remove_mod_channel(
                ctx.guild.id, channel_id)
            await ctx.channel.send(
                embed=build_moderation_channel_embed(ctx, channel, "Removed"))
            return
        raise Exception(error)
Ejemplo n.º 4
0
 async def add_role(self, ctx):
     """
     Add a role to list of people to send the announcement to
     :param ctx: The context of the bot
     :return:
     """
     if self.has_active_msg(ctx.guild.id):
         await ctx.send(
             "Please enter the roles you want to tag separated by space, I'll wait for 60 seconds, no rush."
         )
         message, channel = await wait_for_message(self.bot, ctx)
         if not message:
             await channel.send("Okay, I'll cancel the command.")
             return
         for new_role in message.content.split():
             role_id = extract_id(new_role)
             if role_id not in self.roles[
                     ctx.guild.id] and discord.utils.get(
                         ctx.guild.roles, id=role_id) is not None:
                 self.roles[ctx.guild.id].append(role_id)
         await ctx.send(self.receiver_msg(ctx.guild))
     else:
         await ctx.send("There is currently no active announcement")