async def kinsy(self, ctx): """ Returns the Kinsy Video """ await ctx.trigger_typing() embed = Embed(title="JUST JUMP IN!!") embed.set_thumbnail( url= "https://images.evetech.net/characters/1630472146/portrait?size=128" ) embed.colour = Color.blue() embed.description = "Just Jump In And WARP TO ME!!" url = get_site_url() embed.add_field( name="The Link", value= "https://cdn.discordapp.com/attachments/685827175626440735/949349523774398565/My_Movie.mp4" .format(url, url), inline=False) return await ctx.send(embed=embed)
async def get_pokedex(ctx, author, pkmn_id): color = _get_tier_color(int(pkmn_id)) embed = Embed(color=color, description="**{}**'s Pokedex".format(author)) if database.is_caught(author, pkmn_id): pkmn = database.get_pokemon(pkmn_id) pkmn_id = pkmn["national_id"] pkmn_name = pkmn["name"] pkmn_name_stripped = pkmn_name.lower().split("-")[0] types = _get_types_string(pkmn["types"]) # description = database.get_random_description(pkmn["descriptions"]) description = "None" embed.add_field(name='Name', value="{} [{}]".format(pkmn_name, pkmn_id)) embed.add_field(name="Types", value=types, inline=True) embed.add_field(name='Description', value=description, inline=False) embed.add_field(name='Hp', value=pkmn["hp"], inline=True) embed.add_field(name='Attack', value=pkmn["attack"], inline=True) embed.add_field(name='Defense', value=pkmn["defense"], inline=True) embed.add_field(name='Speed', value=pkmn["speed"], inline=True) embed.set_image(url="http://www.pkparaiso.com/imagenes/xy/sprites/animados/{}.gif".format(pkmn_name_stripped)) embed.set_thumbnail(url="http://marktan.us/pokemon/img/icons/{}.png".format(pkmn_id)) return await ctx.send(embed=embed) else: return await ctx.send("Oak: You can't see what you don't have.")
async def catch(ctx): message = ctx.message pkmn = database.get_random_pokemon() pkmn_id = pkmn["national_id"] pkmn_name = pkmn["name"] pkmn_name_stripped = pkmn_name.lower().split("-")[0] color = _get_tier_color(pkmn_id) type_str = _get_types_string(pkmn["types"]) # random generator if shiny shiny_chance = randint(1,100) if shiny_chance < 2: shiny = True description = "**{}** You have caught :star2:**{}**".format(message.author, pkmn_name) else: shiny = False description = "**{}** You have caught **{}**".format(message.author, pkmn_name) embed = Embed(color=color, description=description) if shiny: embed.set_image(url="http://www.pkparaiso.com/imagenes/xy/sprites/animados-shiny/{}.gif".format(pkmn_name_stripped)) else: embed.set_image(url="http://www.pkparaiso.com/imagenes/xy/sprites/animados/{}.gif".format(pkmn_name_stripped)) embed.add_field(name='Name', value="{}[{}]".format(pkmn_name, pkmn_id)) embed.add_field(name="Types", value=type_str) embed.set_thumbnail(url="http://marktan.us/pokemon/img/icons/{}.png".format(pkmn_id)) # add the pokemon to the user db database.add_pokemon(message.author, pkmn, shiny=shiny) await ctx.send(embed=embed)
async def _handle_watched_players(self, player_xids: list[int]): """Notify moderators about watched players.""" assert self.interaction.guild mod_role: Optional[discord.Role] = None for role in self.interaction.guild.roles: if role.name.startswith(self.settings.MOD_PREFIX): mod_role = role break if not mod_role: return watch_notes = await self.services.games.watch_notes(player_xids) if not watch_notes: return data = await self.services.games.to_dict() embed = Embed() embed.set_thumbnail(url=self.settings.ICO_URL) embed.set_author(name="Watched user(s) joined a game") embed.color = self.settings.EMBED_COLOR description = ( f"[⇤ Jump to the game post]({data['jump_link']})\n" f"[➤ Spectate the game on SpellTable]({data['spectate_link']})\n\n" f"**Users:**") for user_xid, note in watch_notes.items(): description += f"\n• <@{user_xid}>: {note}" embed.description = description for member in mod_role.members: await safe_send_user(member, embed=embed)
async def _build_setup_embed(self) -> Embed: guild = await self.services.guilds.to_dict() embed = Embed(title=f"SpellBot Setup for {guild['name']}") embed.set_thumbnail(url=self.settings.ICO_URL) description = ( "These are the current settings for SpellBot on this server." " Please use the buttons below, as well as the `/set` commands," " to setup SpellBot as you wish.\n\n" "You may also view Awards configuration using the `/awards` command" " and Channels configuration using the `/channels` command." ) embed.description = description[:EMBED_DESCRIPTION_SIZE_LIMIT] embed.add_field( name="MOTD", value=guild["motd"] or "None", inline=False, ) embed.add_field( name="Public Links", value=humanize_bool(guild["show_links"]), ) embed.add_field( name="Show Points on Games", value=humanize_bool(guild["show_points"]), ) embed.add_field( name="Create Voice Channels", value=humanize_bool(guild["voice_create"]), ) embed.color = discord.Color(self.settings.EMBED_COLOR) return embed
async def auth(self, ctx): """ Returns a link to the AllianceAuth Install Used by many other Bots and is a common command that users will attempt to run. """ await ctx.trigger_typing() embed = Embed(title="AllianceAuth") embed.set_thumbnail( url= "https://assets.gitlab-static.net/uploads/-/system/project/avatar/6840712/Alliance_auth.png?width=128" ) embed.colour = Color.blue() embed.description = "All Authentication functions for this Discord server are handled through our Alliance Auth install" regex = r"^(.+)\/d.+" matches = re.finditer(regex, settings.DISCORD_CALLBACK_URL, re.MULTILINE) for m in matches: url = m.groups() embed.add_field(name="Auth Link", value="[{}]({})".format(url[0], url[0]), inline=False) return await ctx.send(embed=embed)
async def embed(self, ctx, title=None, description=None, url=None, fields=None, color=None, thumbnail=None, image=None, footer=defaultFooter, showTimeStamp=True, send=True): if type(title) is dict: e = Embed.from_dict(title) if send: return await ctx.send(embed=e) return e if not color: color = colors[random.choice(list(colors.keys()))] e = Embed(title=title, description=description, url=url, color=color) if type(fields) is list: for field in fields: inline = True if "inline" in list(field.keys()): inline = field['inline'] del field['inline'] for name, value in field.items(): e.add_field(name=name, value=value, inline=inline) if showTimeStamp: e.timestamp = datetime.datetime.now() if thumbnail: e.set_thumbnail(url=thumbnail) else: e.set_thumbnail(url=self.bot.user.avatar_url) if image: e.set_image(url=image) if footer: icon = self.bot.user.avatar_url text = footer["text"].replace( "//author//", f"{ctx.author.name}#{ctx.author.discriminator}") if footer['icon']: if "//author.avatar//" in footer['icon']: if ctx.author.avatar_url: icon = ctx.author.avatar_url e.set_footer(text=text, icon_url=icon) if send: return await ctx.send(embed=e) return e
async def _reply_found_embed(self): embed = Embed() embed.set_thumbnail(url=self.settings.ICO_URL) embed.set_author(name="I found a game for you!") game_data = await self.services.games.to_dict() link = game_data["jump_link"] embed.description = f"You can [jump to the game post]({link}) to see it!" embed.color = self.settings.EMBED_COLOR await safe_followup_channel(self.interaction, embed=embed)
def playing_message(self) -> Dict[str, Embed]: em = Embed( colour=self._embed_colour, description=f'[{self._title}]({self._url})' ) em.set_author(name=self._uploader, url=self._uploader_url) em.set_thumbnail(url=self._thumbnail) return {'embed': em}
async def award_delete(self, guild_award_id: int) -> None: await self.services.guilds.award_delete(guild_award_id) embed = Embed() embed.set_thumbnail(url=self.settings.ICO_URL) embed.set_author(name="Award deleted!") description = "You can view all awards with the `/set awards` command." embed.description = description embed.color = self.settings.EMBED_COLOR await safe_send_channel(self.interaction, embed=embed, ephemeral=True)
async def ban(self, ctx, member: Member, *reason: str): await member.ban(reason=reason) emb = Embed(title=f'~~Cagatse~~', description=f'{member.mention} ha sido baneado por {ctx.author.mention}', color=0xFFC500) emb.set_thumbnail(url=member.avatar_url) emb.add_field(name='Motivo', value=reason) emb.add_field(name='Fecha de emision', value=ctx.message.created_at, inline=True) emb.set_footer(text=f'Flangsbot | Developed by Flangrys#7673') await ctx.send(embed=emb)
def getCharEmbed(char: Character, title="", description="", color=MISCORANGE) -> Embed: """ Initializes an Embed based on the given Character. Defaults to making the title the .string() of the Character, making the description empty, and making the color orange. """ embed = Embed(title=char.string() if not title else title, description=description, color=color) url = char.getPicture() if url: embed.set_thumbnail(url=url) return embed
async def battle(ctx): message = ctx.message author = message.author wild_pkmn = database.get_random_pokemon(type="battle") wild_pkmn_id = wild_pkmn["national_id"] wild_pkmn["health"] = wild_pkmn["hp"] wild_pkmn_name = wild_pkmn["name"] wild_pkmn_name_stripped = wild_pkmn_name.lower().split("-")[0] tier = _get_tier(int(wild_pkmn_id)) prize_money = _get_money_earned(tier) party = database.get_party(author) fainted = [] winner = None fought_pkmn = [] for my_pkmn in party: if my_pkmn["health"] <= 0: last_pkmn = my_pkmn continue wild_pkmn["health"] = _fight_wild(author, my_pkmn, wild_pkmn) fought_pkmn.append(my_pkmn) last_pkmn = my_pkmn if wild_pkmn["health"] <= 0: winner = my_pkmn last_pkmn = my_pkmn break else: fainted.append(my_pkmn["name"]) if len(fought_pkmn) == 0: return await ctx.send("Oak: Are you trying to fight the pokemon with your fist? Add some pokemon to your party first.") color = _get_tier_color(wild_pkmn_id) embed = Embed(color=color, description="**{}** you encountered **{}**".format(message.author, wild_pkmn_name_stripped)) embed.set_thumbnail(url="http://marktan.us/pokemon/img/icons/{}.png".format(last_pkmn["national_id"])) # embed.add_field(name="Fainted Pokemon", value=", ".join(fainted)) embed.set_image( url="http://www.pkparaiso.com/imagenes/xy/sprites/animados/{}.gif".format(wild_pkmn_name.lower())) if winner is None: # do losing message here embed.add_field(name="Oak", value="Your party pokemon was wiped out. Get rekt m8") # deduct money database.add_pokedollars(author, prize_money * -1) else: # do winning embed here winner_name = winner["name"] health_remaining = int((winner["health"]/winner["hp"]) * 100) text1 = "has {}% health remaining after the fight".format(health_remaining) embed.add_field(name="{} won the fight!".format(winner_name), value=text1, inline=False) embed.add_field(name="Pokedollars Earned", value="₱{}".format(prize_money)) # add prize money database.add_pokedollars(author, prize_money) return await ctx.send(embed=embed)
async def lastGame(ctx): """ Fetches latest game stats """ if os.path.exists(f'{ctx.author.id}'): with open(f'{ctx.author.id}', 'r') as f: user_dict = json.load(f) steamid = user_dict.get('steamid', False) else: await ctx.send( 'No steamid configured, did you run `!dota steamid <steam32ID>` ?') return if steamid is False: await ctx.send( 'No steamid configured, did you run `!dota steamid <steam32ID>` ?') return r = requests.get( f'https://api.opendota.com/api/players/{steamid}/recentMatches') if r.status_code != 200: e_msg = "Either I hit the rate limit or your steamid wasn't correct." e_msg = f"{e_msg}\nSteamid should be steam32 account id" await ctx.send(e_msg) return try: data = json.loads(r.text)[0] except: e_msg = "malformed or empty response!" await ctx.send(e_msg) return embed = Embed(title="Last Match", url=f"https://www.dotabuff.com/matches/{data['match_id']}", color=0xffd200) embed.set_thumbnail( url= "https://www.dotabuff.com/assets/dotabuff-opengraph-b17d3bd0ba45b284eb2760acaaf394433560a220fcea9391a5eaa487be5823e1.png" ) embed.add_field(name='duration', value=f"{data['duration']//60}m {data['duration']%60}s") for field, key in [ ('hero damage', 'hero_damage'), ('hero healing', 'hero_healing'), ('tower damage', 'tower_damage'), ('last hits', 'last_hits'), ('gpm', 'gold_per_min'), ('xpm', 'xp_per_min'), ]: embed.add_field(name=field, value=data[key]) embed.add_field( name='k/d/a', value=f"{data['kills']}/{data['deaths']}/{data['assists']}") await ctx.send(f"https://www.dotabuff.com/matches/{data['match_id']}", embed=embed)
async def get_trainer_info(ctx, author): total_caught = database.get_total_caught(author) total_caught = "{}/718".format(total_caught) pokedollars = "₱{}".format(database.get_pokedollars(author)) embed = Embed(color=0xB80800) embed.set_author(name="{}'s Trainer Profile".format(author), icon_url="https://vignette3.wikia.nocookie.net/pkmnshuffle/images/b/b1/Pikachu_%28Winking%29.png/revision/latest?cb=20170410234514") embed.add_field(name='Pokedex Entries', value=total_caught) embed.add_field(name='Money', value=pokedollars) embed.set_thumbnail(url="http://rs1240.pbsrc.com/albums/gg495/iKyle10/Pokemon%20Trainer/avatar514181_1_zpsfxp46su9.gif~c200") embed.set_image(url="https://archives.bulbagarden.net/media/upload/a/a0/Spr_B2W2_Hilbert.png") return await ctx.send(embed=embed)
async def stat(ctx, member: discord.Member = None): if member is None: member = ctx.message.author emb = Embed( title=f'Статистика пользователя {member.name}', description=member.mention, color=discord.Color.gold() ) emb.set_thumbnail(url=member.avatar_url) emb.add_field(name='ID пользователя', value=member.id, inline=True) emb.add_field(name='Топ роль', value=member.top_role.mention, inline=True) emb.add_field(name='На сервере с', value=member.joined_at.strftime('%d.%m.%Y'), inline=False) emb.add_field(name='Опыт:', value=xp.get(member.id), inline=True) # TODO: emb.add_field(name='Рейтинг:', value=get_rating(member.id), inline=True) emb.set_footer(icon_url=ctx.author.avatar_url, text=f'Поинтересовался {ctx.author.name}') await ctx.send(embed=emb)
def create_track_embed(song, title="Track Details"): artists = "" for artist in song['album']['artists']: artists += f"{artist['name']}\n" embed = Embed(title=title, url=song['external_urls']['spotify'], color=Color.green()) embed.set_thumbnail(url=song['album']['images'][1]['url']) embed.add_field(name="Track name:", value=song['name']) embed.add_field(name="Artist:", value=artists) embed.add_field(name="Track Uri:", value=song['uri']) return embed
async def award_add( self, count: int, role: str, message: str, **options: Optional[bool], ) -> None: repeating = bool(options.get("repeating", False)) remove = bool(options.get("remove", False)) max_message_len = GuildAward.message.property.columns[0].type.length # type: ignore if len(message) > max_message_len: await safe_send_channel( self.interaction, f"Your message can't be longer than {max_message_len} characters.", ephemeral=True, ) return if count < 1: await safe_send_channel( self.interaction, "You can't create an award for zero games played.", ephemeral=True, ) return if await self.services.guilds.has_award_with_count(count): await safe_send_channel( self.interaction, "There's already an award for players who reach that many games.", ephemeral=True, ) return await self.services.guilds.award_add( count, role, message, repeating=repeating, remove=remove, ) embed = Embed() embed.set_thumbnail(url=self.settings.ICO_URL) embed.set_author(name="Award added!") every_or_after = "every" if repeating else "after" give_or_take = "take" if remove else "give" description = ( f"• _{every_or_after} {count} games_ — {give_or_take} `@{role}`" f" — {message}\n\nYou can view all awards with the `/set awards` command." ) embed.description = description embed.color = self.settings.EMBED_COLOR await safe_send_channel(self.interaction, embed=embed, ephemeral=True)
async def profile(self, ctx, usr: discord.Member): """ Gets a Member's profile. """ from WineRecords import WineRecords try: wine = WineRecords[str(usr.id)] except KeyError: wine = 0 joined_at = usr.joined_at.strftime('%B-%d-%Y|%I:%M%p') profile = Embed(title=f"{usr.name}'s Profile", color=usr.color) profile.set_thumbnail( url=usr.avatar_url_as(static_format='png', size=256)) profile.add_field(name='Role:', value=f"{usr.top_role}") profile.add_field(name="Joined at:", value=f"{joined_at}", inline=True) profile.add_field(name='Glasses of Wine given:', value=f'{wine}') await ctx.send(embed=profile)
async def objet_fact(self, ctx, object: str): URL = "https://some-random-api.ml/meme" async with request("GET", URL, headers={}) as responses: if responses.status == 200: data = await responses.json() embed=Embed(title="💡 Facts ", url="https://some-random-api.ml", color=0x228acf) embed.set_thumbnail(url=data["image"]) embed.add_field(name="***Respuesta***", value=f'{data["caption"]}', inline=True) embed.set_footer(text="Nobody!") await ctx.send(embed=embed) else: await ctx.send("API returned a {responses.status} status.")
def playing_message(self) -> Dict[str, Union[Embed, File]]: self._cover.seek(0) em = Embed( colour=Colour.dark_green(), title=self._title, description=f'{self._album} - ({self._date})' ) em.set_author(name=self._artist) em.set_thumbnail(url='attachment://cover.jpg') return { 'embed': em, 'file': File(self._cover, 'cover.jpg') }
async def _current_user(self, ctx): user = self.sp.current_user() msg = Embed(title=f"Currently logged in Spotify user", description=f"Display name:\t{user['display_name']}\n" f"Followers:\t\t{user['followers']['total']}\n" f"Spotify Uri:\t{user['uri']}", color=Color.green(), url=user['external_urls']['spotify']) try: msg.set_thumbnail(url=user['images'][0]['url']) except IndexError: pass await ctx.send(embed=msg)
async def get_help_embed(command, msg_content, author): raw_args = await utils.get_args(command, msg_content) args = raw_args['args'] num_args = len(args) embed = Embed() embed.colour = author.colour if num_args not in (1, 2) and not raw_args['help']: usage = HelpManager.get_help(command._aliases[0])['usage'].replace('{prefix}', conf['prefix']) embed.add_field(name="Usage:", value=usage, inline=False) return embed elif raw_args['help']: name = msg_content.split()[0][1:] lang = 'en' else: name = args[0] lang = args[1] if num_args == 2 else 'en' entry = HelpManager.get_help(name, lang=lang) if not entry: if name in CommandRegistrar.instance().command_table.keys(): embed.title = f":octagonal_sign: There is no '{lang}' translation for '{name}'. :octagonal_sign:" else: embed.title = ":octagonal_sign: That doesnt seem to be a valid command. :octagonal_sign:" print("C**t...") return embed usage = entry['usage'].replace('{prefix}', conf['prefix']) description = entry['description'] command_table = CommandRegistrar.instance().commands command = command_table[name] embed.title = f"**{name}**" embed.description = f"aliases: {', '.join(command.aliases)}" embed.set_thumbnail(url='https://i.imgur.com/MXkFjJj.png') embed.add_field(name="Usage:", value=usage, inline=False) embed.add_field(name="Description:", value=description, inline=False) embed.set_thumbnail(url='https://i.imgur.com/MXkFjJj.png') embed.set_footer(text=f"Requested by {author.name}#{author.discriminator}", icon_url=author.avatar_url) return embed
def ping_embed(package, message, paginate): 'Formats and generates the embed for the ping' embed = Embed() currentmsg = paginate.pages_yielded totalmsgs = currentmsg + paginate.pages_left if currentmsg == 1: embed.title = package['sender'] embed.set_author(name=package['description']) embed.description = message embed.set_thumbnail(url=package['logo_url']) if totalmsgs > 1: embed.set_footer( text='Message {}/{}'.format(currentmsg, totalmsgs)) embed.timestamp = datetime.utcnow() embed.colour = package['embed_colour'] return embed
async def ord(ctx, *, query: str = ''): response = get_ord_post(query).json()['response'] if len(response['items']) == 0: await ctx.send(':dizzy_face: Не могу найти такой пост') return content = response['items'][0]['text'] emb = Embed(title=f'**"{content}"**') if len(content) < 256 else Embed(description=f'**"{content}"**') footer = '© ' + response['groups'][0]['name'] + ', ' + datetime.utcfromtimestamp(response['items'][0]['date']).strftime('%Y') emb.set_footer(text=footer) try: if response['items'][0]['attachments'][0]['type'] == 'photo': image = response['items'][0]['attachments'][0]['photo']['sizes'][-1]['url'] emb.set_image(url=image) except: pass thumbnail = response['groups'][0]['photo_200'] emb.set_thumbnail(url=thumbnail) emb.color = discord.Color.from_rgb(255, 100, 100) await ctx.send(embed=emb)
async def about(self, ctx): """ All about the bot """ await ctx.trigger_typing() embed = Embed(title="AuthBot: The Authening") embed.set_thumbnail( url= "https://cdn.discordapp.com/icons/713666554629455892/a4c362c2037b239f2c3ef4aeeda9375a.png?size=128" ) embed.colour = Color.blue() embed.description = "This is a multi-de-functional discord bot tailored specifically for miller cunts." regex = r"^(.+)\/d.+" matches = re.finditer(regex, settings.DISCORD_CALLBACK_URL, re.MULTILINE) for m in matches: url = m.groups() embed.set_footer( text="Lovingly developed for V0LTA.™ by Miller Thwots") embed.add_field(name="Number of Servers:", value=len(self.bot.guilds), inline=True) embed.add_field(name="Unwilling Monitorees:", value=len(self.bot.users), inline=True) embed.add_field(name="Auth Link", value="[{}]({})".format(url[0], url[0]), inline=False) embed.add_field(name="Version", value="{}@{}".format(__version__, __branch__), inline=False) # embed.add_field( # name="Creator", value="<@318309023478972417>", inline=False # ) return await ctx.send(embed=embed)
async def about(self, ctx): """ All about the bot """ await ctx.trigger_typing() embed = Embed(title="AuthBot: The Authening") embed.set_thumbnail( url= "https://cdn.discordapp.com/icons/516758158748811264/ae3991584b0f800b181c936cfc707880.webp?size=128" ) embed.colour = Color.blue() embed.description = "This is a multi-de-functional discord bot tailored specifically for Alliance Auth Shenanigans." regex = r"^(.+)\/d.+" matches = re.finditer(regex, settings.DISCORD_CALLBACK_URL, re.MULTILINE) for m in matches: url = m.groups() embed.set_footer( text="Lovingly developed for Init.™ by AaronRin and ArielKable") embed.add_field(name="Number of Servers:", value=len(self.bot.guilds), inline=True) embed.add_field(name="Unwilling Monitorees:", value=len(self.bot.users), inline=True) embed.add_field(name="Auth Link", value="[{}]({})".format(url[0], url[0]), inline=False) embed.add_field(name="Version", value="{}@{}".format(__version__, __branch__), inline=False) # embed.add_field( # name="Creator", value="<@318309023478972417>", inline=False # ) return await ctx.send(embed=embed)
def embed(self, title: str, desc: str, body: Mapping[str, Any] = {}, colour: int = None, **kwargs) -> Embed: out = Embed(title=title, description=desc, colour=colour or self.me.color) for key, val in body.items(): if isinstance(val, tuple): out.add_field(name=key, value=val[0], inline=val[1]) else: out.add_field(name=key, value=val) out.set_thumbnail(url=kwargs.get('thumbnail', Embed.Empty)) out.set_image(url=kwargs.get('image', Embed.Empty)) return out
async def auth_slash(self, ctx): """ Returns a link to the AllianceAuth Install Used by many other Bots and is a common command that users will attempt to run. """ embed = Embed(title="AllianceAuth") embed.set_thumbnail( url= "https://assets.gitlab-static.net/uploads/-/system/project/avatar/6840712/Alliance_auth.png?width=128" ) embed.colour = Color.blue() embed.description = "All Authentication functions for this Discord server are handled through our Alliance Auth install" url = get_site_url() embed.add_field(name="Auth Link", value="[{}]({})".format(url, url), inline=False) return await ctx.respond(embed=embed)
def to_embed(self, flat: bool = False) -> Embed: embed = Embed(title=self.name or '', url=self.url or Embed.Empty) embed.set_author(name=self.author or '', url=self.author_url or Embed.Empty) embed.set_thumbnail(url=self.thumbnail or Embed.Empty) cards_by_type = self._get_cards_by_type() if logging.vlog_is_on(1): logging.vlog(1, 'Cards by type are: %s', pprint.pformat(cards_by_type)) for type_ in [ 'Land', 'Creature', 'Sorcery', 'Instant', 'Artifact', 'Enchantment', 'Plainswalker', 'Unknown' ]: cards_body = '\n'.join( f'{num} {card.name}' + (f' {card.cost}' if flat else '') for card, num in cards_by_type.get(type_, [])) if not cards_body: continue cards_body = manamojidb.substitute(cards_body) embed.add_field(name=type_, value=cards_body, inline=not flat) return embed