def random(): # type: () -> Color tan = Color(0xBEAA3E) return choice([ Color.teal(), Color.dark_teal(), Color.green(), Color.dark_green(), Color.blue(), Color.dark_blue(), Color.purple(), Color.dark_purple(), Color.magenta(), Color.dark_magenta(), Color.gold(), Color.dark_gold(), Color.orange(), Color.dark_orange(), Color.red(), Color.dark_red(), Color.lighter_grey(), Color.darker_grey(), Color.blurple(), tan, ])
def guild_info_em(guild: Guild) -> Embed: return Embed( title=guild.name, description=guild.description or '\u200b', color=Color.dark_magenta() ).add_field( name='Użytkownicy', value=str(guild.member_count), inline=False ).add_field( name='Właściciel', value=f'{guild.owner}\nID: `{guild.owner_id}`', inline=False ).add_field( name='Utworzono', value=guild.created_at.strftime('%Y-%m-%d %H:%M'), inline=False ).add_field( name='Poziom Nitro Boost', value=guild.premium_tier, inline=False ).add_field( name='Kanały tekstowe, głosowe, kategorie', value=f'{len(guild.text_channels)}/{len(guild.voice_channels)}/{len(guild.categories)}', inline=False ).add_field( name='Region', value=str(guild.region).capitalize(), inline=False ).set_thumbnail( url=guild.icon_url )
def random(): c = [ Color.teal(), Color.dark_teal(), Color.green(), Color.dark_green(), Color.blue(), Color.dark_blue(), Color.purple(), Color.dark_purple(), Color.magenta(), Color.dark_magenta(), Color.gold(), Color.dark_gold(), Color.orange(), Color.dark_orange(), Color.red(), Color.dark_red(), Color.lighter_grey(), Color.darker_grey(), Color.blurple(), tan, icedcoffee, chilipepper ] return c[randint(0, len(c) - 1)]
def __init__(self, client): self.client = client self.client_color = Color.red() self.color_dict = { 1: [Color.teal(), 'teal'], 2: [Color.dark_teal(), 'dark_teal'], 3: [Color.green(), 'green'], 4: [Color.dark_green(), 'dark_green'], 5: [Color.blue(), 'blue'], 6: [Color.dark_blue(), 'dark_blue'], 7: [Color.purple(), 'purple'], 8: [Color.dark_purple(), 'dark_purple'], 9: [Color.magenta(), 'magenta'], 10: [Color.dark_magenta(), 'dark_magenta'], 11: [Color.gold(), 'gold'], 12: [Color.dark_gold(), 'dark_gold'], 13: [Color.orange(), 'orange'], 14: [Color.dark_orange(), 'dark_orange'], 15: [Color.red(), 'red'], 16: [Color.dark_red(), 'dark_red'], 17: [Color.lighter_grey(), 'lighter_grey'], 18: [Color.dark_grey(), 'grey'], 19: [Color.light_grey(), 'light_grey'], 20: [Color.darker_grey(), 'darker_grey'] }
def random(): # type: () -> Color chilipepper = Color(0x9B1B30) tan = Color(0xBEAA3E) icedcoffee = Color(0xB18F6A) return choice([ Color.teal(), Color.dark_teal(), Color.green(), Color.dark_green(), Color.blue(), Color.dark_blue(), Color.purple(), Color.dark_purple(), Color.magenta(), Color.dark_magenta(), Color.gold(), Color.dark_gold(), Color.orange(), Color.dark_orange(), Color.red(), Color.dark_red(), Color.lighter_grey(), Color.darker_grey(), Color.blurple(), tan, icedcoffee, chilipepper, ])
async def username(self, ctx: Context, lim: int = 30): op = generate(lim) if lim == 30: op = generate(random.randint(20, 50)) embed = Embed( title=op, description='That sounds cool :', color=Color.dark_magenta()) await ctx.send(embed=embed)
async def haveiever(self, ctx: Context) -> None: """Have i Ever?.""" strings = config.talk_games["nhie"] choices = len(strings) i = random.randint(0, choices - 1) embed = Embed(title="Have I ever?", description=f"Have you ever ..{strings[i]}", color=Color.dark_magenta()) await ctx.send(embed=embed)
async def wouldyourather(self, ctx: Context) -> None: """Would you rather?.""" strings = config.talk_games["wyr"] choices = len(strings) i = random.randint(0, choices - 1) embed = Embed(title="Would you rather?", description=f"Would you rather ..{strings[i]}", color=Color.dark_magenta()) await ctx.send(embed=embed)
async def dare(self, ctx: Context, *, user: Member) -> None: """Dare someone.""" strings = config.talk_games["dares"] str_len = len(strings) random_dare = random.randint(0, str_len - 1) # TODO: choose only non-offline users member_len = len(ctx.guild.members) random_user = random.randint(0, member_len - 1) name = ctx.guild.members[random_user].mention embed = Embed(title=f"{ctx.author.name} dared {user.name}", description=strings[random_dare].format(name=name), color=Color.dark_magenta()) await ctx.send(embed=embed)
async def set_yoink(self, ctx, arg, message_id: Optional[int]): message_id = message_id or None if arg == "clear" or arg == "clr": db.execute("UPDATE guilds SET yoinker_id = ? WHERE guild_id = ?;", None, ctx.guild.id) db.commit() embed = create_embed( "Yoinker Message Cleared", f"Yoinker message was cleared by {ctx.message.author}", color=Color.red()) log_channel = self.bot.get_log_channel(ctx.guild.id) if log_channel is not None: await log_channel.send(embed=embed) await ctx.send(f"Successfully cleared yoinker.") return elif arg == "set": if message_id is None: await ctx.send("Please enter a valid message ID.") return else: print("returning") return message = await ctx.fetch_message(message_id) if message_id == get_guild_yoinker(ctx.guild.id): await ctx.send("Yoinker already set to that message.") # elif not re.match("\d", message_id): # await ctx.send("Invalid message ID. Enter message ID for reaction emote yoinker.") else: db.execute("UPDATE guilds SET yoinker_id = ? WHERE guild_id = ?;", message_id, ctx.guild.id) db.commit() self.bot.reaction_yoink = message_id embed = create_embed( "New Yoinker Message Set", f"Yoinker message set to message with id {message_id}. {message.jump_url} by {ctx.message.author}.", color=Color.dark_magenta()) log_channel = self.bot.get_log_channel(ctx.guild.id) if log_channel is not None: await log_channel.send(embed=embed) await ctx.send( f"Successfully set yoinker to message with id {message_id}.")
def get_embed_store_ui(): """ Returns an embed message corresponding to the store message -- output: embed: interactions.Embed """ fields = [] for emoji, powerup in Constants.POWERUPS_STORE.items(): fields.append( EmbedField(name=emoji, value=powerup.get_store_str(), inline=True)) embed = Embed(title="Piflouz shop", description="Here you can buy useful upgrades!", color=Color.dark_magenta().value, fields=fields) return embed
async def cgl(ctx, *args): if args: url = "https://craigslist.org/search/sss?query=" + "+".join(args) await client.say(embed=Embed(description="**[Craigslist](%s)**" % url, color=Color.dark_magenta())) await client.delete_message(ctx.message)
async def hangman(self, ctx: Context) -> None: def display_hangman(tries: int) -> str: stages = [ # final state: head, torso, both arms, and both legs r"""``` -------- | | | O | \|/ | | | / \ - ```""", # head, torso, both arms, and one leg r"""``` -------- | | | O | \|/ | | | / - ```""", # head, torso, and both arms r"""``` -------- | | | O | \|/ | | | - ```""", # head, torso, and one arm r"""``` -------- | | | O | \| | | | - ```""", # head and torso r"""``` -------- | | | O | | | | | - ```""", # head r"""``` -------- | | | O | | | - ```""", # initial empty state r"""``` -------- | | | | | | - ```""", ] return stages[tries] def check(message: Message) -> bool: return message.author == ctx.author and message.channel == ctx.channel word = random.choice(word_list).upper() word_completion = "#" * len(word) guessed = False guessed_letters = [] guessed_words = [] tries = 6 await ctx.send( embed=Embed(title="Let's play Hangman!", color=Color.dark_green())) embed = Embed(title="Hangman Status", color=Color.dark_teal()) embed.add_field(name="**❯❯ Hang Status**", value=display_hangman(tries), inline=False) embed.add_field(name="**❯❯ Word Completion Status**", value=f"**{word_completion}**", inline=False) embed.set_footer(text="Powered By HotWired.") await ctx.send(embed=embed) while not guessed and tries > 0: await ctx.send( embed=Embed(description="Please guess a letter or word: ", color=Color.gold())) input = await self.bot.wait_for("message", check=check) guess = input.content.upper() if len(guess) == 1 and guess.isalpha(): if guess in guessed_letters: await ctx.send(embed=Embed( description=f"You already guessed the letter {guess}", color=Color.red())) elif guess not in word: await ctx.send( embed=Embed(description=f"{guess} is not in the word.", color=Color.dark_magenta())) tries -= 1 guessed_letters.append(guess) else: await ctx.send(embed=Embed( description=f"Good job, {guess} is in the word!", color=Color.dark_green())) guessed_letters.append(guess) word_as_list = list(word_completion) indices = [ i for i, letter in enumerate(word) if letter == guess ] for index in indices: word_as_list[index] = guess word_completion = "".join(word_as_list) if "#" not in word_completion: guessed = True elif len(guess) == len(word) and guess.isalpha(): if guess in guessed_words: await ctx.send(embed=Embed( description=f"You already guessed the word {guess}", color=Color.red())) elif guess != word: await ctx.send( embed=Embed(description=f"{guess} is not the word.", color=Color.dark_orange())) tries -= 1 guessed_words.append(guess) else: guessed = True word_completion = word else: await ctx.send(embed=Embed(description="Not a valid guess.", color=Color.blurple())) embed = Embed(title="Hangman Status", color=Color.dark_teal()) embed.add_field(name="**❯❯ Hang Status**", value=display_hangman(tries), inline=False) embed.add_field(name="**❯❯ Word Completion Status**", value=f"**{word_completion}**", inline=False) embed.set_footer(text="Powered By HotWired.") await ctx.send(embed=embed) if guessed: await ctx.send(embed=Embed( description= "Congrats, you guessed the word! You win! :partying_face: ", color=Color.dark_green())) else: await ctx.send(embed=Embed( description= f"Sorry, you ran out of tries. The word was {word}. Maybe next time! :frowning: ", color=Color.red()))