async def get_guild_profile_embed(guild: Guild, brief: bool = True): literal = literals('get_guild_profile_embed') online_members = (await guild.widget()).members description = literal['description'] % (guild.region, guild.member_count) if guild.premium_tier: description += '\n' + literal['tier'] % guild.premium_tier if online_members: description += '\n' + (literal['online'] % len(online_members)) guild_embed = ChainedEmbed(title=guild.name, description=description) guild_embed.set_author(name=literal['author'] % guild.owner.name, icon_url=guild.owner.avatar_url) guild_embed.set_thumbnail(url=guild.icon_url) if not brief: if guild.premium_subscription_count: guild_embed.add_field( name=literal['boost'] % guild.premium_subscription_count, value='\n'.join( str(subscriber) for subscriber in guild.premium_subscribers)) guild_embed.set_footer(text=f'{to_kst(guild.created_at)} · {guild.id}') guild_embed.set_image(url=guild.banner_url) if guild.channels: value = literal['category'] % len(guild.categories) value += '\n' + literal['text_channel'] % len(guild.text_channels) value += '\n' + literal['voice_channel'] % len( guild.voice_channels) guild_embed.add_field(name=literal['channel'] % len(guild.channels), value=value) return guild_embed
async def king(self, ctx: Context, player1: Member, player2: Member, player3: Member, *players: Member): players = list(players) players.extend((player1, player2, player3)) tasks = list() king = None i = 0 count_description = literals('king')['count'] % (len(players) - 1) footer = literals('king')['footer'] while len(players): player1 = players.pop(randrange(0, len(players))) if i == 0: king = player1 else: embed = ChainedEmbed(title=literals('king')['number'] % i, description=count_description) embed.set_footer(text=footer) tasks.append(player1.send(embed=embed)) i = i + 1 embed = ChainedEmbed(title=literals('king')['king'] % king.display_name, description=count_description) embed.set_image(url=king.avatar_url) embed.set_footer(text=footer) tasks.append( ctx.send(' '.join( [member.mention for member in ctx.message.mentions]), embed=embed)) tasks.append(ctx.message.delete()) await asyncio.wait(tasks)
def get_profile_embed(user: User, brief: bool = True): literal = literals('get_profile_embed') profile_embed = ChainedEmbed(title=user.display_name, color=user.colour, description=str(user)) profile_embed.set_thumbnail(url=user.avatar_url) if isinstance(user, Member): profile_embed.set_author(name=user.guild.name + ' ' + user.top_role.name, icon_url=user.guild.icon_url) if not brief: profile_embed.set_image(url=user.avatar_url) profile_embed.set_footer(text=f'{to_kst(user.created_at)} · {user.id}') if isinstance(user, Member): profile_embed.add_field(name=literal['join'], value=to_kst(user.joined_at)) if user.premium_since: profile_embed.add_field(name=literal['boost'], value=to_kst(user.premium_since)) if roles := user.roles[1:]: roles.reverse() profile_embed.add_field(name=literal['roles'], value='\n'.join( [role.name for role in roles]))
def get_custom_emoji_embed(self, emoji_id: int): emoji: PartialEmoji = self.client.get_emoji(emoji_id) embed = ChainedEmbed() embed.set_image(url=emoji.url) embed.set_author(name=f':{emoji.name}:') return embed