def em_base(self) -> Embed: """Prepare a basic embed that will be common to all outputs""" em = Embed(title=self.title, description="", color=self.color) em.set_author(**self.author) em.set_footer(text=self.footer) return em
async def form(message, params, **options): values = " ".join(params).strip() values = values.split(FORM_SEPARATOR) if len(values) > 10: return log((["b", "w"], "too many arguments")) title = values[0] form_options = [option for option in values[1:] if option] if not title: return log((["b", "w"], "not enough arguments")) embed_message = Embed() embed_message.description = f"📊 **{title}**\n\n" embed_message.colour = discord.Colour.from_rgb(77, 119, 215) embed_message.set_footer(text=f"by {message.author}") if not form_options: message_form = await message.channel.send(embed=embed_message) for emoji in ["✅", "❌"]: await message_form.add_reaction(emoji) return ziped_options = list(zip(FORM_EMOJIS, form_options)) for number, desc in ziped_options: embed_message.description += f"{number} {desc}\n" message_form = await message.channel.send(embed=embed_message) for number in range(len(form_options)): await message_form.add_reaction(FORM_EMOJIS[number])
async def timer(self, ctx): """ Gets the Next Timer! :param ctx: :return: """ next_timer = Timer.objects.filter( corp_timer=False, eve_time__gte=datetime.datetime.utcnow().replace( tzinfo=timezone.utc)).first() time_until = pendulum.now(tz="UTC").diff_for_humans( next_timer.eve_time, absolute=True) embed = Embed(title="Next Timer") embed.description = next_timer.details if next_timer.objective == "Friendly": embed.colour = Color.blue() elif next_timer.objective == "Hostile": embed.colour = Color.red() else: embed.colour = Color.white() try: embed.set_footer(text="Added By {0}".format( next_timer.eve_character.character_name)) except Exception as e: logger.error(e) pass embed.add_field(name="Structure:", value=next_timer.structure) embed.add_field(name="Location:", value="{0} - {1}".format(next_timer.system, next_timer.planet_moon)) embed.add_field(name="Eve Time:", value=next_timer.eve_time.strftime("%Y-%m-%d %H:%M"), inline=False) return await ctx.send(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 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 eightball(self, ctx, error, *, question): responses = ["Es seguro", "Es decididamente así", "Sin duda", "Puedes confiar en ello", "Tal como lo veo, si", "Lo mas probable", "Si", "Los signos apuntan al si", "Respuesta confusa, intentalo de nuevo", "Vuelve a preguntar mas tarde", "Mejor no te lo digo ahora", "No puedo predecirlo en este momento", "Concentrate y vuelve a preguntar", "Mi respuesta es un no", "Mis fuentes dicen que no", "No cuentes con ello", "Las perspectivas no son tan buenas", "Muy dudoso"] embed=Embed(title='**8Ball**', color=0xfff0ff) embed.add_field(name='***Tu pregunta***', value={question}, inline=True) embed.add_field(name='***Mi respuesta***', value={random.choice(responses)}, inline=True) embed.set_footer(text='Espero que esta respuesta alla sido de tu agrado 😀') await ctx.send(embed=embed)
async def build_info_embed(ctx, bot): """ build the info embed :param ctx: the discord context object :param bot: the bot object :return: the info embed """ stats = generate_info(guilds=bot.servers, members=bot.get_all_members(), channels=bot.get_all_channels(), voice=bot.voice_clients, logged_in=bot.is_logged_in) user = bot.user lan = bot.localize(ctx) ram = stats['ram'] guild_count = comma(stats['guild_count']) user_count = comma(stats['user_count']) text_count = comma(stats['text_channel_count']) voice_count = comma(stats['voice_count']) if ram < 1024: ram_str = '{0:.2f}MB'.format(ram) else: ram_str = '{0:.2f}GB'.format(ram / 1024) total_ram = virtual_memory().total / 1024 / 1024 / 1024 total_ram_str = '{0:.2f}GB'.format(total_ram) embed = Embed(colour=bot.config['Bot']['colour']) embed.set_author(name=user.name, icon_url='{0.avatar_url}'.format(user)) embed.set_footer( text=lan['info_footer'].format(get_prefix(bot, ctx.message))) embed.add_field(name=lan['ram_used'] + '/' + lan['total_ram'], value=f'{ram_str}/{total_ram_str}') embed.add_field(name=lan['uptime'], value=get_uptime(bot.start_time, lan['days'])) embed.add_field(name=lan['python_ver'], value=platform.python_version()) embed.add_field(name=lan['lib'], value='Discord.py v{}.{}.{}'.format( version_info.major, version_info.minor, version_info.micro)) embed.add_field(name=lan['sys'], value=get_system_name()) devs = bot.config['Bot']['devs'] if devs: embed.add_field(name=lan['devs'], value='\n'.join(devs)) helpers = bot.config['Bot']['helpers'] if helpers: embed.add_field(name=lan['helper'], value='\n'.join(helpers)) embed.add_field(name=lan['guilds'], value=guild_count) embed.add_field(name=lan['users'], value=user_count) embed.add_field(name=lan['text_channels'], value=text_count) embed.add_field(name=lan['voice_channels'], value=voice_count) return embed
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)
async def ping(self, ctx): """ Tests Functionality """ VERSION = os.getenv('HEROKU_RELEASE_VERSION') e = Embed(title='Pong!', description=':ping_pong:!', color=discord.Color.green()) e.set_footer(text=f"Caseus Version {VERSION}") e.add_field( name="Latency:", value=f"Responded in {round(self.cas.latency, 2)} microseconds.") await ctx.send(embed=e)
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)
async def page_embeds(self, embed: PagedEmbed, out=None): out = out or self fields = [ embed.fields[i:i + 25] for i in range(0, len(embed.fields), 25) ] for idx, field in zip(range(len(fields)), fields): page = Embed(title=embed.title, description=embed.desc, colour=embed.colour or self.me.colour) page.set_footer(text=f'page {idx+1} of {len(fields)}') for entry in field: page.add_field(name=entry[0], value=entry[1], inline=entry[2]) await out.send(embed=page)
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.")
async def _generate_embed(self, mail: MailMessage) -> Embed: embed = Embed( title=f'`Neue E-Mail: {mail.subject}`', type='rich', colour=Colour.dark_magenta(), ) text = self._cut_mail_text(mail.text) embed.set_author(name=mail.from_) embed.add_field(name='Nachricht', value=text) embed.add_field(name='Datum', value=mail.date.strftime('%c')) embed.set_footer(text=self.bot.signature) return embed
async def stats(self, ctx: Context, user: Member=None): """Check Stats for user, If no user mention it will default to command invoker""" if user is None: user = ctx.author userid = user.id guildid = ctx.guild.id response = await db.runCommand("getUserStats", userid, guildid) #page_1 page_1 = Embed(title="User Stats", color=0x00ff59) page_1.set_author(name=user.display_name + user.discriminator, icon_url=user.avatar_url) page_1.add_field(name="Messages Sent", value=response[0], inline=False) page_1.add_field(name="Songs Played", value=response[1], inline=False) page_1.add_field(name="Join Date", value=user.joined_at.strftime("%A, %d/%B/%Y at %H hours %M minutes %S seconds %Z"), inline=False) page_1.set_footer(text="Momento") await ctx.send(embed=page_1)
async def error(ctx, error): print(error) em = Embed(title="Error!", description='*The following error has occured* **' + repr(error).replace('*', '\\*') + '**', url="https://discord.gg/VXFsKzf", color=0xff0000) if not (isinstance(error, commands.ArgumentParsingError) or isinstance(error, commands.MissingRequiredArgument) or isinstance(error, MissingRole) or isinstance(error, MissingAnyRole) or isinstance(error, MissingPermissions)): em.set_footer( text= "**Please report this to the dev**\nClick on the title to get the report server invite" ) await ctx.send(embed=em)
async def embed(self, ctx: Context, *, content: str): data = content.split('#') if len(data) != 4: await ctx.send(ctx.command.usage) return author, title, message, date = data await ctx.message.delete() embed = Embed( title=title, type='rich', colour=Color.dark_green(), ) embed.set_author(name=author) embed.add_field(name='Aufgabe/Nachricht', value=message) embed.add_field(name='Datum', value=date) embed.set_footer(text=self.bot.signature) await ctx.send(embed=embed)
async def log(self, ctx: Context, channel: Optional[TextChannel] = None): lang = get_user_language(ctx.author.id) if channel: update_log_channel(channel) embed = Embed(color=Colors.log_channel, timestamp=datetime.now()) embed.add_field(name=lang.settings_log_new_log_channel, value=channel.mention) embed.add_field(name=lang.changed_by, value=ctx.author.mention) embed.set_footer(text=lang.channel_id + ": " + str(channel.id)) await ctx.send(embed=embed) await log(ctx, embed=embed) return ch = ctx.guild.get_channel(channel_id=get_log_channel(ctx)) embed = Embed(color=Colors.log_channel, timestamp=datetime.now()) embed.add_field(name=lang.settings_log_current_log_channel, value=ch.mention if ch else f"`{lang.none}`") await ctx.send(embed=embed)
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 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
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 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 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)
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)
def _make_embed_skeleton(self, header: bool, desc: bool, footer: bool, image: bool): embed = self.template e_new = Embed(colour=embed.colour, type=embed.type) if header: e_new.title = embed.title e_new.url = embed.url author = embed.author if author.name is not EmptyEmbed: e_new.set_author(name=author.name, url=author.url, icon_url=author.icon_url) if desc: e_new.description = embed.description if image: if embed.image.url is not EmptyEmbed: e_new.set_image(url=embed.image.url) if embed.thumbnail.url is not EmptyEmbed: e_new.set_thumbnail(url=embed.thumbnail.url) if footer: e_new.timestamp = embed.timestamp footer = embed.footer e_new.set_footer(text=footer.text, icon_url=footer.icon_url) return e_new
def get_embed(self): embed = D_Embed(title=self.title, colour=self.colour, description=self.description) if self.author: embed.set_author(name=self.author.display_name, icon_url=self.author.avatar_url) if self.image: embed.set_image(url=self.image) for name, value in self.content: if value: embed.add_field(name=name, value=value, inline=False) else: embed.add_field(name=name, value=" - ", inline=False) if self.footer: embed.set_footer(text=self.footer) return embed
async def pomoc(ctx): embed = Embed(title="Pomoc bota serwerdsc.pl", color=0xC100FF) embed.add_field(name='s!ustaw link <nazwa>', value='Ustawia nazwę linku', inline=False) embed.add_field(name='s!ustaw opis "<opis>"', value='Ustawia opis', inline=False) embed.add_field(name='s!ustaw css <plik_css>', value='Ustawia link do pliku css.', inline=False) embed.add_field(name='s!link', value='Link do strony serwera', inline=False) embed.add_field(name='Linki', value='[serwer support](https://discord.gg/McGwsEsjBU)') embed.set_footer(text=f'Aktywny na {len(bot.guilds)} serwerach.') await ctx.send(embed=embed)
async def about(self, ctx): embed = Embed( title='Pingu Bot', description='A simple Discord Bot that\'s somewhat useful?', colour=0x0099ff, url=self.client.config.get('bot website', EmptyEmbed), timestamp=datetime.now()) applicationInfo = await self.client.application_info() botOwner = applicationInfo.owner embed.set_author(name=f'{botOwner.name}#{botOwner.discriminator}', icon_url=botOwner.avatar_url_as(static_format='png', size=256), url=self.client.config.get('bot owner website', EmptyEmbed)) botImageUrl = self.client.user.avatar_url_as(static_format='png', size=256) embed.set_image(url=botImageUrl) embed.set_thumbnail(url=botImageUrl) embed.add_field(name='The Best Penguin Around', value='It\'s Pingu your friendly neighborhood Noot!') embed.add_field(name='How does it work?', value='Using discord.py', inline=False) embed.add_field(name='Who\'s it for?', value='People who like Pingu', inline=False) embed.add_field(name='What does it do?', value=f'Check {self.client.prefix}help for that pal.', inline=False) # TODO: Ask Ene7 about what should the footer be embed.set_footer(text=EmptyEmbed, icon_url=EmptyEmbed) await ctx.send(embed=embed)
async def anek(ctx): response = requests.get( 'https://api.vk.com/method/wall.get', params = { 'owner_id': environ.get('ANEK_ID'), 'count': 1, 'offset': 0, 'access_token': environ.get('VK_TOKEN'), 'v': '5.130' } ) error = response.json().get('error') if error: print(f'VK API error (code = {error["error_code"]}): {error["error_msg"]}') post_count = response.json()['response']['count'] response = requests.get( 'https://api.vk.com/method/wall.get', params = { 'owner_id': environ.get('ANEK_ID'), 'count': 1, 'offset': random.randint(0, post_count - 1), 'access_token': environ.get('VK_TOKEN'), 'v': '5.130', 'extended': '1' } ) error = response.json().get('error') if error: print(f'VK API error (code = {error["error_code"]}): {error["error_msg"]}') content = response.json()['response']['items'][0]['text'] emb = Embed(title=content) if len(content) < 256 else Embed(description=content) footer = '© ' + response.json()['response']['groups'][0]['name'] emb.set_footer(text=footer) attachments = response.json()['response']['items'][0] try: if attachments['attachments'][0]['type'] == 'photo': image = attachments['attachments'][0]['photo']['sizes'][-1]['url'] emb.set_image(url=image) except: pass thumbnail = response.json()['response']['groups'][0]['photo_200'] emb.set_thumbnail(url=thumbnail) emb.color = discord.Color.from_rgb(22, 185, 247) await ctx.send(embed=emb)
def generate_embed(self, sauce, max_index: int, curr_index: int, disable_components: bool = False): components = [ Button(custom_id='sauce_first', color='blurple', emoji=UI.first_arrow, disabled=curr_index == 1 or disable_components), Button(custom_id='sauce_prev', color='blurple', emoji=UI.previous_arrow, disabled=curr_index == 1 or disable_components), Button(custom_id='delete', color='red', label='Delete', disabled=False), Button(custom_id='sauce_next', color='blurple', emoji=UI.next_arrow, disabled=max_index == 1 or (curr_index == max_index) or disable_components), Button(custom_id='sauce_last', color='blurple', emoji=UI.last_arrow, disabled=max_index == 1 or (curr_index == max_index) or disable_components), ] embed = Embed(color=randint(0, 0xffffff), title='Hasbi Image Search') embed.add_field(name='Author', value=sauce.author, inline=True) embed.add_field(name='Title', value=sauce.title, inline=True) embed.add_field(name='HD URL', value=sauce.urls[0], inline=False) embed.set_image(url=sauce.thumbnail) embed.set_footer(text=f'Similarity: {sauce.similarity}%') return embed, components
def generate_mod_log_entry(action: str, mod: Member, target: Member, reason: str, localize: dict, warn_count: int = None): """ Generate a mod log entry :param action: the action :param mod: the mod that performed the action :param target: the target :param reason: the reason :param localize: the localization strings :param warn_count: the total warning count on the user :return: A discord embed object for the mod log entry """ colour = { localize['mute']: 0x591f60, localize['unmute']: 0x4286f4, localize['ban']: 0xe52424, localize['kick']: 0xdd6f1a, localize['warn']: 0xddc61a, localize['pardon']: 0x4286f4 }[action] embed = Embed(colour=colour) embed.set_author( name=get_name_with_discriminator(target) + ' ({})'.format(target.id), icon_url=get_avatar_url(target) ) embed.set_footer( text=get_name_with_discriminator(mod) + ' | ' + get_date(), icon_url=get_avatar_url(mod) ) embed.add_field(name=localize['type'], value=action.title()) embed.add_field(name=localize['reason'], value=reason) if action == localize['warn'] or action == localize['pardon']: embed.add_field(name=localize['warnings'], value=str(warn_count)) return embed