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 shiny(ctx, *raw_args): message = ctx.message.content print(f'\nSHINY command triggered, bzzzzrt! Message details:\n{ctx.message.author} @ ({ctx.message.created_at}): {message}\n') output = MessageHelper() pos_args = [('pokemon','pokemon')] args = parse_arguments(raw_args, pos_args) if 'err' in args and len(args['err']) > 0: for error in args['err']: print(f'Error: {error}', file=output) await output.send(ctx) return pokemon = args['pos']['pokemon'].lower().replace(' ','') shiny_info = PokeDex(pokemongo).do_get_shiny_image_function(pokemon, output) species = 'Missingno' shiny_link = 'https://www.serebii.net/pokearth/sprites/rb/000.png' if shiny_info is not None: species = shiny_info[0] shiny_link = shiny_info[1] embed = Embed() embed.description = f'Image for {species} sourced from [Serebii.net](https://www.serebii.net/)!' embed.set_image(url=shiny_link) await output.send(ctx, 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 on_commons_division(self, division: CommonsDivision, bill: Bill): channel = self._guild.get_channel( int(self.config.get_channel_id("commons_divisions")) ) if channel is None: return division_file = await self.generate_division_image(self.parliament, division) embed = Embed( color=discord.Colour.from_rgb(84, 174, 51), timestamp=datetime.now() ) did_pass = division.get_aye_count() > division.get_no_count() embed.title = f"**{division.get_division_title()}**" next_line = "\n" description = ( f"**Division Result:** {'Passed' if did_pass else 'Not passed'} by a division of" f" {division.get_aye_count() if did_pass else division.get_no_count()} {'Ayes' if did_pass else 'Noes'}" f" to {division.get_no_count() if did_pass else division.get_aye_count()} " f"{'Noes' if did_pass else 'Ayes'}{next_line}**Division Date:** " f"{division.get_division_date().strftime('%Y-%m-%d %H:%M:%S')}" ) if bill is not None: description += ( f"{next_line}**Bill Summary [(Link)](https://bills.parliament.uk/" f"bills/{bill.get_bill_id()})**: {bill.get_long_title()}" ) embed.description = description embed.set_image(url="attachment://divisionimage.png") self.tracker_status["commonsdivisions"]["confirmed"] = True await channel.send( file=division_file, embed=embed, )
async def pokecenter(ctx, *args): """ Heals your whole party pokemon for ₱150 """ author = ctx.message.author database.add_pokedollars(author, -150) database.heal_party(author) embed = Embed( color=0xB80800, description="**{}** Welcome to the Pokemon Center!".format(author)) embed.set_author( name="Nurse Joy", icon_url= "https://i.pinimg.com/originals/ed/47/7c/ed477c99f4776886de48d5789f25776d.jpg" ) embed.add_field(name="Your Pokemon are healed!", value="Thanks for coming in. Please Come again ;)", inline=False) embed.set_footer( text= "Nurse Joy charged you ₱150 for her services. She ain't messin with no broke broke." ) embed.set_image( url= "https://cdn.bulbagarden.net/upload/thumb/9/9f/Nurse_Joy_anime_SM.png/250px-Nurse_Joy_anime_SM.png" ) return await pokemaster_bot.say(embed=embed)
async def random_cat(self, ctx: commands.Context): """Sends a random cat. Meow!""" filename = requests.get('http://aws.random.cat/meow').json()['file'] embed = Embed(description='Meow!', colour=Colour(randint(0x000000, 0xFFFFFF))) embed.set_image(url=filename) 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 yagoo_group(self, ctx: commands.Context, text: str = "早安你好"): imagePath = YagooUtil.renderText(text) embedMsg = Embed() embedMsg.set_image(url='attachment://' + YagooUtil.getTempFileName()) image = File(imagePath, filename=YagooUtil.getTempFileName()) await ctx.message.delete() await ctx.send(file=image)
async def random_dog(self, ctx: commands.Context): """Sends a random dog. Woof!""" filename = requests.get( 'https://random.dog/woof.json?filter=mp4,webm').json()['url'] embed = Embed(description='Woof!', colour=Colour(randint(0x000000, 0xFFFFFF))) embed.set_image(url=filename) await ctx.send(embed=embed)
async def send_message(self, message): try: if int(message.conversation.id) > 0: chat = self.client.get_user(message.conversation.id) else: chat = self.client.get_channel(positive(message.conversation.id)) await chat.trigger_typing() if message.type == 'text': content = self.add_discord_mentions(chat, message.content) if message.extra: if 'format' in message.extra and message.extra['format'] == 'HTML': content = html_to_discord_markdown(content) if 'preview' in message.extra and not message.extra['preview']: content = re.sub(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', r'<\g<0>>', content, flags=re.MULTILINE) if len(content) > 2000: texts = split_large_message(content, 2000) for text in texts: await chat.send(text) else: await chat.send(content) elif message.type == 'photo' or message.type == 'document' or message.type == 'video' or message.type == 'voice': send_content = True embed = Embed() if message.extra and 'caption' in message.extra and message.extra['caption']: lines = message.extra['caption'].split('\n') embed.title = lines[0] embed.description = '\n'.join(lines[1:]) send_content = False if send_content: if message.content.startswith('/'): await chat.send(file=discord.File(message.content, filename=message.type + get_extension(message.content))) else: await chat.send(message.content) else: if message.content.startswith('/'): await chat.send(file=discord.File(message.content, filename=message.type + get_extension(message.content)), embed=embed) elif message.content.startswith('http'): if message.type == 'photo': embed.set_image(url=message.content) elif message.type == 'video': embed.set_video(url=message.content) else: embed.url = message.content await chat.send(embed=embed) except KeyboardInterrupt: pass except Exception as e: logging.error(e) if self.bot.started: catch_exception(e, self.bot)
def create_embed(self, msg: str, state: Aria) -> Embed: image = "neutral" if state.mood < 0: image = "strict" embed = Embed(title="ARIA", description=msg, color=discord.Color.from_rgb(255, 0, 0)) embed.add_field(name="Mistress Mood", value=str(state.mood)) embed.set_image(url=IMAGES[image]) return embed
async def get(ctx: Context, id_: str): with sm as s: url = s.get_location(id_) if url is None: url = "" id_ = "***Error No Such Map ***" em = Embed(title="Here is your map![click for link]", description="map id: " + id_, url=url) em.set_image(url=url) await ctx.send(embed=em)
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 hug(self, ctx, person): if '@' in person: #random pick from an list of hug gifs-need more urls e = Embed() e.set_image(url=choice(self.hug_url)) #send await ctx.message.channel.send( f'{ctx.message.author.display_name} sent {person} a hug', embed=e) else: await ctx.message.channel.send( 'Sorry you need to mention someone Owo')
async def command_maps(ctx, translations, offset=0): current_time = int(time.mktime(time.localtime())) data = getJSON("https://splatoon2.ink/data/schedules.json") trfWar = data['regular'] ranked = data['gachi'] league = data['league'] theString = '' if offset == 0: theString = "Current Splatoon 2 Maps" elif offset == 1: theString = "Upcoming Splatoon 2 Maps" match_name = translations['game_modes']['regular']['name'] theString = theString + "```{}:\n".format(match_name) mapA = trfWar[offset]['stage_a'] mapA_name = get_stage_name(mapA['id'], translations) mapA_url = get_full_splatoon2_url(mapA['image']) mapB = trfWar[offset]['stage_b'] mapB_name = get_stage_name(mapB['id'], translations) mapB_url = get_full_splatoon2_url(mapB['image']) end_time = trfWar[offset]['end_time'] theString = theString + '{:22}'.format(mapA_name) + '\t' + mapB_name + '\n' timeRemaining = end_time - current_time timeRemaining = timeRemaining % 86400 hours = int(timeRemaining / 3600) timeRemaining = timeRemaining % 3600 minutes = int(timeRemaining / 60) if offset == 0: theString = theString + 'Time Remaining: ' elif offset >= 1: hours = hours - 2 theString = theString + 'Time Until Map Rotation: ' embed = Embed(title=match_name, description="Temps restant : {} heures et {} minutes".format(hours, minutes), color=discord.Color.default()) embed.set_thumbnail(url=MATCH_REGULAR_IMAGE_URL) await ctx.send(embed=embed) embed = Embed(title=mapA_name, color=discord.Color.blue()) embed.set_thumbnail(url=MATCH_REGULAR_IMAGE_URL) embed.set_image(url=mapA_url) await ctx.send(embed=embed) embed = Embed(title=mapB_name, color=discord.Color.blue()) embed.set_thumbnail(url=MATCH_REGULAR_IMAGE_URL) embed.set_image(url=mapB_url) await ctx.send(embed=embed)
async def on_ready(): console.print( Panel('[bold green]Connected to Discord API ✓\nLoading Complete ✓'), justify='center') console.print(Markdown('# Logging Commands:')) embed = Embed(title="Good Morning", description="It's a beautiful day for pie", color=0x00ff00) embed.set_image( url= "https://media1.tenor.com/images/4443069022c0e23622626a46909162ec/tenor.gif?itemid=10618052" ) await bot.get_channel(830932320771899432).send(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 meme(self, ctx): try: responseData = await sendGetRequest( 'https://some-random-api.ml/meme') data = json.loads(responseData) embed = Embed(title='Nice Meme', colour=0x0099ff) embed.set_image(url=data['image']) await ctx.send(embed=embed) except Exception as e: await ctx.send(f'Couldn\'t send meme because of: {e}') return
def get_embed(self) -> Tuple[Embed, File]: embed = Embed(title=self.title if self.title else "", description=self.description if self.description else "", colour=self.color, timestamp=datetime.utcnow()) for field in self.fields: embed.add_field(name=field['name'], value=field['value']) if self.author: embed.set_author(name=self.author['name'], url=self.author.get('url', EmptyEmbed), icon_url=self.author.get('icon_url', EmptyEmbed)) if self.image_url: embed.set_image(url=self.image_url) return embed, self.file
def create_embed_pricing(self, data): """ Creates a discord embed object and adds the nesscary fields to the embed object depending on what type it is It also adds the image link to the embed if it exists :param data: dict: Must contain the field "type", everything else depends on what type it is :return: discord.embeds.Embed """ embed = Embed(colour=0x4f1608) item_type = data.get("type") if item_type == "rare": embed.add_field(name=f"{data.get('currency').title()} Min", value=data.get("min")) embed.add_field(name=f"{data.get('currency').title()} Max", value=data.get("max")) return embed if item_type != "currency": embed.add_field(name="Chaos", value=data.get("chaos")) embed.add_field(name="Exalted", value=data.get("exalted")) else: embed.add_field(name=f"Pay (x {data.get('name')} gets you 1 Chaos", value=data.get("pay")) embed.add_field( name=f"Recieve (One {data.get('name')} gets x Chaos)", value=data.get("recieve")) if item_type in ["armour", "weapon"]: embed.add_field(name="Links", value=data.get("links")) if data.get("legacy") == 0: embed.add_field(name="Legacy", value="No") else: embed.add_field(name="Legacy", value="Yes") elif item_type == "map": embed.add_field(name="Tier", value=data.get("tier")) embed.add_field(name="Atlas", value=data.get("atlas")) elif item_type == "gem": embed.add_field(name="Level", value=data.get("gem_level")) embed.add_field(name="Quality", value=data.get("gem_quality")) if data.get("gem_corrupted") == 1: embed.add_field(name="Corrupted", value="True") else: embed.add_field(name="Corrupted", value="False") elif item_type == "flask": if data.get("legacy") == 0: embed.add_field(name="Legacy", value="No") else: embed.add_field(name="Legacy", value="Yes") if data.get("image"): embed.set_image(url=data.get("image")) return embed
async def cat(self, ctx): try: responseData = await sendGetRequest('https://aws.random.cat/meow') data = json.loads(responseData) embed = Embed( title='Meow 🐱', colour=0x0099ff ) embed.set_image(url=data['file']) await ctx.send(embed=embed) except Exception as e: await ctx.send(f'Couldn\'t send cat because of: {e}') return
async def dog(self, ctx): try: responseData = await sendGetRequest('https://dog.ceo/api/breeds/image/random') data = json.loads(responseData) embed = Embed( title='Woof 🐶', colour=0x0099ff ) embed.set_image(url=data['message']) await ctx.send(embed=embed) except Exception as e: await ctx.send(f'Couldn\'t send dog because of: {e}') return
async def bird(self, ctx): try: responseData = await sendGetRequest('https://some-random-api.ml/img/birb') data = json.loads(responseData) embed = Embed( title='Tweet tweet 🐦', colour=0x0099ff ) embed.set_image(url=data['link']) await ctx.send(embed=embed) except Exception as e: await ctx.send(f'Couldn\'t send bird because of: {e}') return
async def send_matches(message: discord.message.Message): resp = await do_get_todays_matches() for m in resp['matches']: e = Embed() e.title = m['competition']['name'] e.description = m['competition']['area']['name'] e.set_image(url=m['competition']['area']['ensignUrl']) e.add_field(name='Time', value=m['utcDate'], inline=False) e.add_field(name='Status', value=m['status'], inline=False) e.add_field(name=m['homeTeam']['name'], value=m['score']['fullTime']['homeTeam'], inline=True) e.add_field(name=m['awayTeam']['name'], value=m['score']['fullTime']['awayTeam'], inline=True) await message.reply(embed=e)
async def google_image_search(self, ctx: commands.Context, *, terms=None): """Sends an embed containing the first image found in Google for the specified terms.""" if not terms: await ctx.send( "Well I can't go searching for nothing now, can I? Give me something to search for." ) return result = requests.get(url=self._build_searchstr(terms)).json()['items'] if not result: await ctx.send("Tough luck, no results found.") return else: embed = Embed(description="Image first result:", colour=Colour(randint(0x000000, 0xFFFFFF))) embed.set_image(url=result[0]['link']) await ctx.send(embed=embed)
async def roger_foto(self, ctx: commands.Context): """Você perguntou? O Roger aparece!""" msg: Message = await ctx.send("Invocando o Roger...") try: roger_img = self._fetch_roger_image() embed = Embed(description=roger_img[0], colour=Colour(randint(0x000000, 0xFFFFFF))) embed.set_image(url=roger_img[1]) if roger_img[0].lower() == "julio_cobra": ct = 'Cacilda, agora a cobra fumou. Você tirou o julio_cobra.' else: ct = None await msg.edit(content=ct, embed=embed) except Exception as e: await msg.edit("Ih, deu zica.") print(f"Zica thrown: {e}")
async def rule34(ctx, *, tags: str = '*'): url34 = environ.get('URL34') def get_random_posts(url): respond_for_img = requests.get(url=url, headers=HEADERS) bs = BeautifulSoup(respond_for_img.text, 'html.parser') return bs.posts def get_any_random_post_url(url): resp = requests.get(url=url, headers=HEADERS) bs = BeautifulSoup(resp.text, 'html.parser') post_id = bs.title.string.split()[-1] post_url = url34+'page=dapi&s=post&q=index&id='+post_id return post_url if tags == '*': post_url = get_any_random_post_url(url34+'page=post&s=random') post = get_random_posts(post_url).post image_url = post['file_url'] # Image URL post_id = post['id'] # Post ID else: posts_count = get_random_posts(url34+'page=dapi&s=post&q=index&limit=1&tags='+tags)['count'] # Posts count try: post_pid = random.randint(0, int(posts_count) - 1) # Post PID except: await ctx.send(':sob: Не могу найти такой пост...') return post = get_random_posts(url34+'page=dapi&s=post&q=index&limit=1&pid='+str(post_pid)+'&tags='+tags).post # Post object image_url = post['file_url'] # Image URL post_id = post['id'] # Post ID print(f'Sending post ID{post_id}') emb = Embed() if tags != '*': emb.title='Rule34: '+tags emb.description = f'Количество постов с этим тэгом: **{posts_count}**\n' else: emb.title='Rule34: случайный пост' emb.set_author(name=f'ID: {post_id}', url=f'{url34}page=post&s=view&id={post_id}') emb.set_image(url=image_url) emb.set_footer(text='Тэги: '+post['tags']) await ctx.message.delete() await ctx.send(embed=emb)
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)
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 on_lords_division(self, division: LordsDivision, bill: Bill): channel = self._guild.get_channel( int(self.config.get_channel_id("lords_divisions")) ) if channel is None: return print(f"Lords Event: {division.get_division_title()}") print(f"Lords Event Date: {division.get_division_date()}") print("Getting lords division image.") division_file = await self.generate_division_image(self.parliament, division) print("Got lords division image.") embed = Embed( color=discord.Colour.from_rgb(166, 42, 22), timestamp=datetime.now() ) did_pass = division.get_aye_count() > division.get_no_count() embed.title = f"**{division.get_division_title()}**" embed.set_image(url="attachment://divisionimage.png") next_line = "\n" description = ( f"**ID:** {division.get_id()}{next_line}**Summary [(Link)](https://votes.parliament.uk/" f"Votes/Lords/Division/{division.get_id()}):** {division.get_amendment_motion_notes()[0:250]}...{next_line}" f"**Division Result:** {'Passed' if did_pass else 'Not passed'} by a division of " f"{division.get_aye_count() if did_pass else division.get_no_count()} " f"{'Ayes' if did_pass else 'Noes'} to {division.get_no_count() if did_pass else division.get_aye_count()}" f" {'Noes' if did_pass else 'Ayes'}{next_line}**Division Date:** " f"{division.get_division_date().strftime('%Y-%m-%d %H:%M:%S')}" ) if bill is not None: description += ( f"{next_line}**Bill Summary [(Link)](https://bills.parliament.uk/bills/" f"{bill.get_bill_id()})**: {bill.get_long_title()}**" ) embed.description = description self.tracker_status["lordsdivisions"]["confirmed"] = True embed.set_image(url="attachment://divisionimage.png") print("Sending lords division embed.") await channel.send( file=division_file, embed=embed, )