async def choose(self, ctx, *args): """ Make a random choice from given items """ # Bamboozeled with nothing to choose from if len(args) == 0: embed_msg = Embed( title="Much bamboozel, such confuse", description= "Stoopid hooman, you have to give me something to choose from!", color=Color.dark_gold()) embed_msg.set_image(url=self.bamboozel) await ctx.send(embed=embed_msg) # Many choice, such decision elif len(args) == 1: await ctx.send(f"Such a hard choice, I choose '{args[0]}'") # Take a random pick else: await ctx.send( f"{len(args)} items given to choose from...\nHmmm...") await sleep(2) embed_msg = Embed(title=f"I choose '{choice(args)}'!", color=Color.random()) embed_msg.set_image(url=self.i_choose_you) await ctx.send(embed=embed_msg)
async def on_message_delete(message): if message.author.bot: return None attachment = None additional_attachments = [] if message.attachments: attachment = message.attachments[0].proxy_url additional_attachments = ",".join( [att.proxy_url for att in message.attachments[1:]]) embed = Embed(title=f'{message.author.name} excluiu uma mensagem', description=message.content, color=Color.random(), url=message.jump_url) embed.set_thumbnail(url=message.author.avatar_url) if attachment: embed.set_image(url=attachment) if additional_attachments: embed.description = f"{embed.description}\n\nimgs-{additional_attachments}" send_to = message.channel.guild.get_channel(HE) if message.channel.guild.id == TEST_SV: send_to = message.channel await send_to.send(embed=embed)
async def shop_command(self, ctx, category: str = None): inline = False with open("./data/json/shop.json", "r") as f: shop_json = load(f) shop_embed = Embed(title='SHOP', timestamp=datetime.utcnow(), color=Color.random()) if category is None: for categories in shop_json: name = categories shop_embed.add_field( name=f'{name}', value=f'do `{self.bot.PREFIX}shop {name}`', inline=inline) else: for item in shop_json[category]: name = item['name'] item_name = item['item_name'] price = item['price'] HTB = item['HowToBuy'] HTS = item['HowToSell'] shop_embed.add_field(name=f'{item_name}', value=f'Price: {price} \n ' f'How To Buy: {HTB} \n ' f'How To Sell: {HTS}', inline=inline) await ctx.send(embed=shop_embed)
async def get_embed_raffle(self, bot): """ Returns an embed message corresponding to the raffle message -- input: bot: interactions.Client """ desc = f"Today's raffle is special! Click the button below to participate, and it's completely free! {self.reward} {Constants.PIFLOUZ_EMOJI} are at stake! The first winner will earn 50%, the second one wille get 30% and the third winner wille get 20%!" fields = [] if "birthday_raffle_participation" in db.keys() and len( db["birthday_raffle_participation"]) > 0: participation = list(db["birthday_raffle_participation"]) val = "\n".join(f"• <@{user_id}>" for user_id in participation) fields.append( EmbedField(name="Current participants", value=val, inline=False)) fields.append( EmbedField( name="Total prize", value= f"The three winners will earn 50%, 30% and 20% of the total jackpot of {self.reward} {Constants.PIFLOUZ_EMOJI}!", inline=False)) embed = Embed( title="Birthday Special Raffle!", description=desc, color=Color.random().value, thumbnail=EmbedImageStruct(url=Constants.PIBOU4BIRTHDAY_URL)._json, fields=fields) return embed
async def leave(ctx): em = discord.Embed( title="Leave", description="Makes the bot leave the voice channel that it's in.", color=Color.random()) em.add_field(name="**Syntax**", value=">leave") await ctx.send(embed=em)
def __init__(self): super().__init__( title="📷 Avatar 📷", description='Envie a este chat a imagem (JPEG ou PNG) que será utilizada no seu perfil de jogador.' '\n\nCaso você queira utilizar seu avatar do Discord, responda com "0".', color=Color.random() )
async def happy_bday(self): """Task for birthday celebration.""" servers = (session.query(BDay).filter( or_(BDay.last_notify != func.date(datetime.today()), BDay.last_notify == None)).all()) current_year = datetime.today().year for s in servers: users = (session.query(User).filter( extract("month", User.birthday) == datetime.today().month, extract("day", User.birthday) == datetime.today().day, User.guild_id == s.guild_id, ).all()) if len(users): channel = self.bot.get_channel(s.channel_id) embed = Embed( title=self.inflect.inflect( f"Today there plural('is', {len(users)}) number_to_words({len(users)}) plural('member', {len(users)}) celebrating plural('its', {len(users)}) birthday!\n \U0001F382 \U0001F388 \U0001F389" ), color=Color.random(), description=f"{channel.guild.default_role}", ) bday_user = [ f"<@!{u.member_id}> ({current_year - u.birthday.year})" for u in users ] embed.add_field(name=f"Let's all wish a happy birthday to:", value=self.inflect.join(bday_user)) await channel.send(embed=embed) s.last_notify = datetime.today() session.commit()
async def kill_user(self, ctx, user: Member = None): kill_log = [f'"{ctx.author.display_name}" took "{user.display_name}\'s" balls out. wtf', f'"{ctx.author.display_name}" roasted "{user.display_name}"', f'"{user.display_name}" fell out of the world (WTF ?!)', f'"{user.display_name}" fell down a cliff while playing Pokemon Go. Good job on keeping your nose in that puny phone.', f'"{user.display_name}" takes an arrow to the knee. And everywhere else.', f'"{user.display_name}" drowned in their own tears.'] if user is None: wut = self.bot.get_emoji(settings['emojis']['wut']) await ctx.send(f"{wut} who is the user to kill ?") return if user == self.bot.user: em = Embed(title='You cannot kill me !', color=Color.random()) em.set_image(url="https://i.kym-cdn.com/photos/images/newsfeed/001/488/935/c09.jpg") await ctx.send(embed=em) return if user == ctx.author: await ctx.send("DO NOT") await ctx.send("DO") await ctx.send("IT!!") return else: kill_feed = choice(kill_log) await ctx.send(f"{kill_feed}") return
async def on_message(self, message): if message.author == self.bot.user: return if str(message.channel.type) == "private": mod_mail_channel = self.bot.get_channel( settings["channel"]['mod_mail']) ModMailMessageEmbed = Embed( title="Mod Mail", description=f"from {message.author.name}", timestamp=datetime.utcnow(), color=Color.random()) ModMailMessageEmbed.add_field(name='Help !', value=f'{message.content}', inline=False) await mod_mail_channel.send(embed=ModMailMessageEmbed) elif str(message.channel ) == "stdout-mod-mail" and message.content.startswith("<"): member_object = message.mentions[0] index = message.content.index(" ") string = message.content mod_message = string[index:] await member_object.send(f"{mod_message}")
async def get_fact(ctx): fact_title = 'Fact You' fact_text, fact_url = get_random_fact() embed = discord.Embed(title=fact_title, url=fact_url, description=fact_text, color=Color.random()) await ctx.send(embed=embed)
async def stop(ctx): em = discord.Embed( title="Clear", description= "Clears the bot of the current song and puts the bot in a ready state.", color=Color.random()) em.add_field(name="**Syntax**", value=">clear") await ctx.send(embed=em)
async def playURL(ctx): em = discord.Embed( title="PlayURL", description= "Plays a song given a URL. If not already in a voice channel, it will join the channel that the command caller is in.", color=Color.random()) em.add_field(name="**Syntax**", value=">play <YouTube URL>") await ctx.send(embed=em)
def __init__(self): super().__init__( title="🔎 Redes sociais 🔎", description='Por fim, envie a este chat seu instagram/portfolio/github/link/site ou o que lhe for ' 'conveniente (não utilize @).\n\nCaso você não queira se tornar famoso(a) diante ' 'de nós, responda com "0".', color=Color.random() )
def __init__(self): super().__init__( title="🎭 Referências artísticas 🎭", description='Envie a este chat quaisquer referências artísticas de seu gosto. ' 'O desenvolvedor desse bot provavelmente teria Paramore incluído ' 'na resposta.\n\nCaso você não queira apresentá-los, responda com "0".', color=Color.random() )
def __init__(self): super().__init__( title="🎲 Interesses temáticos 🎲", description='Envie a este chat seus interesses temáticos relacionados a criação de um jogo. ' 'Exemplo: "quero fazer um jogo não digital de RPG com a temática Cyberpunk".' '\n\nCaso você não queira declará-los, responda com "0".', color=Color.random() )
def __init__(self): super().__init__( title="📌 Nome de jogador 📌", description='Envie a este chat seu nome de jogador. Pode ser aquele seu nickname no lolzinho' ' ou um apelido que você curta. Evite envios do tipo "xxXdestroiNoivas99Xxx".' '\n\nCaso você queira usar seu nickname do Discord, responda com "0".', color=Color.random() )
def __init__(self): super().__init__( title="🥇 Habilidades de classe 🥇", description='Envie a este chat skills relacionadas a sua classe de maior ' 'domínio. Se você é um(a) Programador(a) de nível Avançado, ' 'por exemplo, pode responder algo como: "mago(a) em C# 😎".\n\n' 'Caso você não queira declarar suas maestrias, responda com "0".', color=Color.random() )
async def help(ctx): em = discord.Embed( title="Help", description= "Use >help <command> for extended info\nRemember, this is freshly in development so don't be too rough. If you come across an error, message my creator <@184833237535686658>.", color=Color.random()) em.add_field(name="Music", value="play, stop, resume, pause, leave") em.add_field(name="Fun", value="kiss") await ctx.send(embed=em)
async def callback(self, interaction: Interaction): embed = Embed(title="Your Modal Results", color=Color.random()) embed.add_field(name="First Input", value=self.children[0].value, inline=False) embed.add_field(name="Second Input", value=self.children[1].value, inline=False) await interaction.response.send_message(embeds=[embed])
def __init__(self): super().__init__( title="🏆 Habilidades especiais 🏆", description='Envie a este chat sua skill especial! Estas são habilidades que não são ' 'diretamente relacionadas a esta disciplina, mas sim, a sua trajetória! ' 'Se você é das Ciências Biológicas, por exemplo, pode responder algo como: ' '"Sei o nome científico de todos os gorilas que ainda não foram extintos ✌🏻".\n\n' 'Caso você não queira declarar suas maestrias, responda com "0".', color=Color.random() )
def __init__(self): super().__init__( title="📚 Interesses de aprendizado 📚", description='Envie a este chat seus interesses de aprendizado, tanto ' 'disciplinares, quanto gerais. Se você está interessado(a) ' 'em Programação, por exemplo, pode responder algo como: ' '"Quanto aos games, me interesso pela criação de mapas ' 'procedurais. Fora isso, também me amarro em IA.".\n\n' 'Caso você não queira declará-los, responda com "0".', color=Color.random() )
def get_move_text(origin: Message, dest: Message, author: Member): dest_text = f"""{author.mention} has dialed in an incoming wormhole from {origin.channel.mention}. [(A conversation)]({origin.jump_url}) has been requested to move here.""" origin_text = f"""{author.mention} has dialed a wormhole to {dest.channel.mention}. The conversation has been requested to move there. [(Click)]({dest.jump_url})""" color = Color.random() dest_embed = Embed(color=color, title="Unscheduled Offworld Activation...", description=dest_text) origin_embed = Embed(color=color, title="Chevron 7 Locked...", description=origin_text) return origin_embed, dest_embed
def get_embed(self): """ Returns an embed to announce the event -- output: embed: interactions.Embed """ desc = f"Use `/wordle guess [word]` to try to find the word of the day and earn {self.reward}{Constants.PIFLOUZ_EMOJI}!\nYou can also check your progress with `/wordle status`" embed = Embed( title="New Wordle!", description=desc, color=Color.random().value, thumbnail=EmbedImageStruct(url=Constants.PIBOU4STONKS_URL)._json, fields=[]) return embed
def get_embed(self): """ Returns an embed to announce the event -- output: embed: interactions.Embed """ descriptions = [p.get_event_str() for p in self.powerups] content = "\n".join(descriptions) field = EmbedField(name="The following powerups are active:", value=content) embed = Embed( title="Event of the day", color=Color.random().value, thumbnail=EmbedImageStruct(url=Constants.PIBOU4STONKS_URL)._json, fields=[field]) return embed
async def get_embed_raffle(self, bot): """ Returns an embed message corresponding to the raffle message -- input: bot: interactions.Client """ desc = f"Here is the new raffle! Use `/raffle n` to buy `n` 🎟️!\n\ They cost {self.ticket_price} {Constants.PIFLOUZ_EMOJI} each\n\ The user with the winning ticket will earn {100 - self.tax_ratio}% of the total money spent by everyone!" fields = [] if "raffle_participation" in db.keys() and len( db["raffle_participation"]) > 0: participation = db["raffle_participation"] async def get_str(key_val): user_id, nb_tickets = key_val return f"<@{user_id}> - {nb_tickets}\n" tasks = [get_str(key_val) for key_val in participation.items()] res = await asyncio.gather(*tasks) val = "".join(res) total_prize = self.get_raffle_total_prize() fields.append( EmbedField(name="Current 🎟️ bought", value=val, inline=False)) fields.append( EmbedField( name="Total prize", value= f"The winner will earn {total_prize} {Constants.PIFLOUZ_EMOJI}!", inline=False)) embed = Embed( title="New Raffle!", description=desc, color=Color.random().value, thumbnail=EmbedImageStruct(url=Constants.PIBOU4STONKS_URL)._json, fields=fields) return embed
async def resume(ctx): em = discord.Embed(title="Resume", description="Resumes the bot if it is paused.", color=Color.random()) em.add_field(name="**Syntax**", value=">resume") await ctx.send(embed=em)
async def pause(ctx): em = discord.Embed(title="Pause", description="Pauses the bot if it is playing.", color=Color.random()) em.add_field(name="**Syntax**", value=">pause") await ctx.send(embed=em)
async def help_command(self, ctx, help_type: str = None): # main help set if not help_type: embed = Embed( title="HELP MENU", description= f"put `{self.bot.PREFIX}` before the command for the bot to see the command", color=Color.random()) inline = True coolBoi = self.bot.get_emoji(settings['emojis']['cool_boi']) embed.add_field(name='1. 💰 Economy 💰', value=f'type `{self.bot.PREFIX}help economy`', inline=inline) embed.add_field(name='2. ⚙️ ️help_typeration ⚙️', value=f'type `{self.bot.PREFIX}help mod`', inline=inline) embed.add_field(name='3. ⬆️ Level ⬆️', value=f'type `{self.bot.PREFIX}help level`', inline=inline) embed.add_field(name=f'4. {coolBoi} Fun {coolBoi}', value=f'type `{self.bot.PREFIX}help fun`', inline=inline) embed.add_field(name='5. 🖥️ Server 🖥️', value=f'type `{self.bot.PREFIX}help server`', inline=inline) embed.add_field(name='6. 🔈 Voice 🔈', value=f'type `{self.bot.PREFIX}help vc`', inline=inline) embed.add_field( name='Still need help ?', value= 'DM me and I will try to reply as soon as possible :smile:', inline=False) embed.set_footer( text='thing in `<>` are necessary, and `()` are optional') await ctx.send(embed=embed) # each help type elif help_type == "vc": pass embed_vc = Embed( title="HELP MENU", description= 'For VC commands\n (you have to be in a VC to use these commands)', color=Color.random()) inline_vc = False embed_vc.add_field( name='📛 Change Name 📛', value= f'`{self.bot.PREFIX}name <name>` for changing the name of VC', inline=inline_vc) embed_vc.add_field( name='🛃 Set Limit 🛃', value= f'`{self.bot.PREFIX}limit <limit>` for changing the limit of VC', inline=inline_vc) embed_vc.add_field( name='🛑 Lock VC 🛑', value=f'`{self.bot.PREFIX}lock` to lock the VC you are in.', inline=inline_vc) embed_vc.add_field( name='🟢 Unlock VC 🟢', value= f'`{self.bot.PREFIX}unlock` to unlocking the VC you are in', inline=inline_vc) await ctx.send(embed=embed_vc) elif help_type == "fun": gud = self.bot.get_emoji(settings['emojis']['gud']) cute = self.bot.get_emoji(settings['emojis']['cute_cat']) doot = self.bot.get_emoji(settings['emojis']['doot']) cute_hi = self.bot.get_emoji(settings['emojis']['CuteDragonHi']) embed_fun = Embed(title="HELP MENU", description="for fun commands", color=Color.random()) inline_fun = False embed_fun.add_field( name=f'😵 Kill 😵', value= f'`{self.bot.PREFIX}kill <user>` to kill the user (not actaully)', inline=inline_fun) embed_fun.add_field(name=f'{cute_hi} hello {cute_hi}', value=f'`{self.bot.PREFIX}hello`, Hello !', inline=inline_fun) embed_fun.add_field( name='lenny', value=f'`{self.bot.PREFIX}lenny`, just do it !', inline=inline_fun) embed_fun.add_field(name=f'{cute} cute {cute}', value=f'`{self.bot.PREFIX}cute`, just do it !', inline=inline_fun) embed_fun.add_field( name=f'{doot} doot {doot}', value= f'`{self.bot.PREFIX}doot <message>`, give a nice design to message', inline=inline_fun) embed_fun.add_field( name=f'{gud} dankrate {gud}', value=f'`{self.bot.PREFIX}drankrate`, tell your dankrate.', inline=inline_fun) embed_fun.add_field( name='💻 hack 💻', value=f'`{self.bot.PREFIX}hack <user>`, hacks the user.', inline=inline_fun) embed_fun.add_field( name='🗣️ say 🗣️', value=f'`{self.bot.PREFIX}say <message>`, says a message', inline=inline_fun) await ctx.send(embed=embed_fun) elif help_type == "server": inline_server = False embed_server = Embed(title='HELP MENU', description='for help regarding the server', color=Color.random()) embed_server.add_field( name='Rule', value= 'https://discord.com/channels/732263342181187595/765829498175356968/784747350815408138', inline=inline_server) embed_server.add_field( name='Owner', value=f'<@{settings["owner"]}> is our owner') embed_server.add_field( name='Bot Developer', value=f'<@{settings["dev"]}> is my developer') embed_server.add_field( name='More Help', value= 'if need more help DM me and i will try to reply as soon as possible ! :smile:' ) await ctx.send(embed=embed_server) elif help_type == "economy": embed_economy = Embed(title="HELP MENU", description="for Economy", color=Color.random()) inline_economy = False embed_economy.add_field( name=f"🏦 BALANCE", value= f"`{self.bot.PREFIX}bal (user)` to see the balance of your / user's account", inline=inline_economy) embed_economy.add_field( name=f"🗓️ DAILY", value= f"`{self.bot.PREFIX}daily` or `/d` to get your daily reward", inline=inline_economy) embed_economy.add_field( name=f'BEG', value=f'`{self.bot.PREFIX}beg` to beg money.', inline=inline_economy) embed_economy.add_field( name=f"📝 WITHDRAW", value= f"`{self.bot.PREFIX}withdraw <amount>` or `{self.bot.PREFIX}withdraw all` to withdraw money", inline=inline_economy) embed_economy.add_field( name=f"📝 DEPOSIT", value= f"`{self.bot.PREFIX}deposit <amount>` or `/deposit all` to deposit your money", inline=inline_economy) embed_economy.add_field( name=f"🤝 PAY", value= f"`{self.bot.PREFIX}pay <user> <amount>` to pay the user money", inline=inline_economy) embed_economy.add_field( name=f"🕵️ ROB", value= f"`{self.bot.PREFIX}rob <user>` to steal money from the user", inline=inline_economy) embed_economy.add_field( name='🪙 COINFLIP', value= f'`{self.bot.PREFIX}flip <amount> <h / t>`, to flip a coin') embed_economy.add_field( name=f"🎲 GAMBLE", value= f"`{self.bot.PREFIX}gamble <amount>` to gamble with money", inline=inline_economy) await ctx.send(embed=embed_economy) elif help_type == "mod": embed_mod = Embed(title="HELP MENU", description='for help_typeration', color=Color.random()) inline_mod = False Bot_owner_role = utils.get(ctx.guild.roles, id=settings['roles']['bot_owner']) embed_mod.add_field( name='🧹 clear', value=f"`{self.bot.PREFIX}clear (amount)` to clear message", inline=inline_mod) embed_mod.add_field( name='🔇 mute', value=f"`{self.bot.PREFIX}mute <user>` to clear message", inline=inline_mod) embed_mod.add_field( name='🔈 unmute', value=f"`{self.bot.PREFIX}unmute <user>` to clear message", inline=inline_mod) embed_mod.add_field( name='⚠️ warn', value=f"`{self.bot.PREFIX}warn <user>` to clear message", inline=inline_mod) embed_mod.add_field( name='🛑 stop', value= f"`{self.bot.PREFIX}shutdown` to stop the bot (can be only user by {Bot_owner_role.mention})", inline=inline_mod) embed_mod.add_field( name='🕰️ Time', value= f'`{self.bot.PREFIX}time` to see this time (this can be used by everyone)' ) embed_mod.set_footer( text= 'these commands can only be done by a Trusted Staff or above') await ctx.send(embed=embed_mod) elif help_type == "level": inline_level = False embed_level = Embed(title='HELP MENU', description='for level', color=Color.random()) embed_level.add_field( name='Level', value= f'`{self.bot.PREFIX}level (user)` to see your/user\'s level', inline=inline_level) embed_level.add_field( name='Rank', value= f'`{self.bot.PREFIX}rank (user)`, working on to make this on a card...', inline=inline_level) embed_level.add_field( name='Leaderboard', value= f'`{self.bot.PREFIX}lb`, to see this leaderboard of levels.') await ctx.send(embed=embed_level) else: helpme = self.bot.get_emoji(settings['emojis']['help_me']) embed_error = Embed(title=f"HELP MENU", color=Color.random()) embed_error.add_field(name=f'ERROR', value=f'category not available {helpme}') embed_error.add_field( name=f'Still need help ?', value= f'DM me and I will try to reply as soon as possible :smile:', inline=False) await ctx.send(embed=embed_error)
def embed_constructor(xkcd: dict) -> Embed: return (Embed(title=f"{xkcd['num']}: {xkcd['title']}", url=f"https://xkcd.com/{xkcd['num']}", color=Color.random()).set_image( url=xkcd["img"]).set_footer(text=xkcd["alt"]))
async def kiss(ctx): em = discord.Embed(title="Kiss", description="Kisses the person that you mention", color=Color.random()) em.add_field(name="**Syntax**", value=">kiss <@User>") await ctx.send(embed=em)