Exemplo n.º 1
0
    async def gen_name_colors_msg(self, guild):
        key = dict()
        rkey = dict()
        desc = 'Add a reaction to set your name colour!\n\n'
        nc_roles = [
            role for role in guild.roles
            if role.id in self.bot.config.name_colors
        ]
        nc_roles.reverse()

        # ===== BUILD THE EMBED DESCRIPTION
        for i, role in enumerate(nc_roles):
            desc = f'{desc}{self.emojiname[i]} - for {role.name}\n'
            key[self.emojistring[i]] = role.id
            rkey[role.id] = self.emojistring[i]

        # ===== BUILD THE EMBED
        e = discord.Embed(title="Set Name Colour",
                          description=desc,
                          colour=RANDOM_DISCORD_COLOR(),
                          type="rich",
                          timestamp=datetime.datetime.utcnow())
        e.set_footer(icon_url=GUILD_URL_AS(guild), text=guild.name)

        return (e, key, rkey, nc_roles)
Exemplo n.º 2
0
    async def cmd_8ball(self, ctx, question: str):
        """
        [Core] Rolls an 8ball. Ask 8 ball a question, all questions must end with a question mark.

        Useage:
            [prefix]8ball <question>
        """

        if len(question) == 0:
            await ctx.send_help('8ball')
            return

        if question.endswith("?") and question != "?":
            e = discord.Embed(title="Question",
                              type="rich",
                              color=RANDOM_DISCORD_COLOR(),
                              description=question,
                              timestamp=datetime.datetime.utcnow())
            e.add_field(name="Answer",
                        value=random.choice(Fun.ball),
                        inline=False)
            e.set_author(name="8Ball | {0.name}#{0.discriminator}".format(
                ctx.author),
                         icon_url=AVATAR_URL_AS(user=ctx.author))
            e.set_footer(icon_url=GUILD_URL_AS(ctx.guild),
                         text=f"{ctx.guild.name}")

            await ctx.channel.send(embed=e)

        else:
            await ctx.channel.send(content="That doesn't look like a question."
                                   )

        return
Exemplo n.º 3
0
async def __gen_guildstaff_embed(ctx, roles):
    if isinstance(roles, list):
        rroles = " ".join(roles)
    else:
        rroles = roles

    embed = discord.Embed(
        title=
        ':octagonal_sign: You lack the required permissions to preform this command :octagonal_sign:',
        description="",
        type='False',
        timestamp=datetime.datetime.utcnow(),
        color=RANDOM_DISCORD_COLOR())

    embed.set_footer(icon_url=GUILD_URL_AS(ctx.guild), text=ctx.guild.name)

    embed.add_field(
        name="Error:",
        value="```\n"
        "Suffcient permissions required for this command.\n"
        f"You need one of the following roles: {rroles} **or** administrator permissions.\n"
        f"If you require the use of this command to preform your duties, then contact {ctx.guild.owner.name}#{ctx.guild.owner.discriminator} for assistance.\n"
        "```",
        inline=False)

    return embed
Exemplo n.º 4
0
    async def cmd_galsettings(self, ctx, showlinks=False):
        sched = None
        for job in self.jobstore.get_all_jobs():
            if ["_delete_gallery_messages"] == job.id.split(" "):
                sched = job

        embed=discord.Embed(    
            title=      "Gallery Channel Settings.",
            description=f"**Enabled:** {self.cogset['enable']}\n"
                        f"**Expire time:** {self.cogset['text_expirein']} hours",
            colour=     RANDOM_DISCORD_COLOR(),
            type=       "rich",
            timestamp=  datetime.datetime.utcnow()
            )

        embed.add_field(
            name=       "Gallery Channels",
            value=      "\n".join([f"<#{ch_id}>" for ch_id in self.cogset['channel_ids']]) or "None",
            inline=     False
            )    

        embed.add_field(
            name=       "Whitelisted Members",
            value=      "\n".join([f"<#{user_id}>" for user_id in self.cogset['user_wl']]) or "None",
            inline=     False
            )

        if showlinks:
            links = "\n".join(self.cogset["link_wl"])

            embed.add_field(
                name=       "Gallery Links",
                value=      f'**Allowed:** {self.cogset["allow_links"]}\n'
                            f'**Links:** {links}',
                inline=     False
                )   

        if sched:
            run_time = sched.next_run_time.__str__()
        else:
            run_time = "never"

        embed.add_field(
            name=       "Scheduler",
            value=      f"**Next run time:** {run_time}",
            inline=     False
        )   

        embed.set_footer(       
            icon_url=   GUILD_URL_AS(ctx.guild) if ctx.guild else AVATAR_URL_AS(self.bot.user), 
            text=       "Gallery Settings"
                    )

        await ctx.channel.send(embed=embed)
        return
Exemplo n.º 5
0
async def __gen_recep_embed(ctx, ch_id):
    embed = discord.Embed(
        title=":exclamation: Unauthorized use of bot commands. :exclamation: ",
        description=
        f"Please keep use of bot commands within <#{ch_id}>\nThank You.",
        type='rich',
        timestamp=datetime.datetime.utcnow(),
        color=RANDOM_DISCORD_COLOR())

    embed.set_footer(icon_url=GUILD_URL_AS(ctx.guild), text=ctx.guild.name)

    return embed
Exemplo n.º 6
0
    async def get_artist_info(cls, list_of_artists):
        #===== Connect to the database and get the info from the artist_info table
        credentials = {"user": dblogin.user, "password": dblogin.pwrd, "database": dblogin.name, "host": dblogin.host}
        database = await asyncpg.create_pool(**credentials)
        artists_info = await database.fetch(pgCmds.GET_ALL_ARTIST_INFO)
        await database.close()

        embeds = list() 

        #===== Make the embeds to return
        for row in artists_info:
            for artist in list_of_artists:
                if row["user_id"] == artist.id:

                    embed = discord.Embed(  description=artist.mention,
                                            colour=     RANDOM_DISCORD_COLOR(),
                                            timestamp=  datetime.datetime.utcnow(),
                                            type=       "rich"
                                        )

                    embed.set_thumbnail(    url=        AVATAR_URL_AS(user=artist)
                                        )

                    embed.set_author(       name=       "{0.name}#{0.discriminator}".format(artist),
                                            icon_url=   AVATAR_URL_AS(user=artist)
                                    )

                    embed.set_footer(       icon_url=   GUILD_URL_AS(artist.guild), 
                                            text=       "{}".format(artist.guild.name)
                                    )

                    embed.add_field(        name=       "Infomation",
                                            value=      row["info"]
                                    )

                    embeds.append(embed)
        
        #===== if no artists found
        if len(embeds) == 0:

            embed = discord.Embed(  title="No artists available.",
                                    description="Sorry",
                                    colour=     RANDOM_DISCORD_COLOR(),
                                    timestamp=  datetime.datetime.utcnow(),
                                    type=       "rich"
                                )

            embeds.append(embed)

        return embeds
Exemplo n.º 7
0
async def __gen_botowner_embed(ctx):
    embed = discord.Embed(title=':warning: You do not own me.',
                          description="",
                          type='rich',
                          timestamp=datetime.datetime.utcnow(),
                          color=RANDOM_DISCORD_COLOR())

    embed.set_footer(icon_url=GUILD_URL_AS(ctx.guild), text=ctx.guild.name)

    embed.add_field(
        name="Error:",
        value=f"```\nOnly the bot owner can run {ctx.invoked_with}\n```",
        inline=False)

    return embed
Exemplo n.º 8
0
async def __gen_nocore_embed(ctx):
    embed = discord.Embed(title=':wave: Welcome Newbie!',
                          description="",
                          type='rich',
                          timestamp=datetime.datetime.utcnow(),
                          color=RANDOM_DISCORD_COLOR())

    embed.set_footer(icon_url=GUILD_URL_AS(ctx.guild), text=ctx.guild.name)

    embed.add_field(
        name="You can not use this command yet.",
        value=f"You'll need to join the rest of our great guild first.",
        inline=False)

    return embed
Exemplo n.º 9
0
async def __gen_guildowner_embed(ctx):
    embed = discord.Embed(title=':warning: You do not own this guild',
                          description="",
                          type='rich',
                          timestamp=datetime.datetime.utcnow(),
                          color=RANDOM_DISCORD_COLOR())

    embed.set_footer(icon_url=GUILD_URL_AS(ctx.guild), text=ctx.guild.name)

    embed.add_field(
        name="Error:",
        value=
        f"```\nYou are not the owner of this guild, contact {ctx.guild.owner.name}#{ctx.guild.owner.discriminator} if a command needs to be preformed.\n```",
        inline=False)

    return embed
Exemplo n.º 10
0
    async def _report_edited_roles(ctx,
                                   nsfwRole,
                                   isRoleAdded,
                                   changedRoles,
                                   delete_after=15,
                                   Archive=True):
        '''Reports edited roles to the user and to staff.'''

        embed = discord.Embed(description=f"Mention: {ctx.author.mention}\n"
                              f"Has NSFW Role: {nsfwRole}\n",
                              type="rich",
                              timestamp=datetime.datetime.utcnow(),
                              colour=(0x51B5CC if isRoleAdded else 0xCC1234))
        embed.set_author(name="Roles updated",
                         icon_url=AVATAR_URL_AS(ctx.author))

        log = ""
        logPrefix = ("+" if isRoleAdded else "-")

        for i, changedRole in enumerate(changedRoles):
            if i == 0:
                log += f"{logPrefix}{changedRole}"
            else:
                log += f"\n{logPrefix}{changedRole}"

        embed.add_field(
            name=("Assigned Roles" if isRoleAdded else "Removed Roles"),
            value=log,
            inline=False)
        embed.set_footer(icon_url=GUILD_URL_AS(ctx.guild), text=ctx.guild.name)

        await ctx.channel.send(content=None,
                               embed=embed,
                               delete_after=delete_after)

        if Archive:
            ch = discord.utils.get(ctx.guild.channels,
                                   id=Artists.config.channels['bot_log'])

            await ch.send(content=None, embed=embed)

        return
Exemplo n.º 11
0
    async def handle_discord_invite(self, msg):
        cleanmsg = None
        cleanmsgparts = list()
        invite = str()

        for i in msg.content.split():
            if any(j in i for j in [
                    'watchanimeattheoffice.com/', 'discordapp.com/invite/',
                    'discord.gg/'
            ]):
                invite = i
                cleanmsgparts.append("**[CENSORED]**")

            else:
                cleanmsgparts.append(i)

        if len(cleanmsgparts) > 0:
            cleanmsg = " ".join(cleanmsgparts)
            cleanmsg = cleanmsg.replace("@everyone", "@\u200beveryone")
            cleanmsg = cleanmsg.replace("@here", "@\u200bhere")

        embed = discord.Embed(
            title=
            ':octagonal_sign: I\'m not allowed to share discord invites here :octagonal_sign:',
            description="",
            type='False',
            timestamp=datetime.datetime.utcnow(),
            color=RANDOM_DISCORD_COLOR())

        embed.set_footer(icon_url=GUILD_URL_AS(msg.guild), text=msg.guild.name)

        await self.bot.execute_webhook2(channel=msg.channel,
                                        content=cleanmsg,
                                        username=msg.author.display_name,
                                        avatar_url=AVATAR_URL_AS(msg.author,
                                                                 format='png'),
                                        embed=embed)

        await msg.delete()

        return
Exemplo n.º 12
0
    async def grp1_list(self, ctx):
        """[Administrator] List all self assignable roles."""

        self_roles = [
            role for role in ctx.guild.roles
            if role.id in self.cogset['selfroles']
        ]
        self_roles.reverse()

        desc = "\n".join((f"> {role.name}" for role in self_roles))
        desc += f"\nTotal number of self assignable roles: {len(self_roles)}."

        e = discord.Embed(title="List of Self Assignable Roles",
                          description=desc,
                          colour=RANDOM_DISCORD_COLOR(),
                          type="rich",
                          timestamp=datetime.datetime.utcnow())
        e.set_footer(icon_url=GUILD_URL_AS(ctx.guild), text=ctx.guild.name)

        await self.bot.send_msg(dest=ctx.channel, embed=e)
        return
Exemplo n.º 13
0
    async def cmd_shutdown(self, ctx):
        """
        [Disabled command]
        """

        embed = discord.Embed(description="Shutting Down 👋",
                              colour=0x6BB281,
                              timestamp=datetime.datetime.utcnow(),
                              type="rich")

        if ctx.guild:
            embed.set_footer(icon_url=GUILD_URL_AS(ctx.guild),
                             text=ctx.guild.name)
        else:
            embed.set_footer(icon_url=AVATAR_URL_AS(user=self.bot.user),
                             text=self.bot.user.name)

        embed.set_author(name="Owner Command",
                         icon_url=AVATAR_URL_AS(user=ctx.author))

        await self.bot.send_msg(ctx.channel, embed=embed)
        await self.bot.delete_msg(ctx.message)

        raise TerminateSignal
Exemplo n.º 14
0
    async def gen_self_roles_msg(self, guild):
        key = dict()
        rkey = dict()
        desc = 'Add a reaction to **toggle** your self assignable roles!\n\n'
        self_roles = [
            role for role in guild.roles if role.id in self.cogset['selfroles']
        ]
        self_roles.reverse()

        # ===== BUILD THE EMBED DESCRIPTION
        for i, role in enumerate(self_roles):
            desc = f'{desc}{self.emojiname[i]} - for {role.name}\n'
            key[self.emojistring[i]] = role.id
            rkey[role.id] = self.emojistring[i]

        # ===== BUILD THE EMBED
        e = discord.Embed(title="Give Yourself Some Roles",
                          description=desc,
                          colour=RANDOM_DISCORD_COLOR(),
                          type="rich",
                          timestamp=datetime.datetime.utcnow())
        e.set_footer(icon_url=GUILD_URL_AS(guild), text=guild.name)

        return (e, key, rkey, self_roles)
Exemplo n.º 15
0
    async def cmd_roleperms(self, ctx):
        """
        [All Staff] Gets all the perms for a role both default and channel overwrite. Does not accept member ID's or at-here mentions.

        Useage:
            [prefix]RolePerms <roleName/roleID/roleMention>
        """

        try:
            role = None
            rolep = ctx.message.content.split(" ")[1]
            guild_roles = sorted(ctx.guild.roles, key=lambda x: x.position)

            ###=== dealing with the @here mention
            if "here" in rolep.lower():
                pass

            ###=== dealing with the @everyone mention
            elif "everyone" in rolep.lower():
                role = ctx.guild.default_role

            ###=== IF ROLE PROVIDED IS AN ID OR A MENTION
            elif rolep.isdigit() or rolep.startswith("<@"):
                rolep = rolep.replace("<", "").replace("@", "").replace(
                    "!", "").replace(">", "")
                rolep = int(rolep)

                role = discord.utils.get(guild_roles, id=rolep)

            ###=== IF ROLE PROVIDED IS A NAME
            elif rolep in [role.name for role in guild_roles]:
                role = [role for role in guild_roles if role.name == rolep][0]

            ###==== IF PROVIDED INFORMATION IS INVALID OR ROLE NOT FOUND
            if role is None:
                raise ValueError

        except (IndexError, ValueError):
            await ctx.send_help('roleperms')
            return

        ###===== If role as Admin perms end function early
        if role.permissions.administrator:
            embed = discord.Embed(
                title="Administrator",
                description=
                "{} role has Admin permission and can do everything.".format(
                    role.name),
                colour=RANDOM_DISCORD_COLOR,
                type="rich",
                timestamp=datetime.datetime.utcnow())

            embed.set_author(name="{} Information".format(role.name),
                             icon_url=AVATAR_URL_AS(self.bot.user))

            embed.set_footer(icon_url=GUILD_URL_AS(ctx.guild),
                             text=ctx.guild.name)

            await ctx.channel.send(embed=embed)
            return

        ###===== Variable setup
        server_wide_perms = list()
        channel_specific_perms = list()
        embeds = list()

        ###===== server wide
        for i in range(31):
            if bool((role.permissions.value >> i) & 1):
                server_wide_perms.append(self.raw_perms[i].replace(
                    "_", " ").title())

        #===== channel
        """
            Getting the channel perms for the role sorted.
            The channels are sorted by position for readability of results. 
            Normally they are sorted by position anyway but sometimes they come back in a mess of an order.
            """
        for channel in sorted(ctx.guild.channels, key=lambda x: x.position):
            temp = list()
            channelPerms = channel.overwrites_for(role)

            for i in range(31):
                if not self.raw_perms[i] == "":
                    #Making sure voice channels are not checked for buggy text channel perms
                    if (channel.type == discord.ChannelType.voice) and (
                            self.raw_perms[i]
                            in ["read_messages", "send_messages"]):
                        continue

                    #Making sure text channels are not checked for voice channel perms
                    if (channel.type == discord.ChannelType.text) and (
                            self.raw_perms[i] in [
                                "speak", "connect", "mute_members",
                                "deafen_members", "move_members",
                                "use_voice_activation", "stream"
                            ]):
                        continue
                    """
                        Channel overwrite perms do not have a value unlike regular permissions.
                        So it's easier to feed the "_values.get()" function a perm you're looking for than to try and retrive a value you can use yourself.
                        Technically I could have looped through 27*2 if statements but this is cleaner. 
                        """
                    result = channelPerms._values.get(self.raw_perms[i])

                    if result == True:
                        temp.append(self.raw_perms[i].replace("_",
                                                              " ").title())

                    elif result == False:
                        temp.append(("Not {}".format(self.raw_perms[i].replace(
                            "_", " ").title())))

            #=== If at end of loop no perms where found, log nothing.
            if len(temp) > 0:
                channel_specific_perms.append(
                    dict(channelName=channel.name,
                         perms=temp,
                         channelType=channel.type.__str__()))

        #===== results, processing them into an actual reply
        #You can only have 25 fields in a discord embed. So I'm breaking up my list of possible fields into a 2d array.
        channel_specific_perms = await self.split_list(channel_specific_perms,
                                                       size=25)
        firstLoop = True

        for channelSpecificPerms in channel_specific_perms:

            #=== Set up the first embed
            if firstLoop:
                text = " | ".join(server_wide_perms)
                if text == "":
                    text = "None"

                embed = discord.Embed(title="Server Wide:",
                                      description="{}\n".format(text),
                                      colour=0x51B5CC,
                                      timestamp=datetime.datetime.utcnow(),
                                      type="rich")

                embed.set_author(name="{} Information".format(role.name),
                                 icon_url=AVATAR_URL_AS(self.bot.user))

            #=== Set up additional embeds
            else:
                embed = discord.Embed(description="",
                                      colour=0x51B5CC,
                                      timestamp=datetime.datetime.utcnow(),
                                      type="rich")

                embed.set_author(name="{} information continued".format(
                    role.name),
                                 icon_url=AVATAR_URL_AS(self.bot.user))

            for i in channelSpecificPerms:
                #= The category channel type does not have a name, instead it's called "4"
                embed.add_field(
                    name=i["channelName"] +
                    (":" if not i["channelType"] == "4" else " - Category:"),
                    value=" | ".join(i["perms"]),
                    inline=False)

            embed.set_footer(icon_url=GUILD_URL_AS(ctx.guild),
                             text=ctx.guild.name)

            embeds.append(embed)
            firstLoop = False

        #===== send each generated embed as it's own message
        for embed in embeds:
            await ctx.channel.send(embed=embed)

        return
Exemplo n.º 16
0
    async def cmd_userperms(self, ctx):
        """
        [All Staff] Gets all the perms for a role both default and channel overwrite. Obviously, member needs to be part of the guild for this to work.
        
        Useage:
            [prefix]UserPerms <userID/userMention>
        """

        try:

            user_id = ctx.message.content.split(" ")[1]
            member = ctx.guild.get_member_named(user_id)

            ###=== remove the user mention
            if user_id.isdigit() or user_id.startswith("<@"):
                user_id = user_id.replace("<", "").replace("@", "").replace(
                    "!", "").replace(">", "")
                user_id = int(user_id)

                member = ctx.guild.get_member(user_id)

            else:
                raise ValueError

        #if user == idiot
        except (IndexError, ValueError):
            await ctx.send_help('userperms', delete_after=15)

        #===== If user is owner; end function early
        if member == ctx.guild.owner:
            try:
                embed = await GenEmbed.getUserPermsOwner(member,
                                                         msg=ctx.message)

                await ctx.channel.send(embed=embed)
                return
            except Exception as e:
                print(e)
                return

        #===== If user has Admin perms; end function early
        isAdmin = False
        for role in member.roles:
            if role.permissions.administrator:
                isAdmin = True

        if isAdmin:
            embed = await GenEmbed.getUserPermsAdmin(member, msg=ctx.message)
            await ctx.channel.send(embed=embed)
            return

        #===== Variable setup
        server_wide_perms = list()
        channel_specific_perms = list()
        embeds = list()

        #===== server wide
        for role in member.roles:
            for i in range(31):
                if bool((role.permissions.value >> i) & 1):
                    server_wide_perms.append(self.raw_perms[i].replace(
                        "_", " ").title())

        #===== one entry for each item
        server_wide_perms = list(set(server_wide_perms))

        #===== channel
        """
            Getting the channel perms for the role sorted.
            The channels are sorted by position for readability of results. 
            Normally they are sorted by position anyway but sometimes they come back in a mess of an order.
            """
        for channel in sorted(ctx.guild.channels, key=lambda x: x.position):
            temp = list()
            cleanedTemp = list()

            for role in ([member] + member.roles):
                channelPerms = channel.overwrites_for(role)

                for i in range(31):
                    if not self.raw_perms[i] == "":
                        #Making sure voice channels are not checked for buggy text channel perms
                        if (channel.type == discord.ChannelType.voice) and (
                                self.raw_perms[i]
                                in ["read_messages", "send_messages"]):
                            continue

                        #Making sure text channels are not checked for voice channel perms
                        if (channel.type == discord.ChannelType.text) and (
                                self.raw_perms[i] in [
                                    "speak", "connect", "mute_members",
                                    "deafen_members", "move_members",
                                    "use_voice_activation", "stream"
                                ]):
                            continue

                        result = channelPerms._values.get(self.raw_perms[i])

                        if isinstance(role, discord.Member):
                            if result == True:
                                temp.append("**[User]** {}".format(
                                    self.raw_perms[i].replace("_",
                                                              " ").title()))

                            elif result == False:
                                temp.append("**[User]** Not {}".format(
                                    self.raw_perms[i].replace("_",
                                                              " ").title()))

                        else:
                            if result == True:
                                temp.append(self.raw_perms[i].replace(
                                    "_", " ").title())

                            elif result == False:
                                temp.append("Not {}".format(
                                    self.raw_perms[i].replace("_",
                                                              " ").title()))
            """
                Because discord will take a yes over a no when it comes to perms,
                we remove the Not {perm} is the perm is there as a yes
                """
            for item in temp:
                if item.startswith("Not"):
                    if not any([i for i in temp if i == item[4:]]):
                        cleanedTemp.append(item)

                else:
                    cleanedTemp.append(item)

            #=== If at end of loop no perms where found, log nothing.
            if len(cleanedTemp) > 0:
                channel_specific_perms.append(
                    dict(channelName=channel.name,
                         perms=cleanedTemp,
                         channelType=channel.type.__str__()))

        #===== results, processing them into an actual reply
        #You can only have 25 fields in a discord embed. So I'm breaking up my list of possible fields into a 2d array.
        channel_specific_perms = await self.split_list(channel_specific_perms,
                                                       size=24)
        firstLoop = True

        for channelSpecificPerms in channel_specific_perms:

            #=== Set up the first embed
            if firstLoop:
                text = " | ".join(server_wide_perms)
                if text == "":
                    text = "None"

                embed = discord.Embed(
                    title="Server Wide:",
                    description="{}\n"
                    "**Hierarchy: {}**".format(
                        text,
                        (len(ctx.guild.roles) - member.top_role.position)),
                    colour=RANDOM_DISCORD_COLOR(),
                    timestamp=datetime.datetime.utcnow(),
                    type="rich")

                embed.set_author(
                    name="{0.name}#{0.discriminator}".format(member),
                    icon_url=AVATAR_URL_AS(member))

                embed.add_field(name="Roles[{}]".format(len(member.roles) - 1),
                                value=(" ".join([
                                    role.mention for role in member.roles
                                    if not role.is_everyone
                                ])) if len(member.roles) > 1 else
                                ("Member has no roles."))

            #=== Set up additional embeds
            else:
                embed = discord.Embed(description="",
                                      colour=RANDOM_DISCORD_COLOR(),
                                      timestamp=datetime.datetime.utcnow(),
                                      type="rich")

                embed.set_author(
                    name="{0.name}#{0.discriminator} | Information Continued".
                    format(member.name),
                    icon_url=AVATAR_URL_AS(member))

            for i in channelSpecificPerms:
                #= The category channel type does not have a name, instead it's called "4"
                embed.add_field(
                    name=i["channelName"] +
                    (":" if not i["channelType"] == "4" else " - Category:"),
                    value=" | ".join(i["perms"]),
                    inline=False)

            #=== since these are always going to be the same
            embed.set_thumbnail(url=AVATAR_URL_AS(member))
            embed.set_footer(icon_url=GUILD_URL_AS(ctx.guild),
                             text=f"{ctx.guild.name} | ID: {member.id}")

            embeds.append(embed)
            firstLoop = False

        #===== send each generated embed as it's own message
        for embed in embeds:
            await ctx.channel.send(embed=embed)

        return
Exemplo n.º 17
0
    async def on_message_delete(self, msg):
        if not msg.guild or msg.author.bot or not self.cogset['enableDelMsgLog'] or not msg.type == discord.MessageType.default:
            return 

        if not self.report_ch:
            self.report_ch = msg.guild.get_channel(self.cogset['report_ch_id'])

        if msg.channel.id in self.cogset['lis_channels'] or msg.author.id in self.cogset['lis_members']:
            msg_attach = list()
            reason = ""

            embed = discord.Embed(  
                title=              "Message Deleted.",
                description=        "**Author:** <@{}>\n"
                                    "**Sent:** {}\n"
                                    "**Channel:** <#{}>".format(
                                        msg.author.id,
                                        msg.created_at,
                                        msg.channel.id
                                        ),
                colour=             RANDOM_DISCORD_COLOR(),
                timestamp=          datetime.datetime.utcnow(),
                type=               "rich"
                                    )

            embed.add_field (
                name=       "**Content**",
                value=      escape(msg.content, mass_mentions=True, formatting=True),
                inline=     False
                            )

            embed.set_author(
                name=       f"{msg.author.name}#{msg.author.discriminator}",
                icon_url=   AVATAR_URL_AS(msg.author),
                url=        AVATAR_URL_AS(msg.author)
                            )

            embed.set_footer(
                icon_url=   GUILD_URL_AS(msg.guild), 
                text=       msg.guild.name
                            )

            if self.cogset['save_attach'] and msg.attachments:

                for attach in msg.attachments:
                    try:
                        fb = await attach.read(use_cached=True)
                        filename = attach.filename

                        msg_attach.append(discord.File(BytesIO(fb), filename=filename, spoiler=False))
                    
                    except discord.errors.Forbidden:
                        msg_attach = None
                        reason = 'I do not have permissions to access this attachment.'
                        break

                    except discord.errors.NotFound:
                        msg_attach = None
                        reason = 'The attachment was deleted.'
                        break

                    except discord.errors.HTTPException:
                        msg_attach = None
                        reason = 'Downloading the attachment failed.'
                        break

                if msg_attach is None:
                    embed.add_field (
                        name=       "**Attachments Failed**",
                        value=      f"**Reason:** {reason}",
                        inline=     False
                                    )

            await self.report_ch.send(embed=embed, files=msg_attach)

        
        return
Exemplo n.º 18
0
    async def nuggethelp(self, ctx):
        """
        [Core] Prints a help message for the users

        Useage:
            [prefix]NuggetHelp/Help
        """

        embed = discord.Embed(
            title="Self Assignable Roles:",
            description="**SFW Roles:**\n"
            f"{ctx.prefix}NotifyMe:\tA role that we use to ping people about goings on.\n"
            f"{ctx.prefix}Book_Wyrm:\tUsed to access <#304365533619421184> text and voice channels.\n"
            f"{ctx.prefix}RP:\tUsed to access the SFW RP channels.\n"
            f"{ctx.prefix}Artist:\tArtists who are open to commissions. Plus gain write permissions in <#382167213521633280>\n"
            "\n"
            "**NSFW Roles (NSFW Role required):**\n"
            f"{ctx.prefix}RP_Lewd:\tUsed to access the NSFW RP channels.\n"
            "\n",
            type="rich",
            timestamp=datetime.datetime.utcnow(),
            colour=RANDOM_DISCORD_COLOR())

        embed.set_author(name="Nugget Help",
                         icon_url=AVATAR_URL_AS(self.bot.user))

        embed.add_field(
            name="NSFW Access",
            value=
            f"To get access to the NSFW channels just ping staff in <#{self.bot.config.channels['reception_id']}> with your age.",
            inline=False)

        embed.add_field(
            name="Private Feedback:",
            value=
            f"You can always DM me {self.bot.user.mention} with {self.bot.command_prefix}feedback followed by your feedback for the staff.\nFeedback can be submitted anonymously this way.",
            inline=False)

        embed.add_field(
            name="Fun Commands:",
            value=
            f"{ctx.prefix}RPS <rock/paper/scissors>:\tPlay rock paper scissors with me.\n"
            f"{ctx.prefix}8ball <question>:\tAsk your question and I shall consult the ball of knowledge.\n"
            f"{ctx.prefix}Roll <number>:\tRole a dice, you tell me how high I can go.\n"
            f"{ctx.prefix}Leaderboard:\tTop 10 most popular, I hope I'm on that list.\n",
            inline=False)

        #embed.add_field(
        #    name=   "Art and Commissions:",
        #    value=
        #            f"{ctx.prefix}Commissioner:\tAdds commissioner role, meant for people looking for commissions.\n"
        #            f"{ctx.prefix}FindArtists:\tDMs you info about any artist who have registered with us.\n"
        #            f"{ctx.prefix}OpenCommissions:\tAdds OpenCommissions role to artists, to show you have slots open.\n"
        #            f"{ctx.prefix}ArtistRegister <info>: For artists registering their info with us.\n"
        #            f"{ctx.prefix}PingCommissioners: Artists can ping people with the Commissioner role.\n"
        #            "[Note: expect more info on this subject soon]",
        #    inline= False
        #    )

        #embed.add_field(
        #    name=   "Need a break?:",
        #    value=  "If you want to hide the server from yourself for a while; "
        #            f"you can post {ctx.prefix}HideServer <xDxHxMxS/seconds> and "
        #            "I'll try hide the server from you for a bit. You can re-show the server anytime. \n"
        #            "If you're stressed, don't worry: https://www.youtube.com/watch?v=L3HQMbQAWRc,",
        #    inline= False
        #    )

        embed.set_footer(text=ctx.guild.name, icon_url=GUILD_URL_AS(ctx.guild))

        await ctx.channel.send(embed=embed, delete_after=90)
        return