Exemplo n.º 1
0
    async def whois(self, ctx, mention_or_id=None):
        """ Get a given user's info. """
        is_in_server = True
        member = ctx.author
        if mention_or_id:
            member = await get_user(self.client, ctx, mention_or_id)
            if not member:
                return await ctx.send(f"❌ User `{mention_or_id}` not found.")

            is_in_server = member.id in [user.id for user in ctx.guild.members]

        creation = to_dt(member.id)
        date = datetime.now() - creation

        embed = discord.Embed(
            title = str(member),
            description = f"Information on {member.name}.",
            colour = random_color()
        )

        embed.add_field(name="Account created", value=creation.strftime("%d/%m/%Y, at %H:%M:%S"), inline=False)
        embed.add_field(name="Account age", value=f"approximately {date.days} days old.", inline=False)
        embed.add_field(name="In server", value=is_in_server)
        embed.add_field(name="Bot", value=member.bot)

        embed.set_image(url=member.avatar_url)
        embed.set_footer(text=f"UID : {member.id}")

        await ctx.send(embed=embed)
Exemplo n.º 2
0
 def mouseDoubleClickEvent(self,e):
     if self.node: 
         item = self.scene().n2i[self.node]
         if item.highlighted: 
             self.scene().view.unhighlight_node(self.node, reset=True)
         else:
             self.scene().view.highlight_node(self.node, fullRegion=True, 
                                              bg=random_color(l=0.5, s=0.5), permanent=True)
Exemplo n.º 3
0
 def mouseDoubleClickEvent(self,e):
     if self.node: 
         item = self.scene().n2i[self.node]
         if item.highlighted: 
             self.scene().view.unhighlight_node(self.node, reset=True)
         else:
             self.scene().view.highlight_node(self.node, fullRegion=True, 
                                              bg=random_color(l=0.5, s=0.5), permanent=True)
Exemplo n.º 4
0
    async def ping(self, ctx):
        """ Get bot latency. """
        embed = discord.Embed(
            title = 'Pong!',
            description = f"Latency is {round(self.client.latency * 2000, 3)}ms.",
            colour = random_color()
        )

        await ctx.send(embed=embed)
Exemplo n.º 5
0
    async def remove_member_embed(self, ctx, member, reason):
        n_or_no_n = 'n' if ctx.command.name == 'ban' else ''

        embed = discord.Embed(
            title=f"{member.name} was {ctx.command}{n_or_no_n}ed for:",
            description=f"{'No reason given.' * (not bool(reason))}{reason}",
            colour=random_color())

        embed.set_author(name=f"{member}", icon_url=member.avatar_url)

        embed.set_footer(text=f"UID : {member.id}")

        await ctx.send(embed=embed)
Exemplo n.º 6
0
    async def level(self, ctx, user: discord.Member = None):
        """ Check a user's level and xp. """
        user = user or ctx.author

        embed = discord.Embed(title=f"{user.name}", colour=random_color())

        user_level = self.get_user(user)

        embed.add_field(name='level', value=str(user_level[0]), inline=True)
        embed.add_field(name='xp', value=str(user_level[1]), inline=True)
        embed.set_footer(text=f"{user} | {user.id}")

        await ctx.send(embed=embed)
Exemplo n.º 7
0
    async def update_setting_command(self, ctx, setting: str, updated_setting):
        """ Update a given level configuration setting. """
        original_setting = self.config[setting]
        self.update_config(setting, updated_setting)
        embed = discord.Embed(title="Level configuration update",
                              description=f"Altered setting: {setting}",
                              colour=random_color())

        embed.add_field(name="Original",
                        value=str(original_setting),
                        inline=True)
        embed.add_field(name="Updated",
                        value=str(updated_setting),
                        inline=True)
        await ctx.send(embed=embed)
Exemplo n.º 8
0
    async def avatar(self, ctx, mention_or_id=None):
        member = ctx.author
        if mention_or_id:
            member = await get_user(self.client, ctx, mention_or_id)
            if not member:
                return await ctx.send(f"❌ User `{mention_or_id}` not found.")

        embed = discord.Embed(
            title = f"Avatar for {member}",
            colour = random_color()
        )

        embed.set_image(url=member.avatar_url)

        await ctx.send(embed=embed)
Exemplo n.º 9
0
    async def info(self, ctx):
        """ See bot info. """
        with open('description.txt', 'r') as file:
            description = file.read()
        replacements = {
            "{bot_name}" : self.client.user.name,
            "{bot_guilds_count}" : str(len(self.client.guilds))
        }
        for item in replacements.items():
            description = description.replace(item[0], item[1])

        embed = discord.Embed(
            title = f"{self.client.user.name} info.",
            description = description,
            colour = random_color()
        )

        embed.set_footer(text=f"Prefix{'es' * (len(self.client.command_prefix) - 1)}: {', '.join([p.strip() for p in self.client.command_prefix])}")
        await ctx.send(embed=embed)
Exemplo n.º 10
0
    async def show_level_settings(self, ctx):
        """ View current level configuration settings. """
        embed = discord.Embed(
            title="Level configuration settings",
            description="Various level settings for chat and upvote stats.\n"
            f"Update individual settings by using `{self.client.command_prefix[0]}set "
            "{setting}`.",
            colour=random_color())

        embed.add_field(name='chat_timer',
                        value=self.config["chat_timer"],
                        inline=False)
        embed.add_field(name='chat_points',
                        value=self.config["chat_points"],
                        inline=False)
        embed.add_field(name='upvote_points',
                        value=self.config["upvote_points"],
                        inline=False)
        embed.add_field(name='difficulty',
                        value=self.config["difficulty"],
                        inline=False)

        await ctx.send(embed=embed)
Exemplo n.º 11
0
    async def make_embed(self,
                         ctx,
                         title,
                         description,
                         footer,
                         *,
                         fields=None):
        """ Create an embed with specified values. """
        description = bool(description) * description

        embed = discord.Embed(title=title,
                              description=description,
                              colour=random_color())

        if fields:
            fields = fields.split(' |')
            for field in fields:
                name, value = field.split(" : ")
                embed.add_field(name=name, value=value, inline=True)

        if footer != "0":
            embed.set_footer(text=footer)

        await ctx.send(embed=embed)