def format_build(champ: str, build_dict: dict): title = champ.upper() + " BUILD :crossed_swords:" embed = embeds.Embed( title=title, colour=Colour.random() ) txt = "" count = 0 for item in build_dict["core-build"]: if count < 3: txt += str(count+1) + '. ' + item + '\n\n' elif count == 3: txt += "\nPopularidade: " + item + "%\n" else: txt += " Win rate: " + item + "%\n" count += 1 embed.add_field(name="Principal", value=txt, inline=True) txt = '' for item in build_dict["end-build"]: txt += item + '\n' txt += "\n**Bota**\n" info_botas = build_dict['boots'] txt += info_botas[0] + '\n\n' txt += " Popularidade: " + info_botas[1] + "%\n" txt += " Win rate: " + info_botas[2] + "%\n" embed.add_field(name="Outros", value=txt, inline=True) return embed
def get_new_score_embed(player, score, song, country_rank=None): embed = Embed() embed.set_author(name=player.playerName, url=player.profile_url, icon_url=player.avatar_url) if country_rank is None or not isinstance(country_rank, int): embed.title = f"New #{score.rank} " \ f"for {score.song_name_full} on {score.difficulty_name}" else: embed.title = f"New #{score.rank} (#{country_rank} in country) " \ f"for {score.song_name_full} on {score.difficulty_name}" if song is not None: embed.description = F"Mapped by {song.author}" embed.add_field( name="PP", value=f"**{round(score.pp, 2)}pp** _({score.weighted_pp}pp)_") embed.add_field(name="Accuracy", value=f"**{score.accuracy}%**") embed.add_field(name="Score", value=f"{score.score}") if score.mods: embed.add_field(name="Modifiers", value=f"{score.mods}") embed.set_thumbnail(url=score.song_image_url) embed.colour = Colour.random(seed=player.playerId) embed.url = score.leaderboard_url if song is not None: embed.add_field(name="\u200b", value=f"[Beat Saver]({song.beatsaver_url})") embed.add_field(name="\u200b", value=f"[Preview Map]({song.preview_url})") return embed
def get_score_embed(player, score, song): embed = Embed() embed.set_author(name=player.playerName, url=player.profile_url, icon_url=player.avatar_url) embed.title = f"New #{score.rank} for {score.song_name_full} on {score.difficulty_name}" if song is not None: embed.description = F"Mapped by {song._metadata['levelAuthorName']}" embed.add_field(name="PP", value=f"**{score.pp}pp** ({score.weighted_pp}pp)") embed.add_field(name="Accuracy", value=f"**{score.accuracy}%**") embed.add_field(name="Score", value=f"{score.score}") if score.mods: embed.add_field(name="Modifiers", value=f"{score.mods}") embed.set_thumbnail(url=score.song_image_url) embed.colour = Colour.random(seed=player.playerId) embed.url = score.leaderboard_url if song is not None: embed.add_field(name="\u200b", value=f"[Beat Saver]({song.beatsaver_url})") embed.add_field(name="\u200b", value=f"[Preview Map]({song.preview_url})") return embed
class Player(Model): """Representation of a Player, this is a Database Object.""" __tablename__ = "player" __database__ = Database.database __metadata__ = Database.metadata id = BigInteger(primary_key=True, index=True) colour = Integer(default=lambda: Colour.random().value) coin = Integer(default=0) item_counter = Integer(default=0) join_date = DateTime(default=datetime.utcnow) @property async def embed(self) -> Embed: """Get a Embed that represents the Player""" bot = ArenaBot.instance if (discord_user := bot.get_user(self.id)) is None: discord_user = await bot.fetch_user(self.id) embed = Embed(title=discord_user.name, description=f"Coins: {self.coin}", colour=self.colour) embed.set_author(name=discord_user.display_name, icon_url=discord_user.avatar_url) return embed
async def cmd_randomcolour(self, message): """Makes a set role set to a random colour""" if self.is_running or message.guild != self.guild: return await self.role.edit(colour=Colour.random())
def get_song_embed(song): embed = Embed() embed.set_author(name=song.author, url=song.author_url) embed.title = f"{song.name}" embed.add_field(name="Rating", value=f"{song.rating}%") embed.add_field(name="Downloads", value=f"{song.downloads}") embed.add_field(name="Length", value=f"{song.length}") embed.add_field(name="BPM", value=f"{song.bpm}") embed.add_field(name="difficulties", value=" ".join(f"**{diff}**" for diff in song.difficulties_short)) # Should make a simple website that redirects the user to the right links # discord doesn't want to make app links clickable # This will include OneClick links and beatmap download links embed.add_field(name="\u200b", value=f"[Preview Map]({song.preview_url})") embed.set_thumbnail(url=song.cover_url) embed.colour = Colour.random(seed=song.author_id) embed.url = song.beatsaver_url return embed
def format_last_update(img_link, num_att): embed = embeds.Embed( title="ATUALIZAÇÃO " + str(num_att), colour=Colour.random() ) embed.set_image(url=img_link) return embed
async def create_role(self): role = await self.guild.create_role(name=f"{self.get_pp_range_text}", colour=Colour.random(), hoist=True, reason="PP ranking (BOT)") db_role = self.create_db_role(role) self.uow.guild_repo.add_role(self.db_guild, db_role) return role
async def create_role(self, skill_class): role = await self.guild.create_role( name=f"{self.get_role_name(skill_class)}", colour=Colour.random(), hoist=True, reason="TOP ranking (BOT)") db_role = self.uow.role_repo.add_role(role) self.uow.role_repo.set_role_rank_requirement(db_role, skill_class) self.uow.guild_repo.add_role(self.db_guild, db_role) return db_role
async def fact(self, ctx: Context): display_name = get_name_string(ctx.message) if json := self.get_online_fact(): if user_is_irc_bot(ctx): await ctx.send( f"{display_name}: {json['text']} (from <{json['source']}>)" ) else: embed = Embed( title=json["text"], description=f'[{json["source"]}]({json["source"]})', colour=Colour.random(), ).set_footer(text=json["index"]) await ctx.send(embed=embed)
def format_commands(symbol, commands): title = "COMMANDS :scroll:" txt = "" for com in commands: txt += symbol + com + '\n' embed = embeds.Embed( title=title, colour=Colour.random(), description=txt ) return embed
def get_cog_help(self, cog, color=Colour.random()): ccog = str(cog) cog = self.client.get_cog(ccog) embed = discord.Embed(title=f"{ccog.title()} commands", description=cog.description, color=color) for i in cog.get_commands(): embed.add_field(name=f't.{i.name}', value=str(i.help)[2:]) now = str(date.today()) embed.set_footer(text=f"Treasure • {now}") return embed
async def cmd_randomwave(self, message, cycles='1'): """Makes a set role cycle through random colours once per second""" if self.is_running or message.guild != self.guild: return self.is_running = True cycles = self.get_cycles(cycles) for _ in range(len(self.colours) * cycles): await asyncio.gather(self.role.edit(colour=Colour.random()), asyncio.sleep(1)) await self.role.edit(colour=Colour.default()) self.is_running = False
async def avatar(self, ctx, member: discord.Member = None): member = member if member else ctx.author avatar = [ member.avatar_url_as(format="png"), member.avatar_url_as(format="jpg"), member.avatar_url_as(format="jpeg") ] dec = '**[png]({}) | [jpg]({}) | [jpeg]({}) **'.format( avatar[0], avatar[1], avatar[2]) if member.is_avatar_animated(): avatar.append(member.avatar_url_as(format="gif")) dec = '**[png]({}) | [jpg]({}) | [jpeg]({}) | [gif]({})**'.format( avatar[0], avatar[1], avatar[2], avatar[3] ) embed = discord.Embed( title='avatar', description=dec, timestamp=ctx.message.created_at, color=Colour.random()) embed.set_image(url=member.avatar_url_as(size=1024)) await ctx.send(embed=embed)
def disco(b): frames = [] im = _pil_image_from_bytes(b, "RGBA") if any(dimension > 256 for dimension in im.size): im = im.resize((256, 256), Image.ANTIALIAS) for _ in range(15): r, g, blue = Colour.random().to_rgb() overlay = Image.new("RGBA", im.size, (r, g, blue, 40)) frame = Image.new("RGBA", im.size, (0, 0, 0, 0)) try: frame.paste(im, (0, 0), im) except ValueError: frame.paste(im, (0, 0)) frame.paste(overlay, (0, 0), overlay) frames.append(frame) buffer = BytesIO() save_transparent_gif(frames, 200, buffer) buffer.seek(0) return buffer
async def help(self, ctx, command=None): if command == None: embed = discord.Embed( title="help", description= "Thanks for using this bot! \n\nBot created by Name12#1326 and The_Void#0156\n\n Do \"t.help <command>\" for more information on a command!\n", color=discord.Color.from_rgb(229, 234, 19)) for cog in self.client.cogs: if cog.lower() == 'developer': pass else: embed.add_field(name=f't.{cog.lower()}', value=f'See the {cog} commands') now = str(date.today()) embed.set_footer(text=f"Treasure • {now}") await ctx.send(embed=embed) else: command = self.client.get_command(command) if command == None: await ctx.send('Command not found') return else: now = str(date.today()) embed = discord.Embed(title=f't.{command.name}', description=command.description, color=Colour.random()) embed.set_footer(text=f"Treasure • {now}") embed.add_field(name="Description:", value=command.help) embed.add_field(name="Parameters:", value=eval('filter_param_type_hints()')) await ctx.send(embed=embed)
async def help(self, ctx, category=None): if category is None: await ctx.channel.trigger_typing() await asyncio.sleep(2) embed = Embed(title="Help", description=self.description, colour=Colour.random()) embed.add_field(name="Categories:", value=emojii.special['empty'], inline=True) empty_field(embed) empty_field(embed) embed.add_field( name="Category: [General]", value= "**Description:** Shows all available commands that are uncategorized.", inline=True) embed.add_field( name="Category: [Casino]", value= "**Description:** Casino System, all gambling related commands, for people who loves risks!", inline=True) embed.add_field( name="Category: [Labor]", value= "**Description:** Labor System, money-earning commands, for industrious people.", inline=True) embed.add_field( name="Category: [Economy]", value= "**Description:** Economy System, commands related to the economy like buying & selling of " "stuffs.", inline=True) embed.add_field( name="Category: [Reaction]", value= "**Description:** Reaction System, how to get reaction stats like reputation, love and more.", inline=True) embed.add_field( name="Category: [Donation]", value="**Description:** Want to donate? Here's how.", inline=True) time = datetime.datetime.now() embed.set_footer( text=time.strftime(f"Page 1 | %B %d, %Y | %I:%M %p")) guild_hashmap[f"{ctx.guild}_message"] = await ctx.send(embed=embed) guild_hashmap[f"{ctx.guild}_id"] = guild_hashmap[ f"{ctx.guild}_message"].guild.id guild_hashmap[f"{ctx.guild}_page"] = 1 await guild_hashmap[f"{ctx.guild}_message"].add_reaction( emojii.arrow["double_left"]) await guild_hashmap[f"{ctx.guild}_message"].add_reaction( emojii.arrow["small_left"] + emojii.special["variant"]) await guild_hashmap[f"{ctx.guild}_message"].add_reaction( emojii.number["1234"]) await guild_hashmap[f"{ctx.guild}_message"].add_reaction( emojii.arrow["small_right"] + emojii.special["variant"]) await guild_hashmap[f"{ctx.guild}_message"].add_reaction( emojii.arrow["double_right"]) await guild_hashmap[f"{ctx.guild}_message"].add_reaction( emojii.buttons["stop"] + emojii.special["variant"]) def check(reaction, user): return user == ctx.author and str(reaction.emoji) in ( emojii.arrow["double_left"], emojii.arrow["small_left"] + emojii.special["variant"], emojii.number["1234"], emojii.arrow["small_right"] + emojii.special["variant"], emojii.arrow["double_right"], emojii.buttons["stop"] + emojii.special["variant"]) while True: try: emoji, member = await self.bot.wait_for('reaction_add', timeout=60.0, check=check) except asyncio.TimeoutError: await guild_hashmap[f"{ctx.guild}_message"].delete() break else: if member.guild.id == guild_hashmap[f"{ctx.guild}_id"]: if str(emoji) == emojii.arrow["double_left"]: await guild_hashmap[ f"{ctx.guild}_message"].remove_reaction( emoji=emojii.arrow["double_left"], member=member) guild_hashmap[f"{ctx.guild}_page"] = 1 await show_page( guild_hashmap[f"{ctx.guild}_message"], guild_hashmap[f"{ctx.guild}_page"]) elif str(emoji) == emojii.arrow[ "small_left"] + emojii.special["variant"]: await guild_hashmap[ f"{ctx.guild}_message"].remove_reaction( emoji=emojii.arrow["small_left"] + emojii.special["variant"], member=member) guild_hashmap[f"{ctx.guild}_page"] -= 1 if guild_hashmap[f"{ctx.guild}_page"] <= 1: guild_hashmap[f"{ctx.guild}_page"] = 1 await show_page( guild_hashmap[f"{ctx.guild}_message"], guild_hashmap[f"{ctx.guild}_page"]) elif str(emoji) == emojii.number["1234"]: await guild_hashmap[ f"{ctx.guild}_message"].remove_reaction( emoji=emojii.number["1234"], member=member) elif str(emoji) == emojii.arrow[ "small_right"] + emojii.special["variant"]: await guild_hashmap[ f"{ctx.guild}_message"].remove_reaction( emoji=emojii.arrow["small_right"] + emojii.special["variant"], member=member) guild_hashmap[f"{ctx.guild}_page"] += 1 if guild_hashmap[f"{ctx.guild}_page"] >= 7: guild_hashmap[f"{ctx.guild}_page"] = 7 await show_page( guild_hashmap[f"{ctx.guild}_message"], guild_hashmap[f"{ctx.guild}_page"]) elif str(emoji) == emojii.arrow["double_right"]: await guild_hashmap[ f"{ctx.guild}_message"].remove_reaction( emoji=emojii.arrow["double_right"], member=member) guild_hashmap[f"{ctx.guild}_page"] = 7 await show_page( guild_hashmap[f"{ctx.guild}_message"], guild_hashmap[f"{ctx.guild}_page"]) elif str(emoji) == emojii.buttons[ "stop"] + emojii.special["variant"]: await guild_hashmap[ f"{ctx.guild}_message"].remove_reaction( emoji=emojii.buttons["stop"] + emojii.special["variant"], member=member) await guild_hashmap[f"{ctx.guild}_message"].delete( ) break if category.casefold() == "general": pass elif category.casefold() == "casino": pass elif category.casefold() == "labor": pass elif category.casefold() == "economy": pass elif category.casefold() == 'reaction': pass elif category.casefold() == 'donate': pass else: embed = Embed( title="Error", description= "That category doesn't exist, type `!help` to see the available categories.", colour=Color.red()) await ctx.channel.trigger_typing() await asyncio.sleep(2) await ctx.reply(embed=embed)
async def create_ticket(self, ctx, bot): def checkValid(reaction, user): return (ctx.message.author == user and q.id == reaction.message.id and (reaction.emoji == "✅" or reaction.emoji == "❌")) def checkRep(message): return (message.author == ctx.message.author and ctx.message.channel == message.channel) guild = ctx.message.guild db = sqlite3.connect("src/owlly.db", timeout=3000) c = db.cursor() q = await ctx.send(f"Quel est le titre de l'embed ?") rep = await bot.wait_for("message", timeout=300, check=checkRep) typeM = rep.content if typeM.lower() == "stop": await ctx.send("Annulation !", delete_after=10) await rep.delete() await q.delete() return else: await rep.delete() await q.edit(content=f"Quelle est sa description ?") rep = await bot.wait_for("message", timeout=300, check=checkRep) desc = rep.content if rep.content.lower() == "stop": await ctx.send("Annulation !", delete_after=30) await rep.delete() await q.delete() return await rep.delete() await q.edit( content= "Dans quelle catégorie voulez-vous créer vos tickets ? Rappel : Seul un modérateur pourra les supprimer, car ce sont des tickets permanent.\n Vous pouvez utiliser le nom ou l'ID de la catégorie !" ) rep = await bot.wait_for("message", timeout=300, check=checkRep) ticket_chan_content = rep.content cat_name = "none" if ticket_chan_content.lower() == "stop": await ctx.send("Annulation !", delete_after=10) await q.delete() await rep.delete() return else: await rep.delete() if ticket_chan_content.isnumeric(): ticket_chan_content = int(ticket_chan_content) cat_name = get(guild.categories, id=ticket_chan_content) if cat_name == "None" or cat_name is None: await ctx.send("Erreur : Cette catégorie n'existe pas !", delete_after=30) await q.delete() return else: ticket_chan_content = await search_cat_name( ctx, ticket_chan_content, bot) if ticket_chan_content == 12: await ctx.send( "Aucune catégorie portant un nom similaire existe, vérifier votre frappe.", delete_after=30, ) await q.delete() return else: cat_name = get(guild.categories, id=ticket_chan_content) await q.edit( content= f"Votre ticket sera créée dans {cat_name}.\n\nQuelle couleur voulez vous utiliser ? \n 0 donne une couleur aléatoire." ) rep = await bot.wait_for("message", timeout=300, check=checkRep) col = rep.content if col.lower() == "stop": await ctx.send("Annulation !", delete_after=30) await q.delete() await rep.delete() return elif col == "0": col = Colour.random() else: try: col = await ColourConverter.convert(self, ctx=ctx, argument=rep.content) except CommandError: col = Colour.blurple() await rep.delete() await q.edit(content="Voulez-vous ajouter une image ?") await q.add_reaction("✅") await q.add_reaction("❌") reaction, user = await bot.wait_for("reaction_add", timeout=300, check=checkValid) if reaction.emoji == "✅": await q.clear_reactions() await q.edit(content="Merci d'envoyer l'image.") rep = await bot.wait_for("message", timeout=300, check=checkRep) img_content = rep.content if img_content.lower() == "stop" or img_content.lower() == "cancel": await ctx.send("Annulation !", delete_after=10) await q.delete() await rep.delete() return elif rep.attachments: img_content = rep.attachments[0] imgur = im.upload_image(url=img_content.url) img_content = imgur.link elif "cdn.discordapp.com" in img_content: imgur = im.upload_image(url=img_content) img_content = imgur.link else: img_content = checkImg(ctx, img_content) if img_content.lower() == "error": await ctx.send( "Erreur ! Votre lien n'est pas une image valide.", delete_after=60) await q.delete() await rep.delete() return else: await rep.delete() else: await q.clear_reactions() img_content = "none" await q.edit( content= "**Voulez-vous donner la possibilité de nommer librement les channels ?**" ) await q.add_reaction("✅") await q.add_reaction("❌") reaction, user = await bot.wait_for("reaction_add", timeout=300, check=checkValid) if reaction.emoji == "✅": await q.clear_reactions() name_para = "1" phrase_para = "Nom libre" nb_dep_content = "Aucun" limit_content = 0 mod_content = 0 else: name_para = "2" await q.clear_reactions() await q.edit( content= "Dans ce cas, voulez-vous avoir une construction particulière du nom du channel ? Elle sera toujours suivi du nom du créateur." ) await q.add_reaction("✅") await q.add_reaction("❌") reaction, user = await bot.wait_for("reaction_add", timeout=300, check=checkValid) if reaction.emoji == "✅": await q.clear_reactions() await q.edit(content="Quel est le nom que vous voulez utiliser ?") rep = await bot.wait_for("message", timeout=300, check=checkRep) name_para = rep.content await rep.delete() phrase_para = name_para else: phrase_para = "Nom du personnage" await q.clear_reactions() await q.edit(content="Voulez-vous que les tickets soient comptés ?") await q.add_reaction("✅") await q.add_reaction("❌") reaction, user = await bot.wait_for("reaction_add", timeout=300, check=checkValid) limit_content = 0 mod_content = 0 nb_dep_content = "Aucun" if reaction.emoji == "✅": await q.clear_reactions() await q.edit(content="Voulez-vous fixer un nombre de départ ?") await q.add_reaction("✅") await q.add_reaction("❌") reaction, user = await bot.wait_for("reaction_add", timeout=300, check=checkValid) if reaction.emoji == "✅": await q.clear_reactions() await q.edit(content="Merci d'indiquer le nombre de départ.") rep = await bot.wait_for("message", timeout=300, check=checkRep) if rep.content.lower() == "stop": await q.delete() await ctx.send("Annulation !", delete_after=10) await rep.delete() return else: await q.clear_reactions() nb_dep_content = str(rep.content) await rep.delete() else: await q.clear_reactions() nb_dep_content = "0" await q.edit( content= "Voulez-vous fixer une limite ? C'est à dire que le ticket va se reset après ce nombre." ) await q.add_reaction("✅") await q.add_reaction("❌") reaction, user = await bot.wait_for("reaction_add", timeout=300, check=checkValid) if reaction.emoji == "✅": await q.clear_reactions() await q.edit(content="Merci d'indiquer la limite.") rep = await bot.wait_for("message", timeout=300, check=checkRep) limit = rep.content if (limit.lower() == "stop" or limit.lower() == "cancel" or limit.lower() is not limit.isnumeric()): await ctx.send("Annulation !", delete_after=10) await q.delete() await rep.delete() return else: await q.clear_reactions() limit_content = int(limit) await rep.delete() mod_content = 0 await q.edit( content= "Voulez-vous, après la limite, augmenter d'un certain nombre le numéro ?" ) await q.add_reaction("✅") await q.add_reaction("❌") reaction, user = await bot.wait_for("reaction_add", timeout=300, check=checkValid) if reaction.emoji == "✅": await q.clear_reactions() await q.edit(content="Quel est donc ce nombre ?") rep = await bot.wait_for("message", timeout=300, check=checkRep) if (rep.content.lower() == "stop" or rep.content.lower() == "cancel" or rep.content.lower() is not rep.isnumeric()): await ctx.send("Annulation !", delete_after=10) await rep.delete() await q.delete() return elif rep.content.isnumeric(): mod_content = int(rep.content) await rep.delete() else: await q.clear_reactions() mod_content = 0 else: limit_content = 0 mod_content = 0 await q.clear_reactions() else: await q.clear_reactions() guild = ctx.message.guild await q.edit( content= f"Vos paramètres sont : \n Titre : {typeM} \n Numéro de départ : {nb_dep_content} \n Intervalle entre les nombres (on se comprend, j'espère) : {mod_content} (0 => Pas d'intervalle) \n Limite : {limit_content} (0 => Pas de limite) \n Catégorie : {cat_name}.\n Nom par défaut : {phrase_para}\n Confirmez-vous ces paramètres ?" ) await q.add_reaction("✅") await q.add_reaction("❌") reaction, user = await bot.wait_for("reaction_add", timeout=300, check=checkValid) if reaction.emoji == "✅": await q.clear_reactions() embed = discord.Embed(title=typeM, description=desc, color=col) if img_content != "none": embed.set_image(url=img_content) await q.edit( content= "Vous pouvez choisir l'émoji de réaction en réagissant à ce message. Il sera sauvegardé et mis sur l'embed. Par défaut, l'émoji est : 🗒" ) symb, user = await bot.wait_for("reaction_add", timeout=300) if symb.custom_emoji: if symb.emoji in guild.emojis: symbole = str(symb.emoji) else: symbole = "🗒" elif symb.emoji != "🗒": symbole = str(symb.emoji) else: symbole = "🗒" await q.delete() react = await ctx.send(embed=embed) await react.add_reaction(symbole) sql = "INSERT INTO TICKET (idM, channelM, channel, num, modulo, limitation, emote, idS, name_auto) VALUES (?, ?, ?, ?, ?, ?, ?, ?,?)" id_serveur = ctx.message.guild.id id_message = react.id chanM = ctx.channel.id var = ( id_message, chanM, ticket_chan_content, nb_dep_content, mod_content, limit_content, symbole, id_serveur, name_para, ) c.execute(sql, var) db.commit() c.close() db.close() else: await ctx.send("Annulation !", delete_after=30) await q.delete() return
async def create_category(self, ctx, bot): def checkValid(reaction, user): return (ctx.message.author == user and q.id == reaction.message.id and (reaction.emoji == "✅" or reaction.emoji == "❌")) def checkRep(message): return (message.author == ctx.message.author and ctx.message.channel == message.channel) emoji = ["1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣"] db = sqlite3.connect("src/owlly.db", timeout=3000) c = db.cursor() chan = [] q = await ctx.send( "Merci d'envoyer l'ID des catégories (ou leurs noms) que vous souhaitez utiliser pour cette configuration. \n Utiliser `stop` pour valider la saisie et `cancel` pour annuler la commande. " ) while True: channels = await bot.wait_for("message", timeout=300, check=checkRep) chan_search = channels.content if chan_search.lower() == "stop": await ctx.send("Validation en cours !", delete_after=5) await channels.delete() break elif chan_search.lower() == "cancel": await channels.delete() await ctx.send("Annulation !", delete_after=30) await q.delete() return else: await channels.add_reaction("✅") if chan_search.isnumeric(): chan_search = int(chan_search) check_id = get(ctx.message.guild.categories, id=chan_search) if check_id is None or check_id == "None": await ctx.send("Erreur : Cette catégorie n'existe pas !", delete_after=30) await q.delete() await channels.delete() else: chan.append(str(chan_search)) else: chan_search = await search_cat_name(ctx, chan_search, bot) if chan_search == 12: await ctx.send( "Aucune catégorie portant un nom similaire existe, vérifier votre frappe.", delete_after=30, ) await q.delete() await channels.delete() return else: chan.append(str(chan_search)) await channels.delete(delay=10) if len(chan) >= 10: await ctx.send( "Erreur ! Vous ne pouvez pas mettre plus de 9 catégories !", delete_after=30) await q.delete() return namelist = [] guild = ctx.message.guild for i in range(0, len(chan)): number = int(chan[i]) cat = get(guild.categories, id=number) phrase = f"{emoji[i]} : {cat}" namelist.append(phrase) msg = "\n".join(namelist) await q.delete() parameters_save = f"Votre channel sera donc créé dans une des catégories suivantes:\n{msg}\n\nLe choix final de la catégories se fait lors des réactions." q = await ctx.send( f"{parameters_save}\n\n**Voulez-vous pouvoir nommer librement les channels créées ?**" ) await q.add_reaction("✅") await q.add_reaction("❌") reaction, user = await bot.wait_for("reaction_add", timeout=300, check=checkValid) name_para = 0 if reaction.emoji == "✅": name_para = 1 else: name_para = 0 await q.clear_reactions() await q.edit(content="Quel est le titre de l'embed ?") rep = await bot.wait_for("message", timeout=300, check=checkRep) if rep.content.lower() == "stop": await ctx.send("Annulation !", delete_after=30) await q.delete() await rep.delete() return else: titre = rep.content await rep.add_reaction("✅") await rep.delete() await q.edit( content= "Quelle couleur voulez vous utiliser ?\n 0 donnera une couleur aléatoire" ) rep = await bot.wait_for("message", timeout=300, check=checkRep) col = rep.content if col.lower() == "stop": await ctx.send("Annulation !", delete_after=30) await q.delete() await rep.delete() return elif col == "0": col = Colour.random() await rep.delete() else: try: col = await ColourConverter.convert(self, ctx, col) except CommandError: col = Colour.random() await rep.delete() await q.edit(content="Voulez-vous utiliser une image ?") await q.add_reaction("✅") await q.add_reaction("❌") reaction, user = await bot.wait_for("reaction_add", timeout=300, check=checkValid) if reaction.emoji == "✅": await q.clear_reactions() await q.edit(content="Merci d'envoyer l'image.") rep = await bot.wait_for("message", timeout=300, check=checkRep) img_content = rep.content if img_content.lower() == "stop": await ctx.send("Annulation !", delete_after=10) await q.delete() await rep.delete() return elif rep.attachments: img_content = rep.attachments[0] imgur = im.upload_image(url=img_content.url) img_content = imgur.link await rep.delete() elif "cdn.discordapp.com" in img_content: imgur = im.upload_image(url=img_content) img_content = imgur.link await rep.delete() else: img_content = checkImg(ctx, img_content) if img_content.lower() == "error": await ctx.send( "Erreur ! Votre lien n'est pas une image valide.", delete_after=60) await q.delete() await rep.delete() return else: await rep.delete() else: await q.clear_reactions() img_content = "none" embed = discord.Embed(title=titre, description=msg, color=col) if img_content != "none": embed.set_image(url=img_content) await q.edit( content= f"Les catégories dans lequel vous pourrez créer des canaux seront : {parameters_save} \n Validez-vous ses paramètres ?" ) await q.add_reaction("✅") await q.add_reaction("❌") reaction, user = await bot.wait_for("reaction_add", timeout=300, check=checkValid) if reaction.emoji == "✅": react = await ctx.send(embed=embed) for i in range(0, len(chan)): await react.add_reaction(emoji[i]) category_list_str = ",".join(chan) sql = "INSERT INTO CATEGORY (idM, channelM, category_list, idS, config_name) VALUES (?,?,?,?,?)" id_serveur = ctx.message.guild.id id_message = react.id chanM = ctx.channel.id var = (id_message, chanM, category_list_str, id_serveur, name_para) c.execute(sql, var) db.commit() c.close() db.close() await q.delete() else: await ctx.send("Annulation !", delete_after=10) await q.delete() c.close() db.close() return
async def updateDeck(callingMsg: Message, bGuild, deckName: str): loadingMsg = await callingMsg.reply("Reading spreadsheet... " + cfg.defaultEmojis.loading.sendable) try: newCardData = collect_cards(bGuild.decks[deckName]["spreadsheet_url"]) await loadingMsg.edit(content="Reading spreadsheet... " + cfg.defaultEmojis.submit.sendable) except gspread.SpreadsheetNotFound: await callingMsg.reply( ":x: Unrecognised spreadsheet! Please make sure the file exists and is public." ) bGuild.decks[deckName]["updating"] = False return else: lowerExpansions = [ expansion.lower() for expansion in newCardData["expansions"] ] for expansion in lowerExpansions: if lowerExpansions.count(expansion) > 1: await callingMsg.reply( ":x: Deck update failed - duplicate expansion pack name found: " + expansion) bGuild.decks[deckName]["updating"] = False return unnamedFound = False emptyExpansions = [] for expansion in newCardData["expansions"]: if expansion == "": unnamedFound = True if len(newCardData["expansions"][expansion]["white"]) == 0 and len( newCardData["expansions"][expansion]["black"]) == 0: emptyExpansions.append(expansion) errs = "" if unnamedFound: errs += "\nUnnamed expansion pack detected - skipping this expansion." del newCardData["expansions"][""] if len(emptyExpansions) != 0: errs += "\nEmpty expansion packs detected - skipping these expansions: " + ", ".join( expansion for expansion in emptyExpansions) for expansion in emptyExpansions: del newCardData["expansions"][expansion] whiteCounts = {} blackCounts = {} for expansion in newCardData["expansions"]: whiteCounts[expansion] = len( newCardData["expansions"][expansion]["white"]) blackCounts[expansion] = len( newCardData["expansions"][expansion]["black"]) indicesToRemove = [] for cardNum, cardText in enumerate( newCardData["expansions"][expansion]["black"]): if "_" not in cardText: indicesToRemove.append(cardNum) if indicesToRemove: errs += "\nIgnoring " + str( len(indicesToRemove) ) + " black cards from " + expansion + " expansion with no white card slots (`_`)." for i in indicesToRemove: newCardData["expansions"][expansion]["black"].pop(i) if errs != "": await callingMsg.channel.send(errs) totalWhite = sum(whiteCounts.values()) totalBlack = sum(blackCounts.values()) if int(totalWhite / cfg.cardsPerHand) < 2: await callingMsg.reply( "Deck update failed.\nDecks must have at least " + str(2 * cfg.cardsPerHand) + " white cards.") bGuild.decks[deckName]["updating"] = False return if totalBlack == 0: await callingMsg.reply( "Deck update failed.\nDecks must have at least 1 black card.") bGuild.decks[deckName]["updating"] = False return oldCardData = lib.jsonHandler.readJSON( bGuild.decks[deckName]["meta_path"]) deckID = os.path.splitext( os.path.split(bGuild.decks[deckName]["meta_path"])[1])[0] cardStorageChannel = None if cfg.cardStorageMethod == "local" else botState.client.get_guild( cfg.cardsDCChannel["guild_id"]).get_channel( cfg.cardsDCChannel["channel_id"]) loadingMsg = await callingMsg.channel.send( "Updating deck... " + cfg.defaultEmojis.loading.sendable) results = await make_cards.update_deck( cfg.paths.decksFolder, oldCardData, newCardData, deckID, cfg.paths.cardFont, callingMsg.guild.id, emptyExpansions, cfg.cardStorageMethod, cardStorageChannel, callingMsg, contentFontSize=cfg.cardContentFontSize, titleFontSize=cfg.cardTitleFontSize) oldCardData, changeLog = results[0], results[1] await loadingMsg.edit(content="Updating deck... " + cfg.defaultEmojis.submit.sendable) lib.jsonHandler.writeJSON(bGuild.decks[deckName]["meta_path"], oldCardData) now = datetime.utcnow() bGuild.decks[deckName]["last_update"] = now.timestamp() bGuild.decks[deckName]["expansions"] = { expansion: (whiteCounts[expansion], blackCounts[expansion]) for expansion in whiteCounts } bGuild.decks[deckName]["white_count"] = totalWhite bGuild.decks[deckName]["black_count"] = totalBlack bGuild.decks[deckName]["updating"] = False changelogEmbed = Embed(title="Deck Update Changelog", description=deckName.title(), colour=Colour.random()) changelogEmbed.set_footer(text=now.strftime("%m/%d/%Y, %H:%M:%S")) if changeLog: for exp, changes in changeLog.items(): changelogEmbed.add_field( name=exp.title(), value="\n".join(f"• *{change}*" for change in changes)) else: changelogEmbed.description += "\n\nNo changes found." await callingMsg.reply("Update complete!", embed=changelogEmbed)
async def user(self, ctx, argument=None): if argument is not None: if argument.isdigit(): ctx.author = self.bot.get_user(int(argument)) if ctx.author is None: return await ctx.send( "Sorry Senpai, I can't find anyone with that ID qwq") else: ID = argument[3:] ID = ID[:-1] ctx.author = self.bot.get_user(int(ID)) logging_info(f'Recieved user {ctx.author.name}') ref = dab.collection("users").document(str(ctx.author.id)).get() if ref.exists is False: logging_info(f"User not found") if argument is None: return await ctx.send( "You're not in my database, Senpai! qwq\nYou should use ``>user add`` <w<" ) elif argument is not None: return await ctx.send("That person isn't in my database qwq") username = ref.get("username") scoresaber = ref.get("scoresaber") links_Message = f"[Scoresaber]({scoresaber}) " try: steam = ref.get("steam") links_Message = links_Message + f"| [Steam]({steam}) " except BaseException: True try: twitch = ref.get("twitch") links_Message = links_Message + f"| [Twitch]({twitch}) " except BaseException: True try: youtube = ref.get("youtube") links_Message = links_Message + f"| [Youtube]({youtube}) " except BaseException: True try: twitter = ref.get("twitter") links_Message = links_Message + f"| [Twitter]({twitter}) " except BaseException: True try: reddit = ref.get("reddit") links_Message = links_Message + f"| [Reddit]({reddit}) " except BaseException: True try: hmd = ref.get("hmd") except BaseException: hmd = None try: birthday = ref.get("birthday") except BaseException: birthday = None try: pfp = ref.get("pfp") except BaseException: pfp = None try: status = ref.get("status") except BaseException: status = None # try: # this on for size, Mister try: colourRaw = ref.get("colour") colour = await commands.ColourConverter().convert( ctx, "0x" + colourRaw) embed = Embed(title=username, colour=colour) except BaseException: embed = Embed(title=username, colour=Colour.random()) embed.add_field(name="Links", value=links_Message, inline=False) if hmd is not None: embed.add_field(name="HMD", value=hmd, inline=True) if birthday is not None: embed.add_field(name="Birthday", value=birthday, inline=True) if status is not None: embed.add_field(name="Status", value=status, inline=False) if pfp is not None: embed.set_thumbnail(url=pfp) else: embed.set_thumbnail(url=ctx.author.avatar_url) await ctx.reply(embed=embed) logging_info('Response: user embed\n----------')
async def dice(self, ctx, bet, rolls=2): if not user.registered(ctx.author.id): await user.send_notregistered_msg(ctx) if user.get_cash(ctx.author) >= int(bet): embed = Embed( title="Rolling Dice...", description= f"${bet} bet has been placed, {rolls} dice will roll, goodluck!", colour=Colour.random()) embed.set_thumbnail( url= "https://thumbs.gfycat.com/ElatedImpartialArmadillo-max-1mb.gif" ) message = await ctx.send(embed=embed) await asyncio.sleep(5) user_result = random.randint(1, 6 * int(rolls)) dealer_result = random.randint(1, 6 * int(rolls)) if user_result > dealer_result: query = """ UPDATE users SET user_cash=? WHERE uid=? """ win = user.get_cash(ctx.author) + int(bet) Connection.SQL_Cursor.execute(query, (win, user.get_uid(ctx.author))) Connection.SQL_Handle.commit() embed = Embed( title="You won!", description= f"Congratulations, {ctx.author.name}! You've won ${bet}.\n\n**Summary:**\nYour roll: {user_result}\nDealer's Roll: {dealer_result}", colour=Colour.green()) embed.set_thumbnail( url= "https://media.tenor.com/images/99cff34bdcb675975b2b0cc661f2e4ce/tenor.gif" ) await message.edit(embed=embed) elif user_result == dealer_result: embed = Embed( title="Draw!", description= f"It's a draw!\n\n**Summary:**\nYour roll: {user_result}\nDealer's Roll: {dealer_result}", colour=Colour.gold()) embed.set_thumbnail( url= "https://media.tenor.com/images/99cff34bdcb675975b2b0cc661f2e4ce/tenor.gif" ) await message.edit(embed=embed) else: query = """ UPDATE users SET user_cash=? WHERE uid=? """ lost = user.get_cash(ctx.author) - int(bet) Connection.SQL_Cursor.execute(query, (lost, user.get_uid(ctx.author))) Connection.SQL_Handle.commit() embed = Embed( title="You lost!", description= f"Better luck next Timer, {ctx.author.name}! You've lost ${bet}.\n\n**Summary:**\nYour roll: {user_result}\nDealer's Roll: {dealer_result}", colour=Colour.orange()) embed.set_thumbnail( url= "https://media.tenor.com/images/2b454269146fcddfdae60d3013484f0f/tenor.gif" ) await message.edit(embed=embed) else: embed = Embed( title="Error", description= f"You don't have that amount of cash! `!work` to earn more.", colour=Colour.red()) await ctx.send(embed=embed)
async def work(self, ctx): if not user.registered(ctx.author.id): await user.send_notregistered_msg(ctx) return work_salary = 100 default_salary = 100 tool = "Shovel" metal, gold, diamond = 0, 0, 0 if user.has_jackhammer(ctx.author): tool = "Jackhammer" work_salary = default_salary + settings.WORK_SALARY * 1.00 if user.has_diamonddetector(ctx.author): tool += " & Diamond Detector" if random.randint(0, 100) < settings.DD_VALUABLE_CHANCE: metal = random.randint(1, 5) if random.randint(0, 100) < settings.DD_VALUABLE_CHANCE: gold = random.randint(1, 3) if random.randint(0, 100) < settings.DD_VALUABLE_CHANCE: diamond = random.randint(1, 2) elif user.has_golddetector(ctx.author): tool += " & Gold Detector" if random.randint(0, 100) < settings.GD_VALUABLE_CHANCE: metal = random.randint(1, 5) if random.randint(0, 100) < settings.GD_VALUABLE_CHANCE: gold = random.randint(1, 3) elif user.has_metaldetector(ctx.author): tool += " & Metal Detector" if random.randint(0, 100) < settings.MD_VALUABLE_CHANCE: metal = random.randint(1, 5) elif user.has_drill(ctx.author): tool = "Drill" work_salary = default_salary + settings.WORK_SALARY * 0.75 if user.has_diamonddetector(ctx.author): tool += " & Diamond Detector" if random.randint(0, 100) < settings.DD_VALUABLE_CHANCE: metal = random.randint(1, 5) if random.randint(0, 100) < settings.DD_VALUABLE_CHANCE: gold = random.randint(1, 3) if random.randint(0, 100) < settings.DD_VALUABLE_CHANCE: diamond = random.randint(1, 2) elif user.has_golddetector(ctx.author): tool += " & Gold Detector" if random.randint(0, 100) < settings.GD_VALUABLE_CHANCE: metal = random.randint(1, 5) if random.randint(0, 100) < settings.GD_VALUABLE_CHANCE: gold = random.randint(1, 3) elif user.has_metaldetector(ctx.author): tool += " & Metal Detector" if random.randint(0, 100) < settings.MD_VALUABLE_CHANCE: metal = random.randint(1, 5) elif user.has_pickaxe(ctx.author): tool = "Pickaxe" work_salary = default_salary + settings.WORK_SALARY * 0.50 if user.has_diamonddetector(ctx.author): tool += " & Diamond Detector" if random.randint(0, 100) < settings.DD_VALUABLE_CHANCE: metal = random.randint(1, 5) if random.randint(0, 100) < settings.DD_VALUABLE_CHANCE: gold = random.randint(1, 3) if random.randint(0, 100) < settings.DD_VALUABLE_CHANCE: diamond = random.randint(1, 2) elif user.has_golddetector(ctx.author): tool += " & Gold Detector" if random.randint(0, 100) < settings.GD_VALUABLE_CHANCE: metal = random.randint(1, 5) if random.randint(0, 100) < settings.GD_VALUABLE_CHANCE: gold = random.randint(1, 3) elif user.has_metaldetector(ctx.author): tool += " & Metal Detector" if random.randint(0, 100) < settings.MD_VALUABLE_CHANCE: metal = random.randint(1, 5) else: if user.has_diamonddetector(ctx.author): tool += " & Diamond Detector" if random.randint(0, 100) < settings.DD_VALUABLE_CHANCE: metal = random.randint(1, 5) if random.randint(0, 100) < settings.DD_VALUABLE_CHANCE: gold = random.randint(1, 3) if random.randint(0, 100) < settings.DD_VALUABLE_CHANCE: diamond = random.randint(1, 2) elif user.has_golddetector(ctx.author): tool += " & Gold Detector" if random.randint(0, 100) < settings.GD_VALUABLE_CHANCE: metal = random.randint(1, 5) if random.randint(0, 100) < settings.GD_VALUABLE_CHANCE: gold = random.randint(1, 3) elif user.has_metaldetector(ctx.author): tool += " & Metal Detector" if random.randint(0, 100) < settings.MD_VALUABLE_CHANCE: metal = random.randint(1, 5) mining = utils.get(self.bot.emojis, name="mining") embed = Embed(title=f"{str(mining)}Mining in Progress...", description=f"**Current Tool**: {tool}", colour=Colour.random()) progress = await ctx.send(embed=embed) await asyncio.sleep(15) embed = Embed( title="Mining Finished!", description=f"**You have worked in the mines and earned**\n\ **Salary:** `${int(work_salary)}`\n\ **EXP:** `{settings.WORK_BONUS}`\n\ **Metal:** `{metal}`\n\ **Gold:** `{gold}`\n\ **Diamond:** `{diamond}`", colour=Colour.green()) await progress.edit(embed=embed) user.update_cash(ctx.author, work_salary) user.update_exp(ctx.author, settings.WORK_BONUS) query = """ UPDATE inventory SET metal_metal=metal_metal+?, metal_gold=metal_gold+?, metal_diamond=metal_diamond+? WHERE uid=? """ values = (metal, gold, diamond, user.get_uid(ctx.author)) Connection.SQL_Cursor.execute(query, values) Connection.SQL_Handle.commit() query = """ SELECT record_metal_mined, record_gold_mined, record_diamond_mined FROM record WHERE uid=? """ Connection.SQL_Cursor.execute(query, (user.get_uid(ctx.author), )) result = Connection.SQL_Cursor.fetchone() Connection.SQL_Handle.commit() fetched_metal, fetched_gold, fetched_diamonds = int(result[0]), int( result[1]), int(result[2]) if fetched_metal < metal: query = f"UPDATE record SET record_metal_mined={metal} WHERE uid=?" Connection.SQL_Cursor.execute(query, (user.get_uid(ctx.author), )) Connection.SQL_Handle.commit() if fetched_gold < gold: query = f"UPDATE record SET record_gold_mined={gold} WHERE uid=?" Connection.SQL_Cursor.execute(query, (user.get_uid(ctx.author), )) Connection.SQL_Handle.commit() if fetched_diamonds < diamond: query = f"UPDATE record SET record_diamond_mined={diamond} WHERE uid=?" Connection.SQL_Cursor.execute(query, (user.get_uid(ctx.author), )) Connection.SQL_Handle.commit()
async def show_page(ctx, page): if int(page) == 1: description = \ "Use `!help [command]` for more info on a *command*.\n\ Use `!help [category]` for more info on a *category*.\n\ For more help, join the official bot support server: https://discord.gg/EpDbtGbDv6" embed = Embed(title="Help", description=description, colour=Colour.random()) embed.add_field(name="Categories:", value=emojii.special['empty'], inline=True) empty_field(embed) empty_field(embed) embed.add_field( name="Category: [General]", value= "**Description:** Shows all available commands that are uncategorized.", inline=True) embed.add_field( name="Category: [Casino]", value= "**Description:** Casino System, all gambling related commands, for people who loves risks!", inline=True) embed.add_field( name="Category: [Labor]", value= "**Description:** Labor System, money-earning commands, for industrious people.", inline=True) embed.add_field( name="Category: [Economy]", value= "**Description:** Economy System, commands related to the economy like buying & selling of " "stuffs.", inline=True) embed.add_field( name="Category: [Reaction]", value= "**Description:** Reaction System, how to get reaction stats like reputation, love and more.", inline=True) embed.add_field(name="Category: [Donation]", value="**Description:** Want to donate? Here's how.", inline=True) time = datetime.datetime.now() embed.set_footer( text=time.strftime(f"Page {page} | %B %d, %Y | %I:%M %p")) await ctx.edit(embed=embed) elif int(page) == 2: description = \ "Use `!help [command]` for more info on a *command*.\n\ Use `!help [category]` for more info on a *category*.\n\ For more help, join the official bot support server: https://discord.gg/EpDbtGbDv6" embed = Embed(title="Help", description=description, colour=Colour.random()) embed.add_field( name="Category: [General]", value= "**Description:** Shows all available commands that are uncategorized.", inline=True) time = datetime.datetime.now() embed.set_footer( text=time.strftime(f"Page {page} | %B %d, %Y | %I:%M %p")) await ctx.edit(embed=embed) elif int(page) == 3: description = \ "Use `!help [command]` for more info on a *command*.\n\ Use `!help [category]` for more info on a *category*.\n\ For more help, join the official bot support server: https://discord.gg/EpDbtGbDv6" embed = Embed(title="Help", description=description, colour=Colour.random()) embed.add_field( name="Category: [Casino]", value= "**Description:** Casino System, all gambling related commands, for people who loves risks!", inline=True) time = datetime.datetime.now() embed.set_footer( text=time.strftime(f"Page {page} | %B %d, %Y | %I:%M %p")) await ctx.edit(embed=embed) elif int(page) == 4: description = \ "Use `!help [command]` for more info on a *command*.\n\ Use `!help [category]` for more info on a *category*.\n\ For more help, join the official bot support server: https://discord.gg/EpDbtGbDv6" embed = Embed(title="Help", description=description, colour=Colour.random()) embed.add_field( name="Category: [Labor]", value= "**Description:** Labor System, money-earning commands, for industrious people.", inline=True) time = datetime.datetime.now() embed.set_footer( text=time.strftime(f"Page {page} | %B %d, %Y | %I:%M %p")) await ctx.edit(embed=embed) elif int(page) == 5: description = \ "Use `!help [command]` for more info on a *command*.\n\ Use `!help [category]` for more info on a *category*.\n\ For more help, join the official bot support server: https://discord.gg/EpDbtGbDv6" embed = Embed(title="Help", description=description, colour=Colour.random()) embed.add_field( name="Category: [Economy]", value= "**Description:** Economy System, commands related to the economy like buying & selling of " "stuffs.", inline=True) time = datetime.datetime.now() embed.set_footer( text=time.strftime(f"Page {page} | %B %d, %Y | %I:%M %p")) await ctx.edit(embed=embed) elif int(page) == 6: description = \ "Use `!help [command]` for more info on a *command*.\n\ Use `!help [category]` for more info on a *category*.\n\ For more help, join the official bot support server: https://discord.gg/EpDbtGbDv6" embed = Embed(title="Help", description=description, colour=Colour.random()) embed.add_field( name="Category: [Reaction]", value= "**Description:** Reaction System, how to get reaction stats like reputation, love and more.", inline=True) time = datetime.datetime.now() embed.set_footer( text=time.strftime(f"Page {page} | %B %d, %Y | %I:%M %p")) await ctx.edit(embed=embed) elif int(page) == 7: description = \ "Use `!help [command]` for more info on a *command*.\n\ Use `!help [category]` for more info on a *category*.\n\ For more help, join the official bot support server: https://discord.gg/EpDbtGbDv6" embed = Embed(title="Help", description=description, colour=Colour.random()) embed.add_field(name="Category: [Donation]", value="**Description:** Want to donate? Here's how.", inline=True) time = datetime.datetime.now() embed.set_footer( text=time.strftime(f"Page {page} | %B %d, %Y | %I:%M %p")) await ctx.edit(embed=embed)