def get_raid_embed(self, mon_id, start, end, move_1, move_2, lat, lon, gym_name, gym_img, level, form): start = datetime.fromtimestamp(start).strftime( self.bot.locale['time_format_hm']) end = datetime.fromtimestamp(end).strftime( self.bot.locale['time_format_hm']) #if len(gym_name) >= 30: # gym_name = gym_name[0:27] + "..." if not mon_id is None and mon_id > 0: mon_name = details.id(mon_id, self.bot.config['language']) mon_img = f"{self.bot.config['mon_icon_repo']}pokemon_icon_{str(mon_id).zfill(3)}_{str(form).zfill(2)}.png" if move_1 > self.bot.max_moves_in_list: move_1 = "?" else: move_1 = self.bot.moves[str(move_1)]["name"] if move_2 > self.bot.max_moves_in_list: move_2 = "?" else: move_2 = self.bot.moves[str(move_2)]["name"] if str(mon_id) in self.bot.forms: if str(form) in self.bot.forms[str(mon_id)]: mon_name = f"{self.bot.forms[str(mon_id)][str(form)]} {mon_name}" embed = discord.Embed( title=gym_name, description= f"{self.bot.locale['until']} **{end}**\n100%: **{self.bot.raidcp[f'{mon_id}_{form}']['max_cp_20']}** | **{self.bot.raidcp[f'{mon_id}_{form}']['max_cp_25']}**\n{self.bot.locale['moves']}: **{move_1}** | **{move_2}**\n\n[Google Maps](https://www.google.com/maps/search/?api=1&query={lat},{lon}) | [Apple Maps](https://maps.apple.com/maps?daddr={lat},{lon})" ) embed.set_thumbnail(url=gym_img) embed.set_author(name=mon_name, icon_url=mon_img) else: egg_name = f"{self.bot.locale['level']} {level} {self.bot.locale['egg']}" egg_img = f"{self.bot.config['emote_repo']}raid_egg_{level}.png" embed = discord.Embed( title=gym_name, description= f"{self.bot.locale['hatches_at']} **{start}**\n{self.bot.locale['lasts_until']} **{end}**\n\n[Google Maps](https://www.google.com/maps/search/?api=1&query={lat},{lon}) | [Apple Maps](https://maps.apple.com/maps?daddr={lat},{lon})" ) embed.set_thumbnail(url=gym_img) embed.set_author(name=egg_name, icon_url=egg_img) return embed
async def board_loop(self): for board in self.bot.boards['raids']: try: channel = await self.bot.fetch_channel(board["channel_id"]) message = await channel.fetch_message(board["message_id"]) area = get_area(board["area"]) text = "" raids = await queries.get_active_raids(self.bot.config, area[0], board["levels"], board["timezone"], board['ex']) if not raids: text = self.bot.locale["empty_board"] else: length = 0 for gym_id, start, end, lat, lon, mon_id, move_1, move_2, name, ex, level, gym_img, form in raids: end = datetime.fromtimestamp(end).strftime(self.bot.locale['time_format_hm']) if len(name) >= 30: name = name[0:27] + "..." ex_emote = "" if ex == 1: ex_emote = f"{self.bot.custom_emotes['ex_pass']} " form_letter = "" if str(mon_id) in self.bot.forms: if str(form) in self.bot.forms[str(mon_id)]: form_letter = f"{self.bot.forms[str(mon_id)][str(form)][0]} " if not mon_id is None and mon_id > 0: mon_name = details.id(mon_id, self.bot.config['language']) if move_1 > self.bot.max_moves_in_list: move_1 = "?" else: move_1 = self.bot.moves[str(move_1)]["name"] if move_2 > self.bot.max_moves_in_list: move_2 = "?" else: move_2 = self.bot.moves[str(move_2)]["name"] entry = f"{ex_emote}**{name}**: {self.bot.locale['until']} {end}\n**{mon_name}** {form_letter}- *{move_1} / {move_2}*\n\n" if length + len(entry) >= 2048: break else: text = text + entry length = length + len(entry) embed = discord.Embed(title=board['title'], description=text, timestamp=datetime.utcnow()) embed.set_footer(text=area[1]) await message.edit(embed=embed) await asyncio.sleep(board["wait"]) except Exception as err: print(err) print("Error while updating Raid Board. Skipping it.") await asyncio.sleep(5) for board in self.bot.boards['eggs']: try: channel = await self.bot.fetch_channel(board["channel_id"]) message = await channel.fetch_message(board["message_id"]) area = get_area(board["area"]) text = "" raids = await queries.get_active_raids(self.bot.config, area[0], board["levels"], board["timezone"], board['ex']) if not raids: text = self.bot.locale["empty_board"] else: length = 0 for gym_id, start, end, lat, lon, mon_id, move_1, move_2, name, ex, level, gym_img, form in raids: start = datetime.fromtimestamp(start).strftime(self.bot.locale['time_format_hm']) end = datetime.fromtimestamp(end).strftime(self.bot.locale['time_format_hm']) if len(name) >= 30: name = name[0:27] + "..." ex_emote = "" if ex == 1: ex_emote = f"{self.bot.custom_emotes['ex_pass']} " if mon_id is None or mon_id == 0: egg_emote = self.bot.custom_emotes[f"raid_egg_{level}"] entry = f"{egg_emote} {ex_emote}**{name}**: {start} – {end}\n" if length + len(entry) >= 2048: break else: text = text + entry length = length + len(entry) embed = discord.Embed(title=board['title'], description=text, timestamp=datetime.utcnow()) embed.set_footer(text=area[1]) await message.edit(embed=embed) await asyncio.sleep(board["wait"]) except Exception as err: print(err) print("Error while updating Egg Board. Skipping it.") await asyncio.sleep(5) for board in self.bot.boards['stats']: try: channel = await self.bot.fetch_channel(board["channel_id"]) message = await channel.fetch_message(board["message_id"]) area = get_area(board["area"]) text = "" if "mon_active" in board['type']: mon_active = await queries.statboard_mon_active(self.bot.config, area[0]) if not "mon_today" in board['type']: text = f"{text}{self.bot.custom_emotes['pokeball']} **{mon_active[0][0]:,}** {self.bot.locale['active_pokemon']}\n\n" if "mon_today" in board['type']: mon_today = await queries.statboard_mon_today(self.bot.config, area[0]) if "mon_active" in board['type']: text = f"{text}{self.bot.custom_emotes['pokeball']} **{mon_active[0][0]:,}** {self.bot.locale['active_pokemon']} | **{mon_today[0][0]:,}** {self.bot.locale['today']}\n\n" else: text = f"{text}{self.bot.custom_emotes['pokeball']} **{mon_today[0][0]:,}** {self.bot.locale['pokemon_seen_today']}\n\n" if "gym_amount" in board['type']: gym_amount = await queries.statboard_gym_amount(self.bot.config, area[0]) text = f"{text}{self.bot.custom_emotes['gym_white']} **{gym_amount[0][0]:,}** {self.bot.locale['total_gyms']}\n" if "raid_active" in board['type']: raid_active = await queries.statboard_raid_active(self.bot.config, area[0]) if not "egg_active" in board['type']: text = f"{text}{self.bot.custom_emotes['raid']} **{raid_active[0][0]:,}** {self.bot.locale['active_raids']}\n" if "egg_active" in board['type']: egg_active = await queries.statboard_egg_active(self.bot.config, area[0]) if "raid_active" in board['type']: text = f"{text}{self.bot.custom_emotes['raid']} **{raid_active[0][0]:,}** {self.bot.locale['active_raids']} | **{egg_active[0][0]:,}** {self.bot.locale['eggs']}\n" else: text = f"{text}{self.bot.custom_emotes['raid_egg_1']} **{egg_active[0][0]:,}** {self.bot.locale['active_eggs']}\n" if "gym_teams" in board['type']: gym_teams = await queries.statboard_gym_teams(self.bot.config, area[0]) text = f"{text}{self.bot.custom_emotes['gym_blue']}**{gym_teams[0][1]}**{self.bot.custom_emotes['blank']}{self.bot.custom_emotes['gym_red']}**{gym_teams[0][2]}**{self.bot.custom_emotes['blank']}{self.bot.custom_emotes['gym_yellow']}**{gym_teams[0][3]}**\n" if "stop_amount" in board['type']: stop_amount = await queries.statboard_stop_amount(self.bot.config, area[0]) text = f"{text}\n{self.bot.custom_emotes['pokestop']} **{stop_amount[0][0]:,}** {self.bot.locale['total_stops']}\n" if "quest_active" in board['type']: quest_active = await queries.statboard_quest_active(self.bot.config, area[0]) text = f"{text}🔎 **{quest_active[0][0]:,}** {self.bot.locale['quests']}" if "stop_amount" in board['type']: quest_ratio = int(round((quest_active[0][0] / stop_amount[0][0] * 100), 0)) text = f"{text} ({quest_ratio}%)" text = text + "\n" if "grunt_active" in board['type']: grunt_active = await queries.statboard_grunt_active(self.bot.config, area[0]) if not "leader_active" in board['type']: text = f"{text}{self.bot.custom_emotes['grunt_female']} **{grunt_active[0][0]:,}** {self.bot.locale['active_grunts']}" if "leader_active" in board['type']: leader_active = await queries.statboard_leader_active(self.bot.config, area[0]) if "grunt_active" in board['type']: text = f"{text}{self.bot.custom_emotes['grunt_female']} **{grunt_active[0][0]:,}** {self.bot.locale['grunts']} | {self.bot.custom_emotes['cliff']} **{leader_active[0][0]:,}** {self.bot.locale['leaders']}" else: text = f"{text}{self.bot.custom_emotes['cliff']} **{leader_active[0][0]:,}** {self.bot.locale['leaders']}" embed = discord.Embed(title=board['title'], description=text.replace(",", self.bot.locale['decimal_comma']), timestamp=datetime.utcnow()) embed.set_footer(text=area[1]) await message.edit(embed=embed) await asyncio.sleep(board["wait"]) except Exception as err: print(err) print("Error while updating Stat Board. Skipping it.") await asyncio.sleep(5)
async def board_loop(): while not bot.is_closed(): for board in boards['raids']: channel = await bot.fetch_channel(board["channel_id"]) message = await channel.fetch_message(board["message_id"]) area = get_area(board["area"]) text = "" raids = await queries.get_active_raids(config, area[0], board["levels"], board["timezone"]) if not raids: text = locale["empty_board"] else: for start, end, lat, lon, mon_id, move_1, move_2, name, ex, level in islice( raids, 21): end = datetime.fromtimestamp(end).strftime( locale['time_format_hm']) ex_emote = "" if ex == 1: ex_emote = f"{custom_emotes['ex_pass']} " if not mon_id is None and mon_id > 0: mon_name = details.id(mon_id, config['language']) if move_1 > MAX_MOVE_IN_LIST: move_1 = "?" else: move_1 = moves[str(move_1)]["name"] if move_2 > MAX_MOVE_IN_LIST: move_2 = "?" else: move_2 = moves[str(move_2)]["name"] text = text + f"{ex_emote}**{name}**: {locale['until']} {end}\n**{mon_name}** - *{move_1} / {move_2}*\n\n" embed = discord.Embed(title=locale['raids'], description=text, timestamp=datetime.utcnow()) embed.set_footer(text=area[1]) await message.edit(embed=embed) await asyncio.sleep(board["wait"]) await asyncio.sleep(5) for board in boards['eggs']: channel = await bot.fetch_channel(board["channel_id"]) message = await channel.fetch_message(board["message_id"]) area = get_area(board["area"]) text = "" raids = await queries.get_active_raids(config, area[0], board["levels"], board["timezone"]) if not raids: text = locale["empty_board"] else: for start, end, lat, lon, mon_id, move_1, move_2, name, ex, level in islice( raids, 23): start = datetime.fromtimestamp(start).strftime( locale['time_format_hm']) end = datetime.fromtimestamp(end).strftime( locale['time_format_hm']) ex_emote = "" if ex == 1: ex_emote = f"{custom_emotes['ex_pass']} " if mon_id is None or mon_id == 0: egg_emote = custom_emotes[f"raid_egg_{level}"] text = text + f"{egg_emote} {ex_emote}**{name}**: {start} – {end}\n" embed = discord.Embed(title=locale['eggs'], description=text, timestamp=datetime.utcnow()) embed.set_footer(text=area[1]) await message.edit(embed=embed) await asyncio.sleep(board["wait"])
async def board_loop(self): for board in self.bot.boards['raids']: try: channel = await self.bot.fetch_channel(board["channel_id"]) message = await channel.fetch_message(board["message_id"]) area = get_area(board["area"]) text = "" raids = await queries.get_active_raids(self.bot.config, area[0], board["levels"], board["timezone"], board['ex']) if not raids: text = self.bot.locale["empty_board"] else: length = 0 for gym_id, start, end, lat, lon, mon_id, move_1, move_2, name, ex, level, gym_img, form in raids: end = datetime.fromtimestamp(end).strftime( self.bot.locale['time_format_hm']) if len(name) >= 30: name = name[0:27] + "..." ex_emote = "" if ex == 1: ex_emote = f"{self.bot.custom_emotes['ex_pass']} " form_letter = "" if str(mon_id) in self.bot.forms: if str(form) in self.bot.forms[str(mon_id)]: form_letter = f"{self.bot.forms[str(mon_id)][str(form)][0]} " if not mon_id is None and mon_id > 0: mon_name = details.id(mon_id, self.bot.config['language']) if move_1 > self.bot.max_moves_in_list: move_1 = "?" else: move_1 = self.bot.moves[str(move_1)]["name"] if move_2 > self.bot.max_moves_in_list: move_2 = "?" else: move_2 = self.bot.moves[str(move_2)]["name"] entry = f"{ex_emote}**{name}**: {self.bot.locale['until']} {end}\n**{mon_name}** {form_letter}- *{move_1} / {move_2}*\n\n" if length + len(entry) >= 2048: break else: text = text + entry length = length + len(entry) embed = discord.Embed(title=board['title'], description=text, timestamp=datetime.utcnow()) embed.set_footer(text=area[1]) await message.edit(embed=embed) await asyncio.sleep(board["wait"]) except Exception as err: print(err) print("Error while updating Raid Board. Skipping it.") await asyncio.sleep(5) for board in self.bot.boards['eggs']: try: channel = await self.bot.fetch_channel(board["channel_id"]) message = await channel.fetch_message(board["message_id"]) area = get_area(board["area"]) text = "" raids = await queries.get_active_raids(self.bot.config, area[0], board["levels"], board["timezone"], board['ex']) if not raids: text = self.bot.locale["empty_board"] else: length = 0 for gym_id, start, end, lat, lon, mon_id, move_1, move_2, name, ex, level, gym_img, form in raids: start = datetime.fromtimestamp(start).strftime( self.bot.locale['time_format_hm']) end = datetime.fromtimestamp(end).strftime( self.bot.locale['time_format_hm']) if len(name) >= 30: name = name[0:27] + "..." ex_emote = "" if ex == 1: ex_emote = f"{self.bot.custom_emotes['ex_pass']} " if mon_id is None or mon_id == 0: egg_emote = self.bot.custom_emotes[ f"raid_egg_{level}"] entry = f"{egg_emote} {ex_emote}**{name}**: {start} – {end}\n" if length + len(entry) >= 2048: break else: text = text + entry length = length + len(entry) embed = discord.Embed(title=board['title'], description=text, timestamp=datetime.utcnow()) embed.set_footer(text=area[1]) await message.edit(embed=embed) await asyncio.sleep(board["wait"]) except Exception as err: print(err) print("Error while updating Egg Board. Skipping it.") await asyncio.sleep(5) for board in self.bot.boards['stats']: try: channel = await self.bot.fetch_channel(board["channel_id"]) message = await channel.fetch_message(board["message_id"]) area = get_area(board["area"]) text = "" if self.bot.config['use_alt_table_for_pokemon']: oldest_mon_date = await queries.get_oldest_mon_date( self.bot.config) date_today = datetime.now().replace(hour=0, minute=0, second=0, microsecond=0) now_minus_60_min = datetime.now() - timedelta(minutes=60) if "mon_active" in board['type']: mon_active = await queries.statboard_mon_active( self.bot.config, area[0]) if self.bot.config[ 'use_alt_table_for_pokemon'] and oldest_mon_date > now_minus_60_min: alt_mon_active = await queries.statboard_mon_active( self.bot.config, area[0], use_alt_table=True) mon_active = ((mon_active[0][0] + alt_mon_active[0][0], ), ) if not "mon_today" in board['type']: text = f"{text}{self.bot.custom_emotes['pokeball']} **{mon_active[0][0]:,}** {self.bot.locale['active_pokemon']}\n\n" if "mon_today" in board['type']: mon_today = await queries.statboard_mon_today( self.bot.config, area[0]) if self.bot.config[ 'use_alt_table_for_pokemon'] and oldest_mon_date > date_today: alt_mon_today = await queries.statboard_mon_today( self.bot.config, area[0], use_alt_table=True) mon_today = ((mon_today[0][0] + alt_mon_today[0][0], ), ) if "mon_active" in board['type']: text = f"{text}{self.bot.custom_emotes['pokeball']} **{mon_active[0][0]:,}** {self.bot.locale['active_pokemon']} | **{mon_today[0][0]:,}** {self.bot.locale['today']}\n\n" else: text = f"{text}{self.bot.custom_emotes['pokeball']} **{mon_today[0][0]:,}** {self.bot.locale['pokemon_seen_today']}\n\n" if "scanned_active" in board['type']: scanned_active = await queries.statboard_scanned_active( self.bot.config, area[0]) if not "mon_active" in board['type']: mon_active = await queries.statboard_mon_active( self.bot.config, area[0]) if self.bot.config[ 'use_alt_table_for_pokemon'] and oldest_mon_date > now_minus_60_min: alt_scanned_active = await queries.statboard_scanned_active( self.bot.config, area[0], use_alt_table=True) scanned_active = ((scanned_active[0][0] + alt_scanned_active[0][0], ), ) if not "mon_active" in board['type']: alt_mon_active = await queries.statboard_mon_active( self.bot.config, area[0], use_alt_table=True) mon_active = ((mon_active[0][0] + alt_mon_active[0][0], ), ) if scanned_active[0][0] == 0: scanned_active_ratio = 0 else: scanned_active_ratio = int( round((scanned_active[0][0] / mon_active[0][0] * 100), 0)) if not "scanned_today" in board['type']: text = f"{text}{self.bot.locale['scanned']}: **{scanned_ratio}%** {self.bot.locale['active']}\n" if "scanned_today" in board['type']: scanned_today = await queries.statboard_scanned_today( self.bot.config, area[0]) if not "mon_today" in board['type']: mon_today = await queries.statboard_mon_today( self.bot.config, area[0]) if self.bot.config[ 'use_alt_table_for_pokemon'] and oldest_mon_date > date_today: alt_scanned_today = await queries.statboard_scanned_today( self.bot.config, area[0], use_alt_table=True) scanned_today = ((scanned_today[0][0] + alt_scanned_today[0][0], ), ) if not "mon_today" in board['type']: alt_mon_today = await queries.statboard_mon_today( self.bot.config, area[0], use_alt_table=True) mon_today = ((mon_today[0][0] + alt_mon_today[0][0], ), ) if mon_today[0][0] == 0: scanned_today_ratio = 0 else: scanned_today_ratio = int( round( (scanned_today[0][0] / mon_today[0][0] * 100), 0)) if "scanned_active" in board['type']: text = f"{text}{self.bot.locale['scanned']}: **{scanned_active_ratio}%** {self.bot.locale['active']} | **{scanned_today_ratio}%** {self.bot.locale['today']}\n" else: text = f"{text}{self.bot.locale['scanned']} {self.bot.locale['today']}: **{scanned_today_ratio}%**\n" if "average_iv_active" in board['type']: total_iv_active = await queries.statboard_total_iv_active( self.bot.config, area[0]) if not "scanned_active" in board[ 'type']: #query for active scanned mons wont run twice if scanned_active in board scanned_active = await queries.statboard_scanned_active( self.bot.config, area[0]) if self.bot.config[ 'use_alt_table_for_pokemon'] and oldest_mon_date > now_minus_60_min: alt_total_iv_active = await queries.statboard_total_iv_active( self.bot.config, area[0], use_alt_table=True) total_iv_active = ((total_iv_active[0][0] + alt_total_iv_active[0][0], ), ) if not "scanned_active" in board['type']: alt_scanned_active = await queries.statboard_scanned_active( self.bot.config, area[0], use_alt_table=True) scanned_active = ((scanned_active[0][0] + alt_scanned_active[0][0], ), ) if scanned_active[0][0] == 0: average_iv_active = 0 else: average_iv_active = round( (total_iv_active[0][0] / scanned_active[0][0]), 1) if not "average_iv_today" in board['type']: text = f"{text}{self.bot.locale['average_iv_of_active_mons']}: **{average_iv_active}%** {self.bot.locale['active']}\n" if "average_iv_today" in board['type']: total_iv_today = await queries.statboard_total_iv_today( self.bot.config, area[0]) if not "scanned_today" in board[ 'type']: #query for today scanned mons wont run twice if scanned_today in board scanned_today = await queries.statboard_scanned_today( self.bot.config, area[0]) if self.bot.config[ 'use_alt_table_for_pokemon'] and oldest_mon_date > date_today: alt_total_iv_today = await queries.statboard_total_iv_today( self.bot.config, area[0], use_alt_table=True) total_iv_today = ((total_iv_today[0][0] + alt_total_iv_today[0][0], ), ) if not "scanned_today" in board['type']: alt_scanned_today = await queries.statboard_scanned_today( self.bot.config, area[0], use_alt_table=True) scanned_today = ((scanned_today[0][0] + alt_scanned_today[0][0], ), ) if scanned_today[0][0] == 0: average_iv_today = 0 else: average_iv_today = round( (total_iv_today[0][0] / scanned_today[0][0]), 1) if "average_iv_active" in board['type']: text = f"{text}{self.bot.locale['average_iv']}: **{average_iv_active}%** {self.bot.locale['active']} | **{average_iv_today}%** {self.bot.locale['today']}\n" else: text = f"{text}{self.bot.locale['average_iv']} {self.bot.locale['today']}: **{average_iv_active}%**\n" if "hundos_active" in board['type']: hundos_active = await queries.statboard_hundos_active( self.bot.config, area[0]) if self.bot.config[ 'use_alt_table_for_pokemon'] and oldest_mon_date > now_minus_60_min: alt_hundos_active = await queries.statboard_hundos_active( self.bot.config, area[0], use_alt_table=True) hundos_active = ((hundos_active[0][0] + alt_hundos_active[0][0], ), ) if not "hundos_today" in board['type']: text = f"{text}{self.bot.locale['hundos']}: **{hundos_active[0][0]:,}** {self.bot.locale['active']}\n" if "hundos_today" in board['type']: hundos_today = await queries.statboard_hundos_today( self.bot.config, area[0]) if self.bot.config[ 'use_alt_table_for_pokemon'] and oldest_mon_date > date_today: alt_hundos_today = await queries.statboard_hundos_today( self.bot.config, area[0], use_alt_table=True) hundos_today = ((hundos_today[0][0] + alt_hundos_today[0][0], ), ) if "hundos_active" in board['type']: text = f"{text}{self.bot.locale['hundos']}: **{hundos_active[0][0]:,}** {self.bot.locale['active']} | **{hundos_today[0][0]:,}** {self.bot.locale['today']}\n" else: text = f"{text}{self.bot.locale['hundos']} {self.bot.locale['today']}: **{hundos_today[0][0]:,}**\n" if "iv0_active" in board['type']: iv0_active = await queries.statboard_iv0_active( self.bot.config, area[0]) if self.bot.config[ 'use_alt_table_for_pokemon'] and oldest_mon_date > now_minus_60_min: alt_iv0_active = await queries.statboard_iv0_active( self.bot.config, area[0], use_alt_table=True) iv0_active = ((iv0_active[0][0] + alt_iv0_active[0][0], ), ) if not "iv0_today" in board['type']: text = f"{text}{self.bot.locale['0']}: **{iv0_active[0][0]:,}** {self.bot.locale['active']}\n" if "iv0_today" in board['type']: iv0_today = await queries.statboard_iv0_today( self.bot.config, area[0]) if self.bot.config[ 'use_alt_table_for_pokemon'] and oldest_mon_date > date_today: alt_iv0_today = await queries.statboard_iv0_today( self.bot.config, area[0], use_alt_table=True) iv0_today = ((iv0_today[0][0] + alt_iv0_today[0][0], ), ) if "iv0_active" in board['type']: text = f"{text}{self.bot.locale['0']}: **{iv0_active[0][0]:,}** {self.bot.locale['active']} | **{iv0_today[0][0]:,}** {self.bot.locale['today']}\n" else: text = f"{text}{self.bot.locale['0']} {self.bot.locale['today']}: **{hundos_today[0][0]:,}**\n" if "gym_amount" in board['type']: gym_amount = await queries.statboard_gym_amount( self.bot.config, area[0]) text = f"{text}\n{self.bot.custom_emotes['gym_grey']} **{gym_amount[0][0]:,}** {self.bot.locale['total_gyms']}\n" if "gym_teams" in board['type']: gym_teams = await queries.statboard_gym_teams( self.bot.config, area[0]) text = f"{text}{self.bot.custom_emotes['gym_blue']}**{gym_teams[0][1]}**{self.bot.custom_emotes['blank']}{self.bot.custom_emotes['gym_red']}**{gym_teams[0][2]}**{self.bot.custom_emotes['blank']}{self.bot.custom_emotes['gym_yellow']}**{gym_teams[0][3]}**{self.bot.custom_emotes['blank']}{self.bot.custom_emotes['gym_white']}**{gym_teams[0][0]}**\n\n" if ("raid_active" or "raid_lvl_1_active" or "raid_lvl_2_active" or "raid_lvl_3_active" or "raid_lvl_4_active" or "raid_lvl_5_active") in board['type']: raid_active = await queries.statboard_raid_active( self.bot.config, area[0]) if "raid_active" in board[ 'type'] and not "egg_active" in board['type']: text = f"{text}{self.bot.custom_emotes['raid']} **{raid_active[0][0]:,}** {self.bot.locale['active_raids']}\n" if "raid_lvl_5_active" in board[ 'type'] and not "egg_lvl_5_active" in board['type']: text = f"{text}5⭐ **{raid_active[0][5]:,}** {self.bot.locale['raids']}\n" if "raid_lvl_4_active" in board[ 'type'] and not "egg_lvl_4_active" in board['type']: text = f"{text}4⭐ **{raid_active[0][4]:,}** {self.bot.locale['raids']}\n" if "raid_lvl_3_active" in board[ 'type'] and not "egg_lvl_3_active" in board['type']: text = f"{text}3⭐ **{raid_active[0][3]:,}** {self.bot.locale['raids']}\n" if "raid_lvl_2_active" in board[ 'type'] and not "egg_lvl_2_active" in board['type']: text = f"{text}2⭐ **{raid_active[0][2]:,}** {self.bot.locale['raids']}\n" if "raid_lvl_1_active" in board[ 'type'] and not "egg_lvl_1_active" in board['type']: text = f"{text}1⭐ **{raid_active[0][1]:,}** {self.bot.locale['raids']}\n" if ("egg_active" or "egg_lvl_1_active" or "egg_lvl_2_active" or "egg_lvl_3_active" or "egg_lvl_4_active" or "egg_lvl_5_active") in board['type']: egg_active = await queries.statboard_egg_active( self.bot.config, area[0]) if "raid_active" in board['type']: text = f"{text}{self.bot.custom_emotes['raid']} **{raid_active[0][0]:,}** {self.bot.locale['active_raids']} | **{egg_active[0][0]:,}** {self.bot.locale['eggs']}\n" elif "egg_active" in board['type']: text = f"{text}{self.bot.custom_emotes['raid_egg_1']} **{egg_active[0][0]:,}** {self.bot.locale['active_eggs']}\n" if "raid_lvl_5_active" in board['type']: text = f"{text}5⭐: **{raid_active[0][5]:,}** {self.bot.locale['raids']} | **{egg_active[0][5]:,}** {self.bot.locale['eggs']}\n" elif "egg_lvl_5_active" in board['type']: text = f"{text}{self.bot.custom_emotes['raid_egg_5']} **{egg_active[0][5]:,}** {self.bot.locale['active_eggs']}\n" if "raid_lvl_4_active" in board['type']: text = f"{text}4⭐: **{raid_active[0][4]:,}** {self.bot.locale['raids']} | **{egg_active[0][4]:,}** {self.bot.locale['eggs']}\n" elif "egg_lvl_4_active" in board['type']: text = f"{text}{self.bot.custom_emotes['raid_egg_4']} **{egg_active[0][4]:,}** {self.bot.locale['active_eggs']}\n" if "raid_lvl_3_active" in board['type']: text = f"{text}3⭐: **{raid_active[0][3]:,}** {self.bot.locale['raids']} | **{egg_active[0][3]:,}** {self.bot.locale['eggs']}\n" elif "egg_lvl_3_active" in board['type']: text = f"{text}{self.bot.custom_emotes['raid_egg_3']} **{egg_active[0][3]:,}** {self.bot.locale['active_eggs']}\n" if "raid_lvl_2_active" in board['type']: text = f"{text}2⭐: **{raid_active[0][2]:,}** {self.bot.locale['raids']} | **{egg_active[0][2]:,}** {self.bot.locale['eggs']}\n" elif "egg_lvl_2_active" in board['type']: text = f"{text}{self.bot.custom_emotes['raid_egg_2']} **{egg_active[0][2]:,}** {self.bot.locale['active_eggs']}\n" if "raid_lvl_1_active" in board['type']: text = f"{text}1⭐: **{raid_active[0][1]:,}** {self.bot.locale['raids']} | **{egg_active[0][1]:,}** {self.bot.locale['eggs']}\n" elif "egg_lvl_2_active" in board['type']: text = f"{text}{self.bot.custom_emotes['raid_egg_1']} **{egg_active[0][1]:,}** {self.bot.locale['active_eggs']}\n" if "stop_amount" in board['type']: stop_amount = await queries.statboard_stop_amount( self.bot.config, area[0]) text = f"{text}\n{self.bot.custom_emotes['pokestop']} **{stop_amount[0][0]:,}** {self.bot.locale['total_stops']}\n" if "quest_active" in board['type']: quest_active = await queries.statboard_quest_active( self.bot.config, area[0]) text = f"{text}🔎 **{quest_active[0][0]:,}** {self.bot.locale['quests']}" if "stop_amount" in board['type']: quest_ratio = int( round( (quest_active[0][0] / stop_amount[0][0] * 100), 0)) text = f"{text} ({quest_ratio}%)" text = text + "\n\n" if "lure_amount" in board['type']: lure_active = await queries.statboard_lure_active( self.bot.config, area[0]) text = f"{text}{self.bot.custom_emotes['lure']} **{lure_active[0][0]:,}** {self.bot.locale['active_lures']}\n" if "lure_types" in board['type']: if not "lure_amount" in board[ 'type']: #query wont run twice lure_active = await queries.statboard_gym_teams( self.bot.config, area[0]) text = f"{text}{self.bot.custom_emotes['lure_normal']}**{lure_active[0][1]}**{self.bot.custom_emotes['blank']}{self.bot.custom_emotes['lure_glacial']}**{lure_active[0][2]}**{self.bot.custom_emotes['blank']}{self.bot.custom_emotes['lure_mossy']}**{lure_active[0][3]}**{self.bot.custom_emotes['blank']}{self.bot.custom_emotes['lure_magnetic']}**{lure_active[0][4]}**\n\n" if "grunt_active" in board['type']: grunt_active = await queries.statboard_grunt_active( self.bot.config, area[0]) if not "leader_active" in board['type']: text = f"{text}{self.bot.custom_emotes['grunt_female']} **{grunt_active[0][0]:,}** {self.bot.locale['active_grunts']}" if "leader_active" in board['type']: leader_active = await queries.statboard_leader_active( self.bot.config, area[0]) if "grunt_active" in board['type']: text = f"{text}{self.bot.custom_emotes['grunt_female']} **{grunt_active[0][0]:,}** {self.bot.locale['grunts']} | {self.bot.custom_emotes['cliff']} **{leader_active[0][0]:,}** {self.bot.locale['leaders']}" else: text = f"{text}{self.bot.custom_emotes['cliff']} **{leader_active[0][0]:,}** {self.bot.locale['leaders']}" embed = discord.Embed(title=board['title'], description=text.replace( ",", self.bot.locale['decimal_comma']), timestamp=datetime.utcnow()) embed.set_footer(text=area[1]) await message.edit(embed=embed) await asyncio.sleep(board["wait"]) except Exception as err: print(err) print("Error while updating Stat Board. Skipping it.") await asyncio.sleep(5)