async def get_events_embed(self, ctx, events): embed = Embed(self.bot, ctx.author, title="All Timed Events", description="'on:' is utc+0") await embed.set_made_with_love_footer() for event in events: event_in, event_on = self.get_times(event) embed.add_field(name=event.event_name, value=f"In: {event_in}\nOn: {event_on}", inline=False) return embed
async def get_list_embed(self, ctx, expanded=False): staff = is_staff(ctx) list_embed = Embed(title="Categories", bot=self.bot, user=ctx.author) list_embed.set_author(name=f"Use {ctx.prefix}help [Command/Category]") await list_embed.set_requested_by_footer() for name, cog in self.bot.cogs.items(): if name == "Admin" or name == "Help": continue if not cog.get_commands(): continue commands = [] for command in cog.get_commands(): if has_is_staff(command) and not staff: continue if hasattr(command, "commands") and expanded: sub_cmds = [command.name for command in command.commands if not has_is_staff(command) or staff] if sub_cmds: commands.append(f"`{command.name}` *({'*, *'.join(sub_cmds)})*") else: commands.append(f"`{command.name}`") else: commands.append(f"`{command.name}`") list_embed.add_field(name=name, value=", ".join(commands), inline=False) list_embed.add_field(name="Links", value="[Contribute](https://discord.gg/zqRsduD2JN) | [Vote](https://top.gg/bot/630106665387032576/vote) | [Invite the Bot to your server](https://discordapp.com/oauth2/authorize?client_id=630106665387032576&scope=bot%20applications.commands&permissions=8) | [Support Server](https://discord.gg/7fPv2uY2Tf) | [Todos](https://trello.com/b/2yBAtx82/skybot-rewrite) | [GitHub repo](https://github.com/Skybot-dev/Skybot-rewrite)", inline=False) return list_embed
async def shop(self, ctx): """Fun|See the shop. Buy or leave?|""" emb_links_perm = ctx.channel.permissions_for(ctx.me).embed_links if not emb_links_perm: return await ctx.send( "I need the `embed_links` permission to show you the shop.") # xpu = await funx.get_xp(u.id) # lv = funx.get_lvl(xpu) page_1 = Embed().make_emb( title="[Coin Shop] >>> Amathy sells:", desc="The following can be bought with coins.", footer="Page 1/2 - To buy something, type a buy [item]") page_2 = Embed().make_emb( title="[Gem Shop] >>> Amathy sells:", desc="The following can be bought with gems.", footer="Page 2/2 - To buy something, type a buy [item]") for item in self.shop: price = item["price"] # if lv > 0: # price = price * lv curr = item["currency"] field = " | ".join(item["name"]) field_str = self.bot.funx.group_digit(price) if curr == "coins": page_1.add_field(name=field, value=f"{field_str} coins", inline=True) else: page_2.add_field(name=field, value=f"{field_str} gems", inline=True) await self.bot.funx.embed_menu(ctx, [page_1, page_2])
async def xp(self, ctx): """Info|Shows the top 10 people with the highest level & XP.|""" script = "select user_id, xp from amathy.stats" data = await self.bot.funx.fetch_many(script) top = dict() for elem in data: user_id, xp = elem top[user_id] = xp sorted_top = sorted(top, key=top.get, reverse=True) emb = Embed().make_emb( "Global top - Level & XP", "To get xp, use commands or vote for me ([here](https://tiny.cc/voteama))." ) max_range = 10 if len(sorted_top) < max_range: max_range = len(sorted_top) for index in range(0, max_range): user_id = sorted_top[index] xp = top[user_id] lvl = Level().from_xp(xp) xp = self.bot.funx.group_digit(xp) if user_id == ctx.author.id: text = "Author position >>> No. {}: {} - Level {} - {} XP <<<" emb.set_footer(text=text.format(index + 1, ctx.author.name, lvl, xp)) user = self.bot.get_user(user_id) if user: emb.add_field(name=f"No. {index + 1}: {user.name}", value=f"Level {lvl} - {xp} XP") await ctx.send(embed=emb)
async def coins(self, ctx): """Info|Shows the top 10 people with the most MC.|""" script = "select user_id, pocket, bank from amathy.coins" data = await self.bot.funx.fetch_many(script) top = dict() for elem in data: user_id, pocket, bank = elem top[user_id] = pocket + bank sorted_top = sorted(top, key=top.get, reverse=True) emb = Embed().make_emb( "Global top - MC", "To get coins, use `a daily` or vote for me ([here](https://tiny.cc/voteama))." ) max_range = 10 if len(sorted_top) < max_range: max_range = len(sorted_top) for index in range(0, max_range): user_id = sorted_top[index] coins = self.bot.funx.group_digit(top[user_id]) if user_id == ctx.author.id: text = "Author position >>> No. {}: {} - {} MC <<<" emb.set_footer(text=text.format(index + 1, ctx.author.name, coins)) user = self.bot.get_user(user_id) if user: emb.add_field(name="No. {}: {}".format(index + 1, user.name), value="{} {}".format(coins, self.mc_emoji)) await ctx.send(embed=emb)
async def usagestats(self, ctx, arg=None): usagestats = self.bot.admin_db["usagestats"] if arg and arg.lower() == "reset": async for cmd in usagestats.find({}): await usagestats.update_one(cmd, {"$set": {"uses": 0}}) doc = await usagestats.find_one({"name": "last_reset"}) if doc and "date" in doc.keys(): await usagestats.update_one({"name": "last_reset"}, {"$currentDate": { "date": False }}) else: await usagestats.insert_one({"name": "last_reset", "date": 0}) await usagestats.update_one({"name": "last_reset"}, {"$currentDate": { "date": False }}) return await ctx.send("Reset usage stats.") embed = Embed(self.bot, ctx.author, title="Command Usage Stats") await embed.set_requested_by_footer() async for cmd in usagestats.find({}): if cmd["name"] != "last_reset": embed.add_field(name=cmd["name"].capitalize(), value="Uses: " + str(cmd["uses"])) else: embed.add_field(name="Last reset", value=str(cmd["date"])[:-7]) await ctx.send(embed=embed)
async def get_skills_embed(self, ctx, player): player.load_skills_slayers(False) if not player.enabled_api["skills"]: return await Embed( self.bot, ctx.author, title="Error", description= "Your skills API is disabled. Please enable it and try again." ).set_requested_by_footer() name = self.format_name(player.uname) embed = Embed( self.bot, ctx.author, title=f"{name} Skills on {player.profile_name}", description=f"Average skill level: {player.skill_average}") await embed.set_requested_by_footer() for name, level in player.skills.items(): embed.add_field( name=f"{skill_icons[name]} {name.capitalize()} Level", value= f"**LEVEL {level}**\n{player.skill_xp[name]:,}XP total\n{player.skills_needed_xp[name]:,}XP to next level" ) return embed
async def get_info_embed(self, ctx, user, user_db, linked=True): player: skypy.Player = await skypy.Player(keys=self.bot.api_keys, uuid=user_db["uuid"]) if "profile_id" in user_db.keys( ) and user_db["profile_id"] in player.profiles.values(): for k, v in player.profiles.items(): if v == user_db["profile_id"]: profile = k break else: profile = None embed = Embed(title=str(user) + " <=> " + player.uname, bot=self.bot, user=ctx.author) await embed.set_requested_by_footer() scammer = bool(await self.bot.scammer_db["scammer_list"].find_one( {"_id": user_db["uuid"]})) embed.add_field( name="General Information", value= f"Discord username: `{str(user)}`\nMc username: `{player.uname}`\nUUID: `{player.uuid}`\nLinked to Bot: `{linked}`", inline=False) embed.add_field( name="Advanced Information", value=f"Profile(s): `{', '.join(player.profiles.keys())}`\n\ Default Profile: `{profile}`\nScammer: `{scammer}`\nVerified: `{user_db['verified']}`", inline=False) return embed
async def get_event_embed(self): embed = Embed(self.bot, None, title="Timed Events") await embed.set_patron_footer() for event in self.bot.events: event.update_without_api() embed.add_field(name=event.event_name, value=f"Event in:\n**{str(event.event_in)[:-7]}**") return embed
async def invite(self, ctx): embed = Embed(title="Invite the bot to your server", bot=self.bot, user=ctx.author) embed.add_field( name="--------------------------------", value= f"The bot already is on {len(self.bot.guilds)} Guilds!\n[Click Here to invite the Bot]({self.bot.config['bot_invite']})" ) await embed.set_made_with_love_footer() await ctx.send(embed=embed)
async def check(self, ctx, username: str): name, uuid = await fetch_uuid_uname(username) cs = aiohttp.ClientSession() jerry_resp = await cs.get( "https://raw.githubusercontent.com/skyblockz/pricecheckbot/master/scammer.json" ) jerry_data = await json.loads(await jerry_resp.text()) if not uuid: return await ctx.send("Could not find that username") scammer = await self.bot.scammer_db["scammer_list"].find_one( {"_id": uuid}) if not scammer and uuid not in jerry_data: embed = Embed( title="Safe", description= "This user is not in our database or the jerry database as a scammer. Proceed with caution", bot=self.bot, user=ctx.author) embed.color = 0x00FF00 await embed.set_requested_by_footer() return await ctx.send(embed=embed) if uuid in jerry_data: scam = jerry_data[uuid] embed = Embed( title="SCAMMER", description= "This user has been found on the Jerry Scammer List! Do not trade with this user!" ) embed.add_field(name="Details", value=f"""**Reason:** {scam['reason']} **User's UUID:** {uuid} **DISCLAIMER:** This report has not been handled by us! This report has been provided by SkyBlockZ/Jerry the Skyblock Bot so it may not be 100% accurate!""" ) embed.set_author( name=f"JERRY SCAMMER LIST", url= "https://raw.githubusercontent.com/skyblockz/pricecheckbot/master/scammer.json" ) embed.set_footer(text=f"Added by: {scam[uuid]['operated_staff']}") embed.color = 0xff0000 return await ctx.send(embed=embed) if scammer["report_id"] and not scammer["anonymous"]: report = await self.bot.scammer_db["reports"].find_one( {"_id": scammer["report_id"]}) if not report["anonymous"]: footer_text = f"reported by {report['reporter']}, confirmed by {scammer['mod']}" else: footer_text = f"reported anonymously, confirmed by {scammer['mod']}" else: footer_text = f"added by {scammer['mod']}" embed = discord.Embed(title="SCAMMER", description=scammer["reason"], color=0xff0000).set_footer(text=footer_text) await ctx.send(embed=embed)
async def serverinfo(self, ctx, guild : discord.Guild=None): if not guild: guild = ctx.guild if not guild: return await ctx.send("Guild not found") embed = Embed(self.bot, ctx.author, title=guild.name) await embed.set_requested_by_footer() for setting in self.settings: info = await self.get_info(ctx, guild, setting) embed.add_field(name=setting.capitalize(), value=info) await ctx.send(embed=embed)
async def changelog_embed(self, ctx, json_doc): embed = Embed( title=f"Changelogs for {json_doc['type']} `{json_doc['version']}`", description=json_doc["description"], bot=self.bot, user=ctx.author) embed.add_field(name="Bugs/plans", value=json_doc["bugs"], inline=False) embed.timestamp = datetime.fromtimestamp(json_doc["date"]) await embed.set_made_with_love_footer() return embed
async def show_cog(self, ctx, arg): cogs = {z.lower(): self.bot.cogs[z] for z in self.bot.cogs} cog : commands.Cog = cogs[arg] cog_embed = Embed(title=arg.capitalize() + " Help", bot=self.bot, user=ctx.author) await cog_embed.set_requested_by_footer() for command in cog.get_commands(): if command.description == "": description = "No Description." else: description = command.description cog_embed.add_field(name=command.name, value=description, inline=True) await ctx.send(embed=cog_embed)
async def list_reminder(self, ctx, user: discord.abc.User=None): if not user: user = ctx.author embed = Embed(self.bot, ctx.author, title=f"{str(user)} reminders") await embed.set_made_with_love_footer() docs = self.reminders.find({"id" : user.id}) async for doc in docs: event = self.get_event(TimedEvent(doc["event"])) event_in = str(event.event_in - timedelta(minutes=5))[:-7] if event.event_in.microseconds else event.event_in embed.add_field(name=f"Reminder for {event.event_name}", value=f"Will be reminded in {event_in}") if len(embed.fields) > 0: await ctx.send(embed=embed) else: await ctx.send(f"{str(user)} has no reminders set.")
async def get_profiles_embed(self, ctx, uname): player = await skypy.Player(keys=self.bot.api_keys, uname=uname) name = self.format_name(player.uname) embed = Embed(self.bot, ctx.author, title=f"{name} profiles") await embed.set_requested_by_footer() for number, profile in enumerate(player.profiles.items()): await player.set_profile(profile[1]) uuids = list(player._api_data["members"].keys()) unames = [] for uuid in uuids: name, uuid = await skypy.fetch_uuid_uname(uuid) unames.append(name) embed.add_field(name=f"{number + 1}. {profile[0]}", value="- " + "\n- ".join(unames), inline=False) player._profile_set = False return embed
async def get_event_embed(self, ctx, event): event = self.get_event(event) if not event.event_name and not event.event_in: try: await event.set_data() except Exception: await asyncio.sleep(2) await event.set_data() event_in, event_on = self.get_times(event) embed = Embed(self.bot, ctx.author, title=event.event_name) await embed.set_requested_by_footer() embed.set_thumbnail(url=TimedEvent.icons[event.event_url]) embed.add_field(name=f"{event.event_name} in:", value=event_in, inline=False) embed.add_field(name=f"{event.event_name} on (utc+0):", value=event_on, inline=False) return embed
async def inventory(self, ctx, target: MemberConverter = None): """Fun|See your items.|""" if not target: target = ctx.message.author inventory = await self.bot.funx.get_inventory(target.id) if target == ctx.author: embed = Embed().make_emb("[Inventory]", "These are **your** items:") else: embed = Embed().make_emb("[Inventory]", f"These are **{target}**'s items:") for item in inventory: quantity = f"{inventory[item]} units" embed.add_field(name=item.capitalize(), value=quantity, inline=True) # embed.set_footer("Page 1/1 - To find out more about an item, use ama iteminfo <item_name>.") await ctx.send(embed=embed)
async def show_command(self, ctx, arg): if isinstance(arg, commands.Command): command = arg elif isinstance(arg, str): command = self.bot.get_command(arg) if has_is_staff(command) and not is_staff(ctx): raise commands.BadArgument(message="Command or Category not found") if command.parents: command_embed = Embed(title=f"{ctx.prefix}{' '.join([command.name.capitalize() for command in command.parents])} {command.name.capitalize()}", bot=self.bot, user=ctx.author) else: command_embed = Embed(title=f"{ctx.prefix}{command.name.capitalize()}", bot=self.bot, user=ctx.author) await command_embed.set_requested_by_footer() if command.description == "": description = "No Description." else: description = command.description if command.usage is None: usage = "No Usage." elif command.parents: usage = f"{ctx.prefix}{' '.join([command.name.capitalize() for command in command.parents])} {command.name.capitalize()} {command.usage}" else: usage = f"{ctx.prefix}{command.name.capitalize()} {command.usage}" if command.aliases == []: aliases = "No Aliases." else: aliases = str(command.aliases).replace("[", " ").replace("]", " ").replace("'", " ").replace(",", "\n") command_embed.add_field(name="Description", value=description, inline=False) command_embed.add_field(name="Usage", value=usage, inline=False) command_embed.add_field(name="Aliases", value=aliases, inline=False) await ctx.send(embed=command_embed)
async def stats(self): config = self.bot.config["support_guild"] guild = self.bot.get_guild(config["ID"]) config = config["stats"] channel = guild.get_channel(config["channel"]) message = await channel.fetch_message(config["message"]) guilds = self.bot.guilds members = 0 for guild in guilds: members += len(guild.members) guild_members = [] for guild in guilds: guild_members.append(len(guild.members)) guilds_sorted = sorted(guild_members, reverse=True)[:10] guilds_sorted_str = [ str(place + 1) + ". " + str(guild) for place, guild in enumerate(guilds_sorted) ] final_list = "\n".join(guilds_sorted_str) embed = Embed(title="Statistics", bot=self.bot, user=None) embed.add_field(name="Servers:", value=len(guilds), inline=False) embed.add_field(name="Members:", value=members, inline=False) embed.add_field(name="Top 10 Member count:", value=final_list, inline=False) await embed.set_made_with_love_footer() await message.edit(embed=embed)
async def votes(self, ctx): """Info|Shows the top 10 people with the most votes.|""" script = "select user_id, monthly_votes, total_votes from amathy.votes" data = await self.bot.funx.fetch_many(script) top = {"monthly": {}, "total": {}} for elem in data: user_id, monthly_votes, total_votes = elem top["monthly"][user_id] = monthly_votes top["total"][user_id] = total_votes embeds = list() for page in ["monthly", "total"]: sorted_top = sorted(top[page], key=top[page].get, reverse=True) emb = Embed().make_emb( f"Global top - {page.title()} votes", "To get listed, vote for me ([here](https://tiny.cc/voteama))." ) max_range = 10 if len(sorted_top) < max_range: max_range = len(sorted_top) for index in range(0, max_range): user_id = sorted_top[index] votes = top[page][user_id] if votes == 0: continue votes = self.bot.funx.group_digit(votes) if user_id == ctx.author.id: text = "Author position >>> No. {}: {} - {} votes <<<" emb.set_footer(text=text.format(index + 1, ctx.author.name, votes)) user = self.bot.get_user(user_id) if user: emb.add_field(name="No. {}: {}".format( index + 1, user.name), value="{} votes".format(votes)) embeds.append(emb) await self.bot.funx.embed_menu(ctx, embeds)
async def get_auctions_embeds(self, ctx, player): auctions = await player.auctions() embeds = [] for auction in auctions: item: skypy.Item = auction[1] auction = auction[0] embed = Embed(self.bot, ctx.author, title=self.format_name(player.uname) + " Auctions", description=f"Item: {auction['item']}") await embed.set_made_with_love_footer() async def get_uname(uuid): uname, uuid = await skypy.fetch_uuid_uname(uuid) return uname bids = [ str(await get_uname(bid["bidder"])) + ", " + "Amount: " + f"{bid['amount']:,}" for bid in auction["bids"] ] if auction["bids"] else ["None"] bids.reverse() bids = '\n'.join(bids[:5]) started = datetime.utcfromtimestamp(auction["start"] / 1000) started = str(started)[:-7] if started.microsecond else started ending = datetime.utcfromtimestamp(auction["end"] / 1000) ending = str(ending)[:-7] if ending.microsecond else ending description = '\n'.join(item.description_clean) value = f"**Name:** {item.name}\nAmount: {item.stack_size}\n**Description:** {description}" if len(value) > 1000: value = f"**Name:** {item.name}\nAmount: {item.stack_size}" embed.add_field( name="Starting-Ending", value=f"**Started:** {started}\n**Ending:** {ending}") embed.add_field(name="Item", value=value) embed.add_field( name="Bids", value= f"**Starting Bid:** {auction['starting_bid']:,}\n**Highest bid:** {auction['highest_bid']:,}\n**Bids:**\n{bids}" ) embeds.append(embed) return embeds
async def get_stats_embed(self, ctx, player: skypy.Player): player.load_banking(False) player.load_misc(False) player.load_skills_slayers(False) name = self.format_name(player.uname) percentages = [ "crit_chance", "speed", "crit_damage", "bonus_attack_speed", "sea_creature_chance" ] icons = { 'health': "❤️", 'defense': "🛡️", 'effective_health': "💕", 'strength': "⚔️", 'speed': "🏃♂️", 'crit_chance': "🎲", 'crit_damage': "☠️", 'bonus_attack_speed': "🗯️", 'intelligence': "🧠", 'sea_creature_chance': "🎣", 'magic_find': "⭐", 'pet_luck': "🦜" } if player.enabled_api["skills"]: description = f"Average skill level: {player.skill_average}" else: description = "Average skill level: Skills Api disabled" embed = Embed(self.bot, ctx.author, title=f"{name} Stats on {player.profile_name}", description=description) await embed.set_patron_footer() embed.set_thumbnail(url=player.avatar()) for name, stat in player.stats.items(): if name == "damage" or name == "damage_increase": continue if name in percentages: stat = str(stat) + "%" else: stat = f"{stat:,}" embed.add_field(name=icons[name] + name.replace("_", " ").capitalize(), value=stat) embed.add_field(name="🌈Fairy souls", value=player.fairy_souls_collected) if player.enabled_api["banking"]: embed.add_field(name="🏦Bank Balance", value=f"{round(player.bank_balance):,}") embed.add_field(name="💰Purse", value=f"{round(player.purse):,}") online = await player.is_online() embed.add_field( name="🟢Currently online" if online else "🔴Currently online", value="Yes" if online else "No") embed.add_field(name="🚪Join date", value=str(player.join_date.strftime("%Y-%m-%d"))) embed.add_field(name="⏰Last update", value=str(player.last_save.strftime("%Y-%m-%d"))) return embed
async def s_info(self, ctx): """Info|Returns some server information.|""" embed = Embed().make_emb(title="Guild details:", desc="") embed.set_author(name="{} ({})".format(ctx.guild.name, ctx.guild.id)) embed.set_thumbnail(url=ctx.guild.icon_url) embed.add_field(name="Owner", value=ctx.guild.owner, inline=True) embed.add_field(name="Region", value=ctx.guild.region, inline=True) embed.add_field(name="Created at", value=str(ctx.guild.created_at).split('.', 1)[0], inline=True) members = 0 bots = 0 online_members = 0 if not ctx.guild.chunked: await self.bot.request_offline_members(ctx.guild) for member in ctx.guild.members: if member.bot: bots += 1 else: members += 1 status = str(member.status) if not status == "offline": online_members += 1 embed.add_field(name="Members", value=members, inline=True) embed.add_field(name="Bots", value=bots, inline=True) embed.add_field(name="Online members", value=online_members, inline=True) embed.add_field(name="Text channels", value=len(ctx.guild.text_channels), inline=True) embed.add_field(name="Voice channels", value=len(ctx.guild.voice_channels), inline=True) embed.add_field(name="Nitro boost level", value=ctx.guild.premium_tier, inline=True) embed.add_field(name="Members boosting this guild", value=ctx.guild.premium_subscription_count, inline=True) g_boost_stats = "```Emoji limit: {} emojis\nBitrate limit: {} kbps\nFilesize limit: {} MB```" g_boost_stats = g_boost_stats.format( ctx.guild.emoji_limit, int(ctx.guild.bitrate_limit / 1000), int(ctx.guild.filesize_limit / 1048576)) embed.add_field(name="Guild boost stats", value=g_boost_stats, inline=True) emoji_list = await ctx.guild.fetch_emojis() random.shuffle(emoji_list) emoji_string = "" maxlen = len(emoji_list) if maxlen > 20: maxlen = 20 for i in range(0, maxlen): emoji_string += str(emoji_list[i]) if len(emoji_string) > 0: embed.add_field(name="Some emojis", value=emoji_string, inline=True) await ctx.send(embed=embed)
async def get_dungeon_embed(self, ctx, player: skypy.Player): if not player.load_dungeon_stats(): return await Embed( self.bot, ctx.author, title="Error", description="Couldn't find any dungeon stats for this player." ).set_requested_by_footer() class_emojis = { "healer": ":heart:", "mage": ":sparkler:", "berserk": ":crossed_swords:", "archer": ":bow_and_arrow:", "tank": ":shield:" } embed = Embed( self.bot, ctx.author, title= f"{self.format_name(player.uname)} Catacombs stats on {player.profile_name}", description= f"**Catacombs level: {player.catacomb_level[0]}\nXP to next level: {round(player.catacomb_level[1])}**" ) embed.add_field( name=":arrows_counterclockwise: Times played", value="\n".join([ f"**Floor {z}:** {round(player.catacomb_times_floor_played[z])}" for z in player.catacomb_times_floor_played ]), inline=False) embed.add_field( name=":clock1: Fastest times", value="\n".join([ f"**Floor {z}:** {timedelta(seconds=round(player.catacomb_fasted_times[z] / 1000))}" for z in player.catacomb_fasted_times ]), inline=True) embed.add_field( name=":1234: Best scores", value="\n".join([ f"**Floor {z}:** {round(player.catacomb_best_scores[z]):,}" for z in player.catacomb_best_scores ]), inline=True) embed.add_field( name=":drop_of_blood: Mobs killed", value="\n".join([ f"**Floor {z}:** {round(player.catacomb_mobs_killed[z])}" for z in player.catacomb_mobs_killed ]), inline=True) embed.add_field(name=u"\u200b", value="**Class Levels**", inline=False) for _class in player.catacomb_class_levels: embed.add_field( name=f"{class_emojis[_class.lower()]} {_class}", value= f"**Level:** {player.catacomb_class_levels[_class][0]}\n**XP to next level:** {round(player.catacomb_class_levels[_class][1])}\n", inline=True) embed.add_field(name=u"\u200b", value=u"\u200b", inline=True) embed.set_thumbnail(url=player.avatar()) await embed.set_made_with_love_footer() return embed
async def status(self, ctx): statuses = { "stats_api": [False, ""], "slothpixel": [False, ""], "hypixel_api": [False, ""], "database": [False, ""] } db_status = await self.bot.db_client["admin"].command({"ping": 1}) if db_status["ok"] == 1: statuses["database"][0] = True try: await skypy.Player(keys=self.bot.api_keys, uuid="930aa39d62e0457fa0117c0d70e6ed43") statuses["hypixel_api"][0] = True except Exception as e: statuses["hypixel_api"][1] = e try: async with aiohttp.ClientSession( timeout=aiohttp.ClientTimeout(total=5), raise_for_status=True) as s: async with s.get( "https://api.slothpixel.me/api/health") as resp: if resp.status == 200: statuses["slothpixel"][0] = True else: statuses["slothpixel"][1] = resp.status except Exception as e: statuses["slothpixel"][1] = e try: async with aiohttp.ClientSession( timeout=aiohttp.ClientTimeout(total=5), raise_for_status=True) as s: async with s.get(self.bot.stats_api + "/930aa39d62e0457fa0117c0d70e6ed43?key=" + self.bot.api_keys[0]) as resp: if resp.status == 200 and (await resp.json())["success"]: statuses["stats_api"][0] = True else: statuses["stats_api"][ 1] = f"{resp.status} + {await resp.json()}" except Exception as e: statuses["stats_api"][1] = e embed = Embed(title="Status", bot=self.bot, user=ctx.author) await embed.set_made_with_love_footer() embed.add_field( name="Uptime", value=f"{timedelta(seconds=round(time() - self.bot.start_time))}") embed.add_field( name="Bot Websocket Latency", value="\n".join([ f"Shard ID: {shard[0]} Latency: {round(shard[1] * 1000)}ms" for shard in self.bot.latencies ] + [(f"Average Latency: {round(self.bot.latency * 1000)}ms")]), inline=False) for name, status in statuses.items(): if status[0] == True: embed.add_field(name=name.replace("_", " ").capitalize(), value="Working", inline=False) continue print(status[1]) embed.add_field(name=name.replace("_", " ").capitalize(), value="Not working\nError: " + str(status[1]), inline=False) await ctx.send(embed=embed)