async def members(self, ctx: Context) -> None: """Get the number of members in the server.""" member_by_status = Counter(str(m.status) for m in ctx.guild.members) bots = len([member for member in ctx.guild.members if member.bot]) member_type = f""" Member: {ctx.guild.member_count - bots} Bots: {bots} """ status = f""" {STATUSES[Status.online]}: **{member_by_status["online"]}** {STATUSES[Status.idle]}: **{member_by_status["idle"]}** {STATUSES[Status.dnd]}: **{member_by_status["dnd"]}** {STATUSES[Status.offline]}: **{member_by_status["offline"]}** """ embed = Embed(title="Member count", description=ctx.guild.member_count, color=Color.dark_purple()) embed.add_field(name="**❯❯ Member Status**", value=status) embed.add_field(name="**❯❯ Member Type**", value=member_type) embed.set_author(name=f"SERVER : {ctx.guild.name}") embed.set_footer(text="Powered by HotWired") await ctx.send(embed=embed)
def send_webhook(): url = 'webhook' webhook = Webhook.from_url(url, adapter=RequestsWebhookAdapter()) embed = Embed(title='Yeezy 700 V3"Alvah"', url="https://twitter.com/orbitboteu", color=Color.from_rgb(67, 194, 122)) embed.set_thumbnail(url=product_url()) embed.add_field(name="Srore", value="Holypopstore")\ .add_field(name="profile", value="||test||")\ .add_field(name="size", value="9") embed.add_field(name="Payment Method", value="Paypal")\ .add_field(name="Account", value="||[email protected]||")\ .add_field(name="Timestamp", value="||2020-03-31 13:00:16PM(UTC)||", inline=False) embed.set_footer(text='Orbit', icon_url=avatar_url()) embed.set_author(name="Successfully checked out!") webhook.send(embed=embed, avatar_url=avatar_url(), username="******")
def webhook(): sys.stdout.flush() if request.headers.get('Authorization') == webhook_password: user_id = request.json.get('user') bot_id = request.json.get('bot') # ID of the bot that was upvoted request_type = request.json.get('type') weekend_status = request.json.get('isWeekend') now = datetime.datetime.utcnow() if discord_webhook != "": embed_title = "Test" if request_type == 'test' else 'New upvote!' embed = Embed( title=embed_title, description= f"**Upvoter: <@{user_id}>** ({user_id})\n**Upvoted bot:** <@{bot_id}> ({bot_id})", timestamp=datetime.datetime.utcnow(), color=Color.green()) webhook = Webhook.partial(webhook_id, webhook_token, adapter=RequestsWebhookAdapter()) webhook.send(embed=embed) return '', 200 else: abort(400)
async def stats(self, ctx: Context) -> None: """Show full bot stats.""" implementation = platform.python_implementation() general = textwrap.dedent(f""" • Servers: **{len(self.bot.guilds)}** • Commands: **{len(self.bot.commands)}** • members: **{len(set(self.bot.get_all_members()))}** • Uptime: **{uptime(datetime.datetime.now() - self.start_time)}** """) system = textwrap.dedent(f""" • Python: **{platform.python_version()} with {implementation}** • discord.py: **{discord_version}** """) embed = Embed(title="BOT STATISTICS", color=Color.red()) embed.add_field(name="**❯❯ General**", value=general, inline=True) embed.add_field(name="**❯❯ System**", value=system, inline=True) embed.set_author(name=f"{self.bot.user.name}'s Stats", icon_url=self.bot.user.avatar_url) embed.set_footer(text="Made by The-Codin-Hole Team.") await ctx.send(embed=embed)
async def calc(self, ctx: Context, *, equation: str) -> None: """Calculate an equation.""" res = await get_math_results(equation) if res.lower() == "invalid equation": emb = Embed( title="ERROR!", description= "❌ Invalid Equation Specified, Please Recheck the Equation", color=Color.red()) emb.set_footer(text=f"Invoked by {str(ctx.message.author)}") await ctx.send(embed=emb) else: embed = Embed(title="Equation Results") embed.add_field(name="**❯❯ Question**", value=equation, inline=False) embed.add_field(name="**❯❯ Result**", value=res, inline=False) embed.set_footer(text=f"Invoked by {str(ctx.message.author)}") await ctx.send(embed=embed)
async def watched_command(self, ctx: Context, from_cache: bool = True): """ Shows all users that are currently monitored and in which channel. By default, the users are returned from the cache. If this is not desired, `from_cache` can be given as a falsy value, e.g. e.g. 'no'. """ if not from_cache: updated = await self.update_watched_users() if not updated: await ctx.send( f":x: Failed to update cache: non-200 response from the API" ) return title = "Watched users (updated cache)" else: title = "Watched users (from cache)" lines = tuple(f"• <@{user_id}> in <#{self.watched_users[user_id].id}>" for user_id in self.watched_users) await LinePaginator.paginate(lines or ("There's nothing here yet.", ), ctx, Embed(title=title, color=Color.blue()), empty=False)
async def epic_(self, ctx: Context, max: int = 1) -> None: """ Get images from DISCOVR's Earth Polychromatic Imaging Camera. Can specify a maximum number of images to retrieve. """ async with self.bot.session.get( "https://epic.gsfc.nasa.gov/api/images.php" ) as response: json = await response.json() for i in range(min(max, len(json))): embed = Embed( ittle="EPIC image", description=json[i].get("caption"), colour=Color.blurple(), ) embed.set_image( url="https://epic.gsfc.nasa.gov/epic-archive/jpg/" + json[i]["image"] + ".jpg" ) await ctx.send(embed=embed)
async def add(self, ctx, modifier, *, value=None): i = ModifierCheck(modifier, self.modifiers) if i is False: raise commands.BadArgument(f"Unknown modifier `{modifier}`.") if value is None and modifier not in self.modifiers: raise commands.errors.MissingRequiredArgument( Parameter('value', Parameter.KEYWORD_ONLY)) if ModifierCheck(modifier, self.tournament.modifiers) is not False: raise commands.BadArgument( f"`{modifier}` has already been added to the tournament.") modifier = self.modifiers[i] fields = [] if isinstance(modifier, dict): # Value Settable Modifier modifier = modifier.copy() modifier['value'] = await ModifierUtils.convert_value( ctx, modifier['value'], value) fields.append({'name': "New Value", 'value': modifier['value']}) await ctx.send( f"{Emote.check} `{modifier['name']}` was set to **{value}**.") else: await ctx.send( f"{Emote.check} `{modifier}` is now active for this tournament." ) self.tournament.modifiers.append(modifier) if isinstance(modifier, dict): modifier = modifier['name'] Log("Modifier Added", description= f"{ctx.author.mention} added the modifier `{modifier}` to **{self.tournament.name}**.", color=Color.dark_teal(), fields=fields)
async def userinfo(self, ctx: Context, *, member: t.Optional[Member] = None) -> None: """ Get information about you, or a specified member. `member`: The member to get information from. Can be a Mention, Name or ID. """ if not member: member = ctx.author embed = Embed(colour=Color.gold()) embed.title = f"{member}'s stats and information." embed.add_field( name="__**General information:**__", value=textwrap.dedent(f""" **Discord Name:** {member} **Created at:** {datetime.datetime.strftime(member.created_at, "%A %d %B %Y at %H:%M")} """), inline=False, ) embed.add_field( name="__**Server-related information:**__", value=textwrap.dedent(f"""**Nickname:** {member.nick} **Joined server:** {datetime.datetime.strftime(member.joined_at, "%A %d %B %Y at %H:%M")} **Top role:** {member.top_role.mention} """), inline=False, ) embed.set_thumbnail(url=member.avatar_url_as(format="png")) embed.set_footer(text=f"ID: {member.id}") return await ctx.send(embed=embed)
async def on_message(self, message: discord.Message) -> None: """Relays the message's content and attachments to the dm_log channel.""" # Only relay DMs from humans if message.author.bot or message.guild or self.webhook is None: return if message.clean_content: await send_webhook( webhook=self.webhook, content=message.clean_content, username=f"{message.author.display_name} ({message.author.id})", avatar_url=message.author.avatar_url ) await self.dm_cache.set("last_user", message.author.id) self.bot.stats.incr("dm_relay.dm_received") # Handle any attachments if message.attachments: try: await send_attachments( message, self.webhook, username=f"{message.author.display_name} ({message.author.id})" ) except (discord.errors.Forbidden, discord.errors.NotFound): e = discord.Embed( description=":x: **This message contained an attachment, but it could not be retrieved**", color=Color.red() ) await send_webhook( webhook=self.webhook, embed=e, username=f"{message.author.display_name} ({message.author.id})", avatar_url=message.author.avatar_url ) except discord.HTTPException: log.exception("Failed to send an attachment to the webhook")
async def format_quote(self, rowid: int, quote: str, author_id: str, added: int) -> Embed: t = int(time.time()) - added author = await self.bot.get_user_info(author_id) years = t // (60 * 60 * 24 * 365) t -= years * (60 * 60 * 24 * 365) days = t // (60 * 60 * 24) t -= days * (60 * 60 * 24) hours = t // (60 * 60) t -= hours * (60 * 60) minutes = t // 60 time_string = "" if years: time_string += "{} years, ".format(years) if days: time_string += "{} days, ".format(days) if hours: time_string += "{} hours, ".format(hours) if minutes: if time_string: time_string += "and {} minutes ago.".format(minutes) else: time_string += "{} minutes ago.".format(minutes) if not time_string: time_string = '1 minute ago.' embed = Embed(description="```\n{}```".format(quote), title='Quote {}'.format(rowid), color=Color.blue()) embed.set_footer( text='By {}\nAdded {}'.format(author.name, time_string)) return embed
async def reddit_embed(subreddit: str, randompost: RedditAPI.submission) -> Embed: embed = Embed(colour=Color.green(), url=randompost.url) if len(randompost.title) > 0 and len(randompost.title) < 256: embed.title = randompost.title elif len(randompost.title) > 256: embed.title = f"{randompost.title[:200]}..." if len(randompost.selftext) > 0 and len(randompost.selftext) < 2048: embed.description = randompost.selftext elif len(randompost.selftext) > 2048: embed.description = f"{randompost.selftext[:2000]} Read more..." if not randompost.url.startswith( "https://v.redd.it/") or randompost.url.startswith( "https://youtube.com/"): embed.set_image(url=randompost.url) embed.set_footer( text= f"👍 {randompost.score} | 💬 {len(randompost.comments)} | Powered By HotWired" ) embed.set_author( name=f"u/{randompost.author}", icon_url=randompost.author.icon_img, url=f"https://www.reddit.com/user/{randompost.author}", ) embed.add_field( name="SubReddit", value=f"[r/{subreddit}](https://www.reddit.com/r/{subreddit}/)", inline=False, ) return embed
async def start(self, ctx) -> bool: question = await self.generate_question(ctx) alpha = list("ABCD") embed = ctx.bot.Embed( ctx, title=f"{self.topic} Trivia", description=f"**{question['question']}**" + "\n" + "\n".join([ f"{alpha[i]}. **{question['options'][i]}**" for i in range(4) ])) response = await embed.send() message = Message(state=embed.ctx._state, channel=ctx.channel, data=response) del embed, response wait = ctx.bot.WaitForMessage( ctx, timeout=25.5, check=(lambda x: x.channel == ctx.channel and x.author == ctx. author and len(x.content) == 1 and (x.content.upper() in alpha))) resp = await wait.get_message() if not resp: return del wait if alpha.index(resp.content.upper()) == question["options"].index( question["answer"]): await message.edit(embed=Embed( title="Congratulations! You are correct!", color=Color.green()) ) return True await message.edit(embed=Embed( title= f"Sorry, the correct answer is {alpha[question['options'].index(question['answer'])]}. {question['answer']}" ))
async def del_alias(self, ctx, *, name: str.lower): """Removes a alias from bot config.""" if 'aliases' not in self.bot.config.cache: self.bot.config['aliases'] = {} if self.bot.config.aliases.get(name): del self.bot.config['aliases'][name] await self.bot.config.update() embed = Embed( title='Removed alias', color=self.bot.main_color, description=f'`{name}` no longer exists.' ) else: embed = Embed( title='Error', color=Color.red(), description=f'Alias `{name}` does not exist.' ) return await ctx.send(embed=embed)
async def list_users(ctx: CommandContext, *, role: Role): author: Member = ctx.author roles: List[Role] = author.roles role_ids: Set[int] = set([role.id for role in roles]) admin: bool = len(role_ids.intersection(config.admin_roles)) if not admin and not check_is_mentor(author, role): return await ctx.send( embed=Embed( title='Missing permissions', color=Color.red(), description='You are neither an admin nor a mentor for this role.')) paginator = Paginator(prefix='', suffix='') for user in get_members_with_role(role): paginator.add_line(f'{user} - {user.mention}') for page in paginator.pages: await ctx.send( embed=Embed( title=f'Users with the role @{role.name}', description=page)) if len(paginator.pages) == 0: await ctx.send( embed=Embed( title=f'Users with the role @{role.name}', description='No users found.'))
def standings_embed_div(self, division, div_name): this_embed = Embed(color=Color.purple(), title=f"{self.name} Season {self.season}") standings = {} for team_name, wins, losses, run_diff in league_db.get_standings( self.name): standings[team_name] = { "wins": wins, "losses": losses, "run_diff": run_diff } teams = self.division_standings(division, standings) for index in range(0, len(teams)): if index == self.constraints["division_leaders"] - 1: teams[index][4] = "-" else: games_behind = ( (teams[self.constraints["division_leaders"] - 1][1] - teams[index][1]) + (teams[index][2] - teams[self.constraints["division_leaders"] - 1][2])) / 2 teams[index][4] = games_behind teams_string = "" for this_team in teams: if this_team[2] != 0 or this_team[1] != 0: teams_string += f"**{this_team[0].name}\n**{this_team[1]} - {this_team[2]} WR: {round(this_team[1]/(this_team[1]+this_team[2]), 3)} GB: {this_team[4]}\n\n" else: teams_string += f"**{this_team[0].name}\n**{this_team[1]} - {this_team[2]} WR: - GB: {this_team[4]}\n\n" this_embed.add_field(name=f"{div_name} Division:", value=teams_string, inline=False) this_embed.set_footer( text=f"Standings as of day {self.day-1} / {self.season_length()}") return this_embed
async def stats(self, ctx, *, user: discord.Member = None): if not user: user = ctx.message.author if user.bot: await self.bot.send_with_mention( ctx, "If it looks like a duck, quacks like a duck, it's a duck!" ) return duck_user = await self.get_duck_user(user.id, ctx.guild.id) if not duck_user: await self.bot.send_with_mention( ctx, "That user has not partcipated in the duck hunt" ) return embed = discord.Embed(title="Duck Stats", description=user.mention) embed.color = embed_colors.green() embed.add_field(name="Friends", value=duck_user.befriend_count) embed.add_field(name="Kills", value=duck_user.kill_count) embed.set_thumbnail(url=self.DUCK_PIC_URL) await self.bot.send_with_mention(ctx, embed=embed)
async def command_stats(self, ctx: Context) -> None: rows = await CommandStats.get_stats(self.bot.database) embed = Embed( title="Usage stats", colour=Color.blue(), ) embed.set_author( name=ctx.author.display_name, icon_url=str(ctx.author.avatar_url), ) records = sorted( rows, key=lambda elem: elem["usage_count"], reverse=True, )[:10] for record in records: embed.add_field( name=f"• {record['command']}", value=f"Usage count: {record['usage_count']}", inline=False, ) await ctx.send(embed=embed)
async def add_perms_level(self, ctx, level: str, *, user_or_role: Union[User, Role, str]): """Add a user, role, or everyone permission to use commands of a permission level.""" if level.upper() not in PermissionLevel.__members__: embed = Embed( title='Error', color=Color.red(), description='The permission level you are attempting to point ' f'to does not exist: `{level}`.') return await ctx.send(embed=embed) if hasattr(user_or_role, 'id'): value = user_or_role.id elif user_or_role in {'everyone', 'all'}: value = -1 else: raise commands.UserInputError('Invalid user or role.') await self.bot.update_perms(PermissionLevel[level.upper()], value) embed = Embed( title='Success', color=self.bot.main_color, description=f'Permission for {level} was successfully updated.') return await ctx.send(embed=embed)
async def add_perms_command(self, ctx, command: str, *, user_or_role: Union[User, Role, str]): """Add a user, role, or everyone permission to use a command.""" if command not in self.bot.all_commands: embed = Embed( title='Error', color=Color.red(), description='The command you are attempting to point ' f'to does not exist: `{command}`.') return await ctx.send(embed=embed) if hasattr(user_or_role, 'id'): value = user_or_role.id elif user_or_role in {'everyone', 'all'}: value = -1 else: raise commands.UserInputError('Invalid user or role.') await self.bot.update_perms(self.bot.all_commands[command].name, value) embed = Embed( title='Success', color=self.bot.main_color, description=f'Permission for {command} was successfully updated.') return await ctx.send(embed=embed)
async def mars(self, ctx: Context, date: str, rover: str = None, number: int = 1) -> None: """Get images from Mars. must specify the date (in the form YYYY-MM-DD),and you can specify the rover and the number of images to retrieve.""" if rover is None: rover = random.choice(["curiosity", "opportunity", "spirit"]) if not rover.lower() in ("curiosity", "opportunity", "spirit"): await ctx.send("Sorry but this rover doesn't exist") return async with self.bot.session.get( "https://api.nasa.gov/mars-photos/api/v1/rovers/" + rover.lower() + "/photos", params={ "earth_date": date, "api_key": NASA_API }) as response: images = await response.json() if images.get("photos", []) == []: await ctx.send( f"Couldn't Find anything! Invalid Rover : {rover.capitalize()}" ) return for i in range(min(number, len(images["photos"]))): embed = Embed(title="Picture from " + rover.capitalize(), description="Picture taken from the " + images["photos"][i]["camera"]["full_name"], colour=Color.blurple()) embed.set_image(url=images["photos"][i]["img_src"]) embed.set_footer(text="Picture taken on" + images["photos"][i]["earth_date"]) await ctx.send(embed=embed)
async def info(self, ctx: Context, filament_name: clean_content): filament = (db_session.query(FilamentType).filter( FilamentType.name.like(filament_name)).first()) if not filament: await ctx.send( f'Couldn\'t find a filament that matches the name "{filament_name}"' ) return # Construct the embed embed_colour = Color.from_rgb(61, 83, 255) embed_title = f'Filament info for "{filament_name}"' host = CONFIG.FIG_HOST_URL + "/filaments" image_file = filament.image_path.split("/")[-1] embed = Embed(title=embed_title, color=embed_colour) embed.add_field(name="Cost per kilogram", value="{0:.2f}".format(filament.cost)) embed.set_image(url=f"{host}/{image_file}") display_name = get_name_string(ctx.message) await ctx.send(f"Here you go, {display_name}! :page_facing_up:", embed=embed)
async def send_group_help(self, group: commands.Group) -> None: embed = Embed( title=f"Help for command: `{group.name}`", description=f"Let me show you what the command {group.qualified_name} is all about!", color=Color.blue(), ) embed.add_field( name="What does this command do?", value=group.help, inline=False ) embed.add_field( name="Usage", value=f"`{self.get_command_signature(group)}`", inline=False ) subcommand_help = [ f"**`{self.get_command_signature(command)}`**\n{command.help}" for command in group.commands if await command.can_run(self.context) ] newline = "\n" embed.add_field( name="Related commands", value=f"\n{newline.join(subcommand_help)}", inline=False, ) await self.dispatch_help(embed)
async def eval(self, ctx, *, code: str = None): def insert_returns(body): if isinstance(body[-1], Expr): body[-1] = Return(body[-1].value) fix_missing_locations(body[-1]) if isinstance(body[-1], If): insert_returns(body[-1].body) insert_returns(body[-1].orelse) if isinstance(body[-1], With): insert_returns(body[-1].body) if not code: await ctx.send(embed = Embed(title = '코드를 입력해주세요', color = Color.red())) return func_content = '\n'.join(f' {line}' for line in code.strip('```').lstrip('py').strip('\n').splitlines()) code = f'async def _eval_exp():\n{func_content}' parsed = parse(code) insert_returns(parsed.body[0].body) try: env = { 'bot': self.bot, 'ctx': ctx, 'discord': discord } exec(compile(parsed, filename = '<ast>', mode = 'exec'), env) res = await eval('_eval_exp()', env) except Exception as e: await ctx.send(embed = Embed(title = '처리중 오류가 생겼습니다', description = f'```py\n{repr(e)}\n```', color = Color.red())) return await ctx.send(embed = Embed(title = 'EVAL 결과', description = f'```py\n{res}\n```', color = Color.green()))
async def list_watched_users(self, ctx: Context, update_cache: bool = True) -> None: """ Gives an overview of the watched user list for this channel. The optional kwarg `update_cache` specifies whether the cache should be refreshed by polling the API. """ if update_cache: if not await self.fetch_user_cache(): await ctx.send(f":x: Failed to update {self.__class__.__name__} user cache, serving from cache") update_cache = False lines = [] for user_id, user_data in self.watched_users.items(): inserted_at = user_data['inserted_at'] time_delta = self._get_time_delta(inserted_at) lines.append(f"• <@{user_id}> (added {time_delta})") lines = lines or ("There's nothing here yet.",) embed = Embed( title=f"{self.__class__.__name__} watched users ({'updated' if update_cache else 'cached'})", color=Color.blue() ) await LinePaginator.paginate(lines, ctx, embed, empty=False)
async def thank_stats( self, ctx: commands.Context, *, member: Optional[Member] = None ): """View stats for thanks you've received and sent, in the current server and globally""" member = member or ctx.author sent_thanks = await ThankModel.filter(thanker__id=member.id).count() recv_thanks = await ThankModel.filter(thanked__id=member.id).count() server_sent_thanks = await ThankModel.filter( thanker__id=member.id, guild__id=ctx.guild.id ).count() server_recv_thanks = await ThankModel.filter( thanked__id=member.id, guild__id=ctx.guild.id ).count() embed = Embed(title=f"Thank stats for: {member}", color=Color.green()) embed.add_field( name="Thanks received", value="Global: {}\nThis server: {}".format(recv_thanks, server_recv_thanks), ) embed.add_field( name="Thanks sent", value="Global: {}\nThis server: {}".format(sent_thanks, server_sent_thanks), ) await ctx.send(embed=embed)
async def weapon(self, ctx): embed = Embed( title="{:50}".format("The Blackrock Slicer"), url="https://classic.wowhead.com/item=13285/the-blackrock-slicer") embed.set_author( name="Wowhead", url="http://classic.wowhead.com", icon_url="https://wow.zamimg.com/images/logos/favicon-standard.png" ) embed.set_thumbnail( url= "https://wow.zamimg.com/images/wow/icons/large/inv_weapon_halberd_11.jpg" ) embed.colour = Color.blue() embed.add_field(name="Item Level 58", value="Binds when picked up", inline=False) embed.add_field(name="{:60}".format("Two-Hand"), value="{:60}".format("159 - 239 Damage"), inline=True) embed.add_field(name="{:^10}".format("Axe"), value="{:>10}".format("Speed 4.00"), inline=True) embed.add_field(name="(49.75 damage per second)", value="Durability 100/100", inline=False) embed.add_field( name="Requires Level 53", value= "[Chance on hit: Wounds the target for 50 to 150 damage and deals an additional 6 damage every 1 sec for 25 sec.](https://classic.wowhead.com/spell=17407)", inline=False) embed.add_field( name="Sell Price: 5g 49s 24c", value="Dropped by: Spirestone Battle Lord \n Drop Chance: 38.14%", inline=False) await ctx.send(content=None, embed=embed)
async def relay_message(self, message: Message) -> None: """Relays the message's content and attachments to the duck pond channel.""" clean_content = message.clean_content if clean_content: await self.send_webhook(content=message.clean_content, username=message.author.display_name, avatar_url=message.author.avatar_url) if message.attachments: try: await send_attachments(message, self.webhook) except (errors.Forbidden, errors.NotFound): e = Embed( description= ":x: **This message contained an attachment, but it could not be retrieved**", color=Color.red()) await self.send_webhook(embed=e, username=message.author.display_name, avatar_url=message.author.avatar_url) except discord.HTTPException: log.exception("Failed to send an attachment to the webhook") await message.add_reaction("✅")
async def pretty_print(ctx, fields, caption="", title="", color=Color(0xFFFFFF)): """ A method for printing to the Discord channel with a custom embed. Parameters __________ ctx (discord.Context) – The invocation context where the call was made fields (list or string) - Either a comma separated list of fields or a single string Each field is organized by [Title, Value, Inline] as specified in Discord documentation caption (string) - A message to append to the bottom of the embed, useful for printing mentions and such title (string) - Title listed at the top of the embed color (string) - A Hexadecimal code representing the color strip on the left side of the Embed """ if not ctx: return embed = Embed(title = title, color= color) if type(fields) == list: for field in fields: if len(field) < 3: field.append(True) name, value, inline = field embed.add_field(name = name, value = value, inline = inline) elif type(fields) == str: embed.add_field(name = "-------------", value=fields) if caption: await ctx.send(content = caption, embed = embed ) else: await ctx.send(embed = embed)
async def send_bot_help(self, mapping): ctx = self.context embed = Embed( ctx, title="Commands", description=self.get_opening_note(), color=Color.blue(), ) for cog, commands in mapping.items(): if not cog: # Don't show commands without a cog (e.g. the help command) continue category_name = cog.qualified_name filtered_commands = await self.filter_commands(commands) embed.add_field( name=category_name, value=", ".join(i.name for i in filtered_commands), inline=False, ) await ctx.send(embed=embed)