async def tag_list(self, ctx): """Lists all available tags.""" db_tags = ctx.session.query(models.Tag.tag) \ .filter_by(guild_id=ctx.guild.id) \ .order_by(models.Tag.tag) \ .all() await ctx.send( format.code_list(tag for tag, in db_tags) or "No tags have been set! Use `~tag set` to make some.")
def make_whois_embed(ctx, user): now = datetime.utcnow() description = [] guild_count = _get_guild_count(ctx, user) if guild_count > 1: count = format.bold(str(guild_count)) description.append(f'Seen on {count} servers.') usernames = _get_extra_usernames(ctx, user) if len(usernames) > 0: output = reversed([_to_username_line(un) for un in usernames]) description.append(format.multiline_code(format.vertical_list(output))) description = None if len(description) <= 0 else '\n'.join(description) embed = discord.Embed( title=f'{user.name}#{user.discriminator} ({user.id})', color=user.color, description=description) embed.set_thumbnail(url=str(user.avatar_url or user.default_avatar_url)) embed.set_footer(text=hex(user.id)) _add_time_field(embed, 'Created At', user.created_at, now) try: _add_time_field(embed, 'Joined On', user.joined_at, now) except AttributeError: pass try: if user.premium_since is not None: _add_time_field(embed, 'Boosting Since', user.premium_since, now) except AttributeError: pass try: if len(user.roles) > 1: roles = reversed([r for r in user.roles if r.name != '@everyone']) roles = format.code_list(r.name for r in roles) embed.add_field(name='Roles', value=roles) except AttributeError: pass return embed
async def serverinfo(self, ctx): """Displays detailed information about the server.""" guild = ctx.guild owner = guild.owner msg_embed = discord.Embed(title=f'{guild.name} ({guild.id})', description=guild.description) msg_embed.set_thumbnail(url=guild.icon_url) msg_embed.add_field(name='Owner', value=f'{owner.name}#{owner.discriminator}') msg_embed.add_field(name='Members', value=str(guild.member_count)) embed._add_time_field(msg_embed, 'Created On', guild.created_at, datetime.utcnow()) msg_embed.add_field(name='Region', value=str(guild.region)) if guild.premium_subscription_count: value = (f'{guild.premium_subscription_count} ' f'(Tier {guild.premium_tier})') msg_embed.add_field(name='Boosters', value=value) if guild.features: msg_embed.add_field(name='Features', value=format.code_list(guild.features)) await ctx.send(embed=msg_embed)
async def role_list(self, ctx): """Lists all of the roles on the server.""" await ctx.send(format.code_list(r.name for r in ctx.guild.roles))