def _init_embeds(self, ctx: SlashContext, guild_data: GuildData, content: dict): translated_commands = None guild_language = guild_data.configuration.language if guild_language not in ["en-US", "English"]: translated_commands = get_content("TRANSLATED_COMMANDS", guild_language) commands_data = self._get_commands_data() embeds = [self._get_main_menu(ctx, guild_data, content)] cog_translations = content["PLUGINS"] for cog_name, cog in self.bot.cogs.items(): if self._cog_check(guild_data, cog, commands_data): continue embed = Embed( title=f"{cog_translations[cog_name.upper()]} | Asteroid Bot", description="", timestamp=datetime.datetime.utcnow(), color=DiscordColors.EMBED_COLOR, ) embed.set_footer( text=content["REQUIRED_BY_TEXT"].format(user=ctx.author), icon_url=ctx.author.avatar_url, ) embed.set_thumbnail(url=ctx.bot.user.avatar_url) embed.custom_id = cog_name embed = self._fill_embed_page(embed, commands_data[cog], content, translated_commands) embeds.append(embed) return embeds
async def userinfo( self, ctx: HarleyContext, user: Optional[Union[discord.Member, discord.User]] = None, *, flags: WhoIsFlags, ): """ Returns user info, input can be a user not in the guild. If the user's name has a space, use quotes around their name. """ user = user or ctx.author embed = Embed( title=f"Information About {user}", description=( f"Created At: {user.created_at.strftime(TIME_TEMPLATE)}\n" f"Bot: {YES_NO[user.bot]} \n" f"ID: {user.id}"), ) if flags.avatar is not False: embed.set_thumbnail(url=user.avatar) if isinstance(user, discord.Member): embed.add_field( name="Guild Related Info:", value=(f"Joined At: {user.joined_at.strftime(TIME_TEMPLATE)}\n" f"Nickname: {user.nick or 'None'}\n" f"Top Role: {user.top_role.mention}"), ) await ctx.reply(embed=embed)
def _get_main_menu(self, ctx: SlashContext, guild_data: GuildData, content: dict) -> Embed: embed = Embed( title="Help | Asteroid Bot", timestamp=datetime.datetime.utcnow(), color=DiscordColors.EMBED_COLOR, ) embed.add_field( name=content["INFORMATION_TEXT"], value=content["INFORMATION_CONTENT_TEXT"], inline=False, ) embed.set_thumbnail(url=ctx.bot.user.avatar_url) embed.set_footer( text=content["REQUIRED_BY_TEXT"].format(user=ctx.author), icon_url=ctx.author.avatar_url, ) cog_translations = content["PLUGINS"] cogs = "".join( f"**» {cog_translations[cog_name.upper()]}**\n" for cog_name, cog in self.bot.cogs.items() if not self._cog_check(guild_data, cog) ) embed.add_field(name=content["PLUGINS_TEXT"], value=cogs) return embed
async def serverinfo(self, ctx: HarleyContext, *, flags: GuildInfoFlags): """ Returns info about the server. """ guild = ctx.guild embed = Embed( title=guild.name, description=(f"Owner: {guild.owner} \n" f"Member Count: {guild.member_count} \n" f"Region: {title_format(str(guild.region))} \n"), ).set_thumbnail(url=guild.icon) if flags.banner is True: embed.set_thumbnail(url=guild.banner) if flags.features is True: embed.add_field( name="Features", value="\n".join( [title_format(feature) for feature in guild.features]), ) await ctx.reply(embed=embed)