Exemple #1
0
 async def addchannel(self, ctx, TYPE: str, channel: discord.TextChannel):
     """[STAFF ONLY]"""
     if GG.checkPermission(ctx, "mm"):
         TYPE = TYPE.upper()
         if TYPE in categories:
             if channel.id in GG.CHANNEL:
                 await ctx.send(
                     f"{channel.name} is already on the special channel list."
                 )
             else:
                 DBService.exec(
                     "INSERT INTO ChannelInfo (Guild, Channel, Type) VALUES ("
                     + str(ctx.guild.id) + "," + str(channel.id) + ",'" +
                     str(TYPE) + "')")
                 GG.CHANNEL[channel.id] = str(TYPE)
                 await ctx.send(
                     f"{channel.name} was added to the special channel list as {TYPE}"
                 )
         else:
             await ctx.send(
                 f"{TYPE} is not part of the list of specialized channels you can make. Please use one of the following:\n{categories}"
             )
     else:
         await ctx.send(
             "I don't have the Manage_Messages permission. It's a mandatory permission, I have noted my owner about this. Please give me this permission, I will end up leaving the server if it happens again."
         )
     await GG.upCommand("addchannel")
Exemple #2
0
    async def staff(self, ctx):
        if GG.checkPermission(ctx, "ar"):
            embed = self.staffCommand(ctx)
            message = await ctx.send(embed=embed)
            await message.add_reaction('📊')  # Poll
            await message.add_reaction('📖')  # Server commands
            await message.add_reaction('📝')  # Server quotes
            # await message.add_reaction('🔇')  # Mute
            await message.add_reaction('📔')
            await message.add_reaction('❌')

            await self.waitStaffChangeMessage(ctx, message)
        else:
            await ctx.invoke(self.bot.get_command("oldhelp"))
Exemple #3
0
    async def help(self, ctx):
        if GG.checkPermission(ctx, "ar"):
            embed = self.helpCommand(ctx)
            message = await ctx.send(embed=embed)
            await message.add_reaction('💬')
            await message.add_reaction('💭')
            await message.add_reaction('❓')
            await message.add_reaction('📘')
            if GG.is_staff_bool(ctx):
                await message.add_reaction('🔒')
            await message.add_reaction('📔')
            await message.add_reaction('❌')

            await self.waitChangeMessage(ctx, message)
        else:
            await ctx.invoke(self.bot.get_command("oldhelp"))
Exemple #4
0
 async def addchannel(self, ctx, TYPE: str, channel: discord.TextChannel):
     """[STAFF ONLY]"""
     if GG.checkPermission(ctx, "mm"):
         TYPE = TYPE.upper()
         if TYPE in categories:
             channelExists = await GG.MDB['channelinfo'].find_one({"channel": channel.id})
             if channelExists is not None:
                 await ctx.send(f"{channel.name} is already on the special channel list.")
             else:
                 await GG.MDB['channelinfo'].insert_one({"guild": ctx.guild.id, "channel": channel.id, "type": TYPE})
                 GG.CHANNEL[channel.id] = str(TYPE)
                 await ctx.send(f"{channel.name} was added to the special channel list as {TYPE}")
         else:
             await ctx.send(
                 f"{TYPE} is not part of the list of specialized channels you can make. Please use one of the following:\n{categories}")
     else:
         await ctx.send(
             "I don't have the Manage_Messages permission. It's a mandatory permission, I have noted my owner about this. Please give me this permission, I will end up leaving the server if it happens again.")
Exemple #5
0
 async def purge(self, ctx, limit):
     if GG.checkPermission(ctx, "mm"):
         try:
             if isinstance(int(limit), int):
                 await ctx.message.delete()
                 confirmation = BotConfirmation(ctx, 0x012345)
                 await confirmation.confirm(
                     f"Are you sure you want to remove {limit} messages?")
                 if confirmation.confirmed:
                     await confirmation.update(
                         f"Confirmed, **:put_litter_in_its_place:** deleting {limit} messages...",
                         color=0x55ff55)
                     try:
                         limit = int(limit)
                     except IndexError:
                         limit = 1
                     deleted = 0
                     while limit >= 1:
                         cap = min(limit, 100)
                         deleted += len(await ctx.channel.purge(
                             limit=cap, before=ctx.message))
                         limit -= cap
                     await asyncio.sleep(8)
                     await confirmation.delete()
                 else:
                     await confirmation.delete()
             else:
                 msg = await ctx.send(
                     "I need a number for how many messages I need to purge..."
                 )
                 await asyncio.sleep(4)
                 await msg.delete()
         except ValueError:
             msg = await ctx.send(
                 "I need a number for how many messages I need to purge...")
             await asyncio.sleep(4)
             await msg.delete()
     else:
         await ctx.send(
             "I don't have the Manage_Messages permission. It's a mandatory permission, I have noted my owner about this. Please give me this permission, I will end up leaving the server if it happens again."
         )
     await GG.upCommand("purge")
Exemple #6
0
    async def poll(self, ctx):
        """[STAFF ONLY]
        $poll {title} [answer1] [answer2] ... [answer20]
        This command can be used to create a poll with a specific title and specific answers.
        Note that this command supports up to 20 answers. and the {} around the title and [] around the answers are required"""

        if GG.checkPermission(ctx, "ar"):
            message = ctx.message
            if not message.author.bot:
                messageContent = message.clean_content
                if messageContent.find("{") == -1:
                    await message.add_reaction('­ЪЉЇ')
                    await message.add_reaction('­ЪЉј')
                    await message.add_reaction('­Ъци')
                else:
                    first = messageContent.find("{") + 1
                    second = messageContent.find("}")
                    title = messageContent[first:second]

                    # gets the # of options and assigns them to an array
                    newMessage = messageContent[second:]
                    loopTime = 0

                    option = []
                    for options in messageContent:
                        # get from } [option 1]
                        # if newThis == -1:
                        stillOptions = newMessage.find("[")
                        if stillOptions != -1:
                            if loopTime == 0:
                                first = newMessage.find("[") + 1
                                second = newMessage.find("]")
                                second1 = second + 1
                                option.append(newMessage[first:second])
                                loopTime += 1
                            else:
                                newMessage = newMessage[second1:]
                                first = newMessage.find("[") + 1
                                second = newMessage.find("]")
                                second1 = second + 1
                                option.append(newMessage[first:second])
                                loopTime += 1

                    try:
                        pollMessage = ""

                        # there is probably a better way to do this
                        i = 0
                        for choice in option:
                            if not option[i] == "":
                                if len(option) > 20:
                                    await ctx.send("Maximum of 20 options")
                                    return
                                elif not i == len(option) - 1:
                                    pollMessage = pollMessage + "\n\n" + self.emojiLetters[i] + " " + choice
                            i += 1

                        e = discord.Embed(title="**" + title + "**",
                                          description=pollMessage,
                                          colour=0x83bae3)
                        pollMessage = await ctx.send(embed=e)
                        i = 0
                        final_options = []  # There is a better way to do this for sure, but it also works that way
                        for choice in option:
                            if not i == len(option) - 1 and not option[i] == "":
                                final_options.append(choice)
                                await pollMessage.add_reaction(self.emojiLetters[i])
                            i += 1
                    except KeyError:
                        return "Please make sure you are using the format '!poll {title} [Option1] [Option2] [etc.]'"
        else:
            ctx.send("I don't have the add_reactions permission, while it is optional, I need it for this command.")
        await GG.upCommand("poll")