def update_hint(self, hint): HintsConsumer.send_to_all( json.dumps({ 'id': hint.id, 'content': render_to_string('hint_list_entry.html', { 'hint': hint, 'now': timezone.localtime() }) })) embed = MessageEmbed() embed.author.url = hint.full_url() if hint.claimed_datetime: embed.color = 0xdddddd embed.timestamp = hint.claimed_datetime.isoformat() embed.author.name = 'Claimed by {}'.format(hint.claimer) if hint.claimer in self.get_avatars(): embed.author.icon_url = self.get_avatars()[hint.claimer] debug = 'claimed by {}'.format(hint.claimer) else: embed.color = 0xff00ff embed.author.name = 'U N C L A I M E D' claim_url = hint.full_url(claim=True) embed.title = 'Claim: ' + claim_url embed.url = claim_url debug = 'unclaimed' if self.client is None: message = hint.long_discord_message() logger.info('Hint, {}: {}\n{}'.format(debug, hint, message)) logger.info('Embed: {}'.format(embed.to_dict())) elif hint.discord_id: try: self.client.channels_messages_modify(self.HINT_CHANNEL, hint.discord_id, embed=embed) except Exception: dispatch_general_alert( 'Discord API failure: modify\n{}'.format( traceback.format_exc())) else: message = hint.long_discord_message() try: discord_id = self.client.channels_messages_create( self.HINT_CHANNEL, message, embed=embed).id except Exception: dispatch_general_alert( 'Discord API failure: create\n{}'.format( traceback.format_exc())) return hint.discord_id = discord_id hint.save(update_fields=('discord_id', ))
def build_help_embed(self, helpee_mention, query, identifier): em = MessageEmbed() em.title = 'HelpMe Request' desc = '\n'.join(self.config.helpme_embed_desc) em.description = desc.format(self.build_emoji('complete'), self.build_emoji('decline'), self.build_emoji('escalate')) em.color = '7506394' em.set_footer(text=f'ID: {identifier}') em.add_field(name='Helpee', value=helpee_mention) em.add_field(name='Query', value=f'```{query}```') return em
def update_queue_message(self): reports = self.get_all_bug_reports() message = "\n".join(self.config.queue_summary['message']) message = self.parse_message(message, reports) embed = MessageEmbed() embed.title = self.config.queue_summary['title'] embed.color = int(self.config.queue_summary['color'].replace('#', ''), 16) embed.description = message embed.set_footer(text="Last updated at") embed.timestamp = datetime.utcnow().isoformat() self.send_or_update_message(embed)
def render_player_talent(self, talent): embed = MessageEmbed() embed.title = talent['name'] embed.description = talent['description'] embed.add_field(name='Type', value=talent['type'], inline=True) embed.add_field(name='Benefits', value=talent['benefit'], inline=True) embed.color = 0xDA9513 return embed
def cmd_remind_list(self, event, limit=None, mode='server'): user = event.msg.author count = Reminder.count_for_user(user.id, event.guild.id) total_count = Reminder.count_for_user(user.id) embed = MessageEmbed() embed.title = '{} reminder{} ({} total)'.format( count if mode == 'server' else total_count, 's' if (count != 1 and mode == 'server') or (total_count != 1 and mode == 'global') else '', total_count) embed.set_author(name=u'{}#{}'.format( user.username, user.discriminator, ), icon_url=user.avatar_url) embed.color = get_dominant_colors_user(user, user.get_avatar_url('png')) embed.set_footer(text='You can cancel reminders with !r clear [ID]') if (count == 0 and mode == 'server') or total_count == 0: embed.description = 'You have no upcoming reminders{}.'.format( ' in this server. Use `!r list global` to list all your upcoming reminders' if total_count > 0 else '') else: query = Reminder.select(Reminder).where( (Reminder.message_id << Reminder.with_message_join( (Message.id, )).where( (Message.author_id == event.author.id) & (Message.guild_id == event.guild.id if mode == 'server' else True))) & (Reminder.remind_at > (datetime.utcnow() + timedelta(seconds=1)))).order_by( Reminder.remind_at).limit(limit) for reminder in query: time = humanize_duration(reminder.remind_at - datetime.utcnow()) channel = Message.select().where( Message.id == reminder.message_id).get().channel_id channel = self.state.channels.get(channel) embed.add_field( name=u'#{} in {}'.format(reminder.id, time), value=u'[`#{}`](https://discordapp.com/channels/{}/{}/{}) {}' .format( channel.name if channel.type != ChannelType.DM else 'Jetski', channel.guild_id if channel.type != ChannelType.DM else '@me', channel.id, reminder.message_id, S(reminder.content))) return event.msg.reply(embed=embed)
def lookup_help_session(self, event, identifier): try: session_id = ObjectId(identifier) except InvalidId: event.msg.reply('That identifier is in the wrong format') else: session = self.helpme.find_one({'_id': ObjectId(identifier)}) if session: em = MessageEmbed() em.title = f'DTesters HelpMe Session ({identifier})' em.description = 'Details for the session are below' em.color = '7506394' helpee_user = self.get_user(session['helpee_id']) mentor_user = self.get_user(session['mentor_id']) helpee_name = str( helpee_user) if helpee_user else session['helpee_id'] mentor_name = str( mentor_user) if mentor_user else session['mentor_id'] if mentor_name == 0: mentor_name = '<UNASSIGNED>' active = 'Yes' if session['active'] else 'No' em.add_field(name='Helpee', value=helpee_name, inline=True) em.add_field(name='Mentor', value=mentor_name, inline=True) em.add_field(name='Active', value=active, inline=True) em.add_field(name='Query', value=f'```{session["query"]}```') history = [] for entry in session['history']: tstr = datetime.utcfromtimestamp( entry[0]).strftime('%Y-%m-%d %H:%M:%S') actor = 0 if entry[2] != 0: actor = self.get_user(entry[2]) if actor: actor = str(actor) else: actor = entry[2] history_map = { 'received': 'HelpMe used', 'declined': '{} declined', 'assigned': 'Assigned to {}', 'waiting': 'Posted in mentor channel', 'complete': '{} completed the request', 'escalated': '{} escalated to the mods' } hmsg = history_map.get(entry[1], 'Unknown event').format(actor) history.append(f'{tstr} - {hmsg}') em.add_field(name='History', value='\n'.join(history)) event.msg.reply(embed=em) else: event.msg.reply( 'Unable to find a session with that identifier')
def render_vendor_weapon_mod(self, weaponmod): embed = MessageEmbed() embed.title = weaponmod['name'] embed.description = weaponmod['vendor'] embed.add_field(name='Price', value=weaponmod['price'], inline=True) # embed.add_field(name='Stat', value=weaponmod[''], inline=True) attr = " **-** ".join(weaponmod["attributes"].split('<br/>')) embed.add_field(name='Attribute', value=attr) embed.color = 0xDA9513 return embed
def cmd_systen_stats(self, event): embed = MessageEmbed() embed.title = "Bot Stats" description = [ "**Total Servers**: {}".format(str(len(self.client.state.guilds))), "**Total Users**: {}".format(str(len(self.client.state.users))), "**Total Global Games Played**: {}".format( str('Not Implimented Yet')), "\n", "__**System Stats**__", "**CPU Usage**: {}".format(str(psutil.cpu_percent(interval=1))), "**Ram Usage**: {}".format(str(psutil.virtual_memory().percent)) ] embed.description = '\n'.join(description) event.msg.reply('', embed=embed)
def on_parts_command(self, event, content): pad = self.pad_reader.find_pad(content) if not pad: event.msg.reply('Dude weed lmao cannot find shit') return embed = MessageEmbed() embed.title = pad.title embed.url = pad.url embed.color = cfg.color embed.description = ", ".join(str(x) for x in pad.needs) event.msg.reply('', embed=embed)
def on_roulette(self, event): if cfg.role_dead in event.member.roles: event.msg.reply("ur already ded") else: n = random.randint(1, self.shots) embed = MessageEmbed() embed.title = "({}/{})".format(n, self.shots) if n == 1: try: event.member.add_role(cfg.role_dead) except Exception as e: event.msg.reply("{}: {}".format(type(e).__name__, str(e))) return embed.title = embed.title + " f" embed.color = 16711680 self.shots = 6 self.killed[event.member.user.id] = datetime.now() else: embed.color = cfg.color self.shots = self.shots - 1 event.msg.reply('', embed=embed)
def create_embed(event_name: str, event_link: str, user: User, *args, **kwargs): embed = MessageEmbed() embed.title = event_name embed.url = event_link embed.thumbnail = MessageEmbedThumbnail(url=user.avatar_url) args_desc = "\n\n".join(args) kwargs_desc = "\n\n".join("**{0}:\n{1}**".format(name, value) for name, value in kwargs.items()) embed.description = "\n\n".join((args_desc, kwargs_desc)) embed.color = 0x00FFFF return embed
def log_action(self, action: str, content: str, target=None, **kwargs): embed = MessageEmbed() embed.title = action + (" | " + str(target.user)) if target is not None else "" embed.color = 0x6832E3 if target is not None: embed.description = content.format(t=target.user, **kwargs) embed.set_thumbnail(url=target.user.avatar_url) else: embed.description = content.format(**kwargs) embed.timestamp = datetime.utcnow().isoformat() self.client.api.channels_messages_create( self.config["BOT_LOGGING_CHANNEL"], " ", embed=embed)
def on_message(self, event): if event.member.user.bot: return m = re.search( r"https{0,1}:\/\/e[x-]hentai.org\/g\/([A-z0-9]+)\/([A-z0-9]+)\/", event.message.content) if m and len(m.groups()) == 2: r = self.session.post(api_ex, json={ "method": "gdata", "gidlist": [[m.group(1), m.group(2)]], "namespace": 1 }) j = r.json() embed = MessageEmbed() embed.color = cfg.color embed.title = j["gmetadata"][0]["title"] embed.add_field(name='Tags', value=" ".join(j["gmetadata"][0]["tags"]), inline=True) embed.add_field( name='Links', value= ("[e-hentai](https://e-hentai.org/g/{0}/{1}/) [exhentai](https://exhentai.org/g/{0}/{1}/)" ).format(m.group(1), m.group(2)), inline=True) embed.add_field( name='test', value="yes" if j["gmetadata"][0]["expunged"] else "no", inline=True) imgdata = self.session.get(j["gmetadata"][0]["thumb"].replace( "\\", "")) resp = requests.post( "https://f.okea.moe/api/upload", files={'file': ('1.jpg', BytesIO(imgdata.content))}) resp_json = resp.json() if resp.ok and resp_json and resp_json[ "success"] == True and resp_json["url"] != None: embed.thumbnail = MessageEmbedThumbnail() embed.thumbnail.url = resp_json["url"] event.reply("", embed=embed)
def raid_alert(self, d): legend = json.loads(open('config/raid.json').read()) rmtitle = re.sub('<MON>', d['mon_name'], legend['raid']) rlfield = legend['time'] adreu = d.get('street', '') + d.get('street_num', '') adrus = d.get('street_num', '') + d.get('street', '') address = legend.get('address', '') gyminfo = legend['gyminfo'] moves = legend['moves'] boost = legend['weather'] rmlinkfield = legend.get('RM', '') description = rlfield if d['geo_enabled']: description += address if d['iv_enabled']: description += gyminfo if d['moves_enabled']: description += moves if 'boost' in d and d['weather_enabled']: description += boost if args.mapurl: description += rmlinkfield description = re.sub('<DESPAWN>', d.get('time', ''), description) description = re.sub('<TTH>', d.get('tth', ''), description) description = re.sub('<CITY>', d.get('city', ''), description) description = re.sub('<SUB>', d.get('suburb', ''), description) description = re.sub('<STR>', d.get('street', ''), description) description = re.sub('<STR_NUM>', d.get('street_num', ''), description) description = re.sub('<ADDR_EU>', adreu, description) description = re.sub('<ADDR_US>', adrus, description) description = re.sub('<GYM>', d.get('gym_name', ''), description) description = re.sub('<INFO>', d.get('description', ''), description) description = re.sub('<MOVE1>', d.get('move1', ''), description) description = re.sub('<MOVE2>', d.get('move2', ''), description) description = re.sub('<WEA>', d.get('boost', ''), description) description = re.sub('<RM>', d.get('mapurl', ''), description) embed = MessageEmbed(color=d['color'], description=description) embed.url = (d['gmapurl']) embed.thumbnail = MessageEmbedThumbnail(url=d['img']) embed.author = MessageEmbedAuthor(icon_url=d['thumb'].lower(), name=rmtitle) embed.title = '{}'.format(d['mon_name']) embed.url = d['gmapurl'] if d['map_enabled']: embed.image = MessageEmbedImage(url=d['static']) self.channels_messages_create(d['channel'], embed=embed)
def jeopardy_command(self, event, args): self.log.info('{} executed !jeopardy with args: {}'.format( event.author, args)) if not args.random: return jservice_base_url = 'http://jservice.io/{}' jservice_random = '/api/random' jeopardy_response = requests.get( jservice_base_url.format(jservice_random)).json()[0] from pprint import pprint pprint(jeopardy_response) jeopardy_q = jeopardy_response['question'].replace('&', 'and') jeopardy_a = self.clean_html(jeopardy_response['answer']) jeopardy_id = jeopardy_response['id'] jeopardy_amount = '${}'.format(jeopardy_response['value']) jeopardy_category = jeopardy_response['category']['title'] jeopardy_q = '\n'.join([ ' '.join(jeopardy_q.split()[s:s + 6]) for s in range(0, len(jeopardy_q.split()), 6) ]) self.log.info('amount: {}'.format(jeopardy_amount)) img2txt_url = 'http://api.img4me.com/?text={}&font=impact&size=35&fcolor={}&bcolor=060CE9' question_color = 'FFFFFF' amount_color = 'D49516' question_value = requests.get( img2txt_url.format(jeopardy_q, question_color)).text amount_value = requests.get( img2txt_url.format(jeopardy_amount, amount_color)).text embed = MessageEmbed() embed.set_author( name='Jeopardy!', url='http://jservice.io/', icon_url= 'http://jservice.io/assets/trebek-503ecf6eafde622b2c3e2dfebb13cc30.png' ) embed.title = 'Category: {}'.format(jeopardy_category) embed.timestamp = pendulum.now().in_tz('America/New_York').isoformat() embed.set_thumbnail(url=amount_value) embed.set_image(url=question_value) embed.set_footer(text='Powered by jservice.io') embed.color = '13931798' # dark yellow (hex: #D49516) event.msg.reply(embed=embed)
def on_status(self, event): embed = MessageEmbed() embed.title = "DC's Imouto" embed.color = cfg.color embed.add_field(name='pads monitoring', value=self.monitor_set.num_alive(), inline=True) embed.add_field(name='last refresh', value=self.last_refresh.strftime('%Y-%m-%d %H:%M:%S'), inline=True) embed.add_field(name='started', value=self.time_started.strftime('%Y-%m-%d %H:%M:%S'), inline=True) event.msg.reply('', embed=embed)
def cmd_systen_stats(self, event): embed = MessageEmbed() embed.title = "Bot Stats" description = [ "**Total Servers**: {}".format(str(len(self.client.state.guilds))), "**Total Users**: {}".format(str(len(self.client.state.users))), "**Total Global Games Played**: {}".format( Games.select(Games).count()), "\n", "__**System Stats**__", "**CPU Usage**: {}%".format(str(psutil.cpu_percent(interval=1))), "**Ram Usage**: {}%".format(str(psutil.virtual_memory().percent)), "**Ping**: `{}` ms".format(round(self.client.gw.latency * 1000, 2)) ] embed.description = '\n'.join(description) event.msg.reply('', embed=embed)
def on_tags_list(self, event): tags = Tag.select(Tag, User).join( User, on=(User.user_id == Tag.author_id)).where( (Tag.guild_id == event.guild.id)).order_by(Tag.name) if not tags: raise CommandFail('No tags exist') embed = MessageEmbed() embed.title = 'Tags for {}'.format(event.guild.name) embed.description = '\n'.join( '- `{}` by {}'.format(tag.name, tag.user.name) for tag in tags) event.msg.reply(embed=embed)
def create_log_embed(event_type, event, custom=False, data={}): guilds = load() embed = MessageEmbed() if not custom: log_message = response_to_class("rich", event_type) content = log_message[0] if log_message[0] != None: content = log_message[0].format(e=event) embed.title = log_message[1] if log_message != None: embed.title = log_message[1].format(e=event) embed.description = log_message[2] if log_message[2] != None: embed.description = log_message[2].format(e=event) embed.footer.text = log_message[3] if log_message[3] != None: embed.footer.text = log_message[3].format(e=event) embed.url = log_message[4] if log_message[4] != None: embed.url = log_message[4].format(e=event) embed.color = log_message[5] """else: #IGNORE FOR NOW if "content" in data: content = data["content"] if "title" in data: title = data["title"] if "desciption" in data: desciption = data["response"]""" return [content, embed]
def cmd_list_rules(self, event): user_obj = Users.with_id(event.author.id) enabled_rules = user_obj.get_enabled() embed = MessageEmbed() embed.title = '{}\'s Uno Rules'.format(event.author) embed.description = 'Change a rule by typing `{prefix}uno <enable/disable> <rule #>`.\nExample: `{prefix}uno enable 2`'.format(prefix=event.db_guild.prefix) # embed.color = 0x11538982 embed.add_field( name='{}:one: Jump In'.format('<{}>'.format(YES_EMOJI if Users.UnoRules.jump_in in enabled_rules else NO_EMOJI)), value='At any time, if you have the same card - color and number - as the card anyone plays, you can \"jump\" in by playing that card, and then the turn goes to the person after you.' ) embed.add_field( name='{}:two: Stacking Draws'.format('<{}>'.format(YES_EMOJI if Users.UnoRules.stack_draws in enabled_rules else NO_EMOJI)), value='If someone plays a draw 2 on you, you can stack another draw 2 on it instead of drawing your cards and skipping your turn; the next person then has to draw 4 cards unless he or she also stacks. The same is true of Draw 4s - but you cannot mix and match Draw 4 and Draw 2 cards.' ) embed.add_field( name='{}:three: 7-Swap'.format('<{}>'.format(YES_EMOJI if Users.UnoRules.seven_swap in enabled_rules else NO_EMOJI)), value='When playing a 7, you can choose to trade hands with another player.' ) embed.add_field( name='{}:four: 0-Super Swap'.format('<{}>'.format(YES_EMOJI if Users.UnoRules.super_swap in enabled_rules else NO_EMOJI)), value='When playing a 0, all players must switch hands with the player a turn ahead of them.' ) embed.add_field( name='{}:five: Cancel Skip'.format('<{}>'.format(YES_EMOJI if Users.UnoRules.cancel_skip in enabled_rules else NO_EMOJI)), value='If the player before you has plays a Skip, you can play another Skip and will skip the next player\'s turn.' ) embed.add_field( name='{}:six: Special Multiplay'.format('<{}>'.format(YES_EMOJI if Users.UnoRules.special_multiplay in enabled_rules else NO_EMOJI)), value='You can place multiple Draw 2s, Draw 4s, Skips, and Reverses at one time and the effects will stack. For example, if you place 2 Skips down, it will skip 2 players. If you place 3 Draw 2s down, the next player will draw 6 cards.' ) embed.add_field( name='{}:seven: Trains'.format('<{}>'.format(YES_EMOJI if Users.UnoRules.trains in enabled_rules else NO_EMOJI)), value='You can place multiple cards down if they are either one up, one down, or the same number as the previous card. For example, if you have the hand `Red1, Green2, Yellow3, Green4` and you place down the Yellow3, you can place down **in order** `Green2, Red1` or `Green4` on the same turn.' ) embed.add_field( name='{}:eight: Endless Draw'.format('<{}>'.format(YES_EMOJI if Users.UnoRules.endless_draw in enabled_rules else NO_EMOJI)), value='If you are unable to play any cards, you must keep drawing cards until you can play.' ) return event.msg.reply('', embed=embed)
def on_reddit(self, event): random_post = self.reddit.random_post(self.memes) # permissions check bot_perms = event.channel.get_permissions(self.state.me.id) if bot_perms.administrator or bot_perms.embed_links: embed = MessageEmbed() embed.title = random_post.title embed.url = random_post.permalink embed.image = MessageEmbedImage(url=random_post.url) event.msg.reply(embed=embed) else: # Send a normal message. event.msg.reply(random_post.url)
def render_gearset(self, gearset): embed = MessageEmbed() embed.title = gearset['name'] embed.add_field(name='2 piece bonus', value=gearset['2'], inline=True) embed.add_field(name='3 piece bonus', value=gearset['3'], inline=True) embed.add_field(name='4 piece bonus', value=gearset['4']) embed.add_field(name='5 piece bonus', value=gearset['5'], color='489979') embed.add_field(name='6 piece bonus', value=gearset['6']) embed.set_footer(text="added in patch %s" % gearset['patch']) embed.color = '52377' return embed
def on_help(self, event): embed = MessageEmbed() embed.type = 'fields' embed.title = 'HELP' embed.add_field(name='!taunt [@user]', value='Taunt user') embed.add_field( name='!log <int>', value= 'Send log messages to the current channel if int > 0, logging is disabled if this condition is not true. [Requires admin permissions]' ) embed.add_field( name='!logignore', value='Ignore/Log channel. [Requires admin permissions]') event.msg.reply('', embed=embed)
def CHANNEL_UPDATE(event): sleep(1) # Retrieve the audit log object # (We just have to hope that it is the right object) data = event.guild.get_audit_log_entries(limit=1)[0] field_count = 2 embed = MessageEmbed() embed.title = "Channel Updated" embed.color = Colour.YELLOW # Create static fields embed.add_field(name="Channel:", value=event.channel.name, inline=True) embed.add_field(name="User:"******"<@{}>".format(data.user_id), inline=True) # Filter through all changes for change in data.changes: print(change.to_dict()) # Ensure we don't exceed the field limit if field_count < 25: # Setting deleted if change.old_value and not change.new_value: embed.add_field( name="{}:".format(change.key), value="Unset from: `{c.old_value}`".format(c=change), inline=True) #Setting modified elif change.new_value and change.old_value: embed.add_field( name="{}:".format(change.key), value="From: `{c.old_value}`\nTo: `{c.new_value}`". format(c=change), inline=True) # Setting created elif change.new_value and not change.old_value: embed.add_field( name="{}:".format(change.key), value="Set to: `{c.new_value}`".format(c=change), inline=True) else: break return embed
def CHANNEL_CREATE(event): sleep(1) # Retrieve the audit log object data = event.guild.get_audit_log_entries(action_type=10, limit=1)[0] # Create log embed embed = MessageEmbed() embed.title = "Channel Created" embed.add_field(name="Channel:", value=event.channel.name, inline=True) embed.add_field(name="Type:", value=event.channel.type, inline=True) embed.add_field(name="User:"******"<@{}>".format(data.user_id), inline=False) embed.color = Colour.GREEN return embed
def print_needs(self, event, roles, name): songs = self.pad_reader.get_inst_songs(self.pad_reader.getpads(), roles) if not songs: event.msg.reply("Hmm, doesn't seem to be anything...") else: embed = MessageEmbed() embed.title = "In need of " + name embed.color = cfg.color embed.description = "" for k, v in songs: embed.description = embed.description + "({}) [{}]({}) `{}`\n".format( str(len(k.needs)), k.title, k.url, ", ".join(v)) paginator.create(self, embed, event.msg.reply)
def getZileanEmbed(title="Zilean Bot", footer="Zilean Bot", description="Zilean Bot"): embed = MessageEmbed() embed.title = title embed.description = description embed.set_footer(text=footer) embed.set_author( name="Zilean", icon_url="https://i.imgur.com/JreyU9y.png", url="https://samuel-maddock.github.io/Zilean/#commands") embed.color = 0x59fff9 embed.timestamp = datetime.utcnow().isoformat() return embed
def show_powerup_shop(self, event): embed = MessageEmbed() embed.title = "Powerup Shop" embed.description = "\n\n".join( map( lambda x: "{3}) **{0}** | *{1} bepis*\n***{2}***".format( x[1][1], x[1][2], x[1][3], x[0]), enumerate(POWERUP_FRAMES))) embed.color = 0xFDB813 embed.set_footer( text= "Don't forget, Battle Hardended Shibes doesn't need to be activated, and Sneaky Trap " "requires a mention for it's target when activating.") event.msg.reply( "If you buy something, use !activate <ID> when you're ready to use it.", embed=embed)
def render_gear_attribute(self, gear_attribute): embed = MessageEmbed() key_names = ["type", "name", "Minimum_Total", "Mask", "Body_Armor", "Backpack", "Gloves", "Knee_Pads", "Holster", "Maximum_Total", "Max_With_Gear_Mods"] for key in gear_attribute.keys(): if key == 'name': embed.title = gear_attribute[key] elif key in key_names: val = gear_attribute[key] embed.add_field(name=key.replace("_", " "), value=val, inline=True) embed.color = 0xDA9513 return embed
def render_vendor_gear_mod(self, gearmod): embed = MessageEmbed() embed.title = gearmod['name'] embed.description = gearmod['vendor'] embed.add_field(name='Price', value=gearmod['price'], inline=True) embed.add_field(name='Stat', value=gearmod['stat'], inline=True) embed.add_field(name='Attribute', value=gearmod['attribute']) if gearmod['type'] == 'purple-mod': embed.color = 0x993D78 else: embed.color = 0xDA9513 return embed
def embed(self): e = MessageEmbed() e.color = self.color e.title = self.stream_title e.url = self.stream_url author = MessageEmbedAuthor() author.name = self.display_name author.url = self.stream_url author.icon_url = self.avatar e.author = author thumbnail = MessageEmbedThumbnail() thumbnail.url = self.avatar thumbnail.proxy_url = self.avatar thumbnail.width, thumbnail.height = 100, 100 e.thumbnail = thumbnail image = MessageEmbedImage() image.url = self.stream_preview + '?rand={}'.format(randint(0, 999999)) e.image = image footer = MessageEmbedFooter() footer.text = self.platform_name e.footer = footer if self.stream_game: game_field = MessageEmbedField() game_field.name = 'Played Game' game_field.value = self.stream_game game_field.inline = True e.fields.append(game_field) if self.stream_viewers_count or self.stream_viewers_count == 0: viewers_field = MessageEmbedField() viewers_field.name = 'Viewers' viewers_field.value = str(self.stream_viewers_count) viewers_field.inline = True e.fields.append(viewers_field) return e