Exemple #1
0
 async def info(self, ctx, stock: str):
     """Shows the info of a particular stock!"""
     info = self.db.get_stock(stock)
     if len(info) == 0:
         await ctx.channel.send(
             embed=self.embed("No stock called '%s' found in database." %
                              stock))
         return
     rating, maxrating = await self.cf.get_rating(
         stock), await self.cf.get_best_rating(stock)
     market = 0
     for owner, quantity in info:
         if owner == -1:
             market = quantity
     e = Embed(title="Stock info for %s" % stock, color=Color.dark_blue())
     e.add_field(name="Current Value",
                 value="**$%.2f**" % self.stock_value(rating),
                 inline=False)
     e.add_field(name="Max. Value",
                 value="$%.2f" % self.stock_value(maxrating),
                 inline=False)
     e.add_field(name="Available Stocks in market",
                 value="%d" % market,
                 inline=False)
     e.set_footer(text="Requested by " + str(ctx.author),
                  icon_url=ctx.author.avatar_url)
     await ctx.channel.send(embed=e)
Exemple #2
0
 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']
     }
Exemple #3
0
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,
    ])
Exemple #4
0
    async def support_msg(self,
                          ctx: Context,
                          *,
                          message: str = "Support Required!") -> None:
        """Send a support message to the developers."""
        support_channel = self.bot.get_channel(config.support_channel)

        embed = Embed(title="Support!",
                      description=message,
                      color=Color.dark_blue())
        embed.add_field(name="Author",
                        value=f"{ctx.author.id} | {ctx.author.mention}")
        await support_channel.send(embed=embed)

        embed = Embed(
            title="Problem's still there?",
            description=textwrap.dedent(
                "If you still have **problems with the bot**"
                ", Join the Support Server now and our developers will happily help you"
                f"\n❯❯ [Support Server]({config.SUPPORT_SERVER})"
                f"\n❯❯ [Invite Link]({config.invite_link})"),
            color=Color.dark_green(),
        )
        embed.set_thumbnail(url=self.bot.user.avatar_url)
        await ctx.send(embed=embed)
Exemple #5
0
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,
    ])
Exemple #6
0
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)]
Exemple #7
0
 async def log_message(self, msg):
     # pass only if in direct messages
     if msg.guild: return
     if msg.author.id in self.blocked_list["ids"]: return
     # log own messages as an embed in the proper channel
     if msg.author == self.bot.user:
         embed = Embed(
             title=
             f"Direct Message → {msg.channel.recipient} ({msg.channel.recipient.id})",
             description=msg.content,
             color=Color.orange())
         return await self.bot.config.channels.log.send(embed=embed)
     # log message only if is not bot user
     elif msg.author.bot:
         return
     else:
         embed = Embed(
             title=f"Direct Message — {msg.author} ({msg.author.id})",
             description=msg.content,
             color=Color.dark_blue())
         if msg.attachments:
             embed.set_image(url=msg.attachments[0].url)
             if len(msg.attachments) > 1:
                 embed.set_footer(
                     text=
                     f"{len(msg.attachments) - 1} attachment(s) not shown")
             else:
                 embed.set_footer(text="1 attachment")
         await self.bot.config.channels.log.send(embed=embed)
         # also save for later
         if self.latest_task:
             self.latest_task.cancel()
         self.latest_task = self.bot.loop.create_task(
             self.latest_message(msg))
Exemple #8
0
 async def github(self, ctx: Context) -> None:
     """Send a link to the bots GitHub repository."""
     await ctx.send(embed=Embed(
         title="Github Repo",
         description=
         f"[Click Here]({config.github_repo_link}) to visit the Open Source Repo of HotWired",
         color=Color.dark_blue(),
     ))
Exemple #9
0
 async def ping(self, ctx):
     """
     Check the bot's latency
     """
     e = Embed(title="Pong!")
     e.add_field(name=f"{self.bot.get_emoji(721097479508197479)} Latency",
                 value=f"{int(self.bot.latency * 1000)} ms")
     e.color = Color.dark_blue()
     await ctx.send("", embed=e)
Exemple #10
0
    async def on_guild_channel_update(self, channel_before: GuildChannel,
                                      channel_after: GuildChannel) -> None:
        if channel_before.overwrites != channel_after.overwrites:
            description = f"**Channel:** {channel_after.mention}\n"

            last_log = await last_audit_log_with_fail_embed(
                channel_after.guild,
                actions=[
                    AuditLogAction.overwrite_create,
                    AuditLogAction.overwrite_delete,
                    AuditLogAction.overwrite_update
                ],
                send_callback=partial(self.send_log, channel_after.guild))

            if last_log:
                description += f"**Updated by:** {last_log.user.mention}\n\n"

            embed = Embed(
                title=f"{self.channel_type(channel_after)} permissions updated",
                description=description,
                color=Color.dark_blue())

            embed = add_channel_perms_field(embed, channel_before,
                                            channel_after)
        else:
            description = f"**Channel:** {channel_after.mention}"

            last_log = await last_audit_log_with_fail_embed(
                channel_after.guild,
                actions=[AuditLogAction.channel_update],
                send_callback=partial(self.send_log, channel_after.guild))

            if last_log:
                description += f"\n**Updated by:** {last_log.user.mention}"

            embed = Embed(title=f"{self.channel_type(channel_after)} updated",
                          description=description,
                          color=Color.dark_blue())
            embed = add_change_field(embed, channel_before, channel_after)

        embed.timestamp = datetime.datetime.now()
        embed.set_footer(text=f"Channel ID: {channel_after.id}")

        await self.send_log(channel_after.guild, embed=embed)
Exemple #11
0
    async def _get_input(self, ctx: commands.Context, title: str, description: str):
        await ctx.send(
            embed=Embed(title=title, description=description, color=Color.dark_blue())
        )

        def check(m: Message):
            return m.author == ctx.author and m.channel == ctx.channel

        res: Message = await self.bot.wait_for("message", check=check, timeout=120)
        return await commands.clean_content().convert(ctx, res.content)
Exemple #12
0
    async def start(self, ctx: SlashContext):
        """Changes the activity of the bot."""

        config = get_config()
        embed = Embed(title=f'Activity changed to "{config["starting"]}"',
                      description=Embed.Empty,
                      colour=Color.dark_blue())
        await ctx.send(embed=embed, delete_after=5)
        await self.client.change_presence(activity=Activity(
            type=ActivityType.playing, name=config['starting']))
Exemple #13
0
    async def bug(self, ctx: Context, *, message: str = "Bug Report!") -> None:
        """Report the developers about a Bug."""
        bug_report_channel = self.bot.get_channel(config.bug_report_channel)

        embed = Embed(title="Bug Report!",
                      description=message,
                      color=Color.dark_blue())
        embed.add_field(name="Author",
                        value=f"{ctx.author.id} | {ctx.author.mention}")
        await bug_report_channel.send(embed=embed)
Exemple #14
0
    async def suggestions(self, ctx: Context, *, message: str) -> None:
        """Send a new idea or suggestion to the developers."""
        suggestions_channel = self.bot.get_channel(config.suggestions_channel)

        embed = Embed(title="Suggestions!",
                      description=message,
                      color=Color.dark_blue())
        embed.add_field(name="Author",
                        value=f"{ctx.author.id} | {ctx.author.mention}")
        await suggestions_channel.send(embed=embed)
Exemple #15
0
 async def wiki(self, ctx, *, search_term: str):
     """
     Get a summary from Wikipedia
     """
     wiki_page = wikipedia.page(search_term)
     e = Embed(title=wiki_page.title,
               description=wikipedia.summary(search_term, chars=2000),
               url=wiki_page.url)
     e.color = Color.dark_blue()
     await ctx.send("", embed=e)
Exemple #16
0
    async def list_thanks(self, ctx: commands.Context, member: Member):
        thanks = (await ThankModel.filter(
            thanked_id=member.id,
            guild_id=ctx.guild.id).order_by("-time").limit(10))

        await ctx.send(embed=Embed(
            title="Listing",
            description="\n".join(
                [thank_list_message.format(t) for t in thanks]),
            color=Color.dark_blue(),
        ))
Exemple #17
0
    async def contact(self,
                      ctx: Context,
                      *,
                      message: str = "Contact Notification!") -> None:
        """Contact the Developers for something important."""
        contact_channel = self.bot.get_channel(config.contact_channel)

        embed = Embed(title="Contact Request!",
                      description=message,
                      color=Color.dark_blue())
        embed.add_field(name="Author", value=ctx.author.id)
        await contact_channel.send(embed=embed)
Exemple #18
0
    async def sigfigs(self, ctx, number: float, figures: int):
        """
        Round a number to a specified number of significant figures
        """
        result = sigfig.round(number, sigfigs=figures)

        e = Embed(title="Rounding Result")
        e.add_field(name="Original Number", value=number, inline=True)
        e.add_field(name="Figures", value=figures, inline=True)
        e.add_field(name="Result", value=result, inline=False)
        e.add_field(name="Result (Scientific Notation)", value="{:e}".format(result))
        e.color = Color.dark_blue()
        await ctx.send(embed=e)
Exemple #19
0
    async def bug(self, ctx: Context, *, message: str = "Bug Report!") -> None:
        """Report a bug to the developers."""
        bug_report_channel = self.bot.get_channel(config.bug_report_channel)

        embed = Embed(title="Bug Report!",
                      description=message,
                      color=Color.dark_blue())
        embed.add_field(name="Author",
                        value=f"{ctx.author.id} | {ctx.author.mention}")
        await bug_report_channel.send(embed=embed)
        await ctx.send(embed=Embed(
            description="You message has been successfully delivered!",
            color=Color.blue()))
Exemple #20
0
    async def on_message(self, message: Message) -> None:
        """Find messages with blacklisted attachments."""
        if not message.attachments or not message.guild:
            return

        if message.author.permissions_in(message.channel).manage_messages:
            return

        file_extensions = {
            splitext(attachment.filename.lower())[1]
            for attachment in message.attachments
        }
        is_blocked = file_extensions - set(whitelist)

        file_pastes = []

        if is_blocked:
            log_message = f"User <@{message.author.id}> posted a message on {message.guild.id} with protected attachments"

            if message.author.permissions_in(message.channel).manage_messages:
                logger.trace(f"{log_message}, but he has override roles.")
                return

            logger.debug(f"{log_message}.")
            embed = Embed(description=FILE_EMBED_DESCRIPTION,
                          color=Color.dark_blue())

            with suppress(NotFound, ConnectionError):
                for attachment in message.attachments:
                    content = await attachment.read()

                    async with self.bot.session.post(
                            "https://hasteb.in/documents",
                            data=content) as resp:
                        key = (await resp.json())['key']
                        file_paste = 'https://www.hasteb.in/' + key

                    file_pastes.append(file_paste)

                await message.delete()
                await message.channel.send(f"Hey {message.author.mention}!",
                                           embed=embed)

                paste_embed = Embed(
                    color=Color.gold(),
                    description=
                    f"The Paste(s) of the File(s) Can be found at {', '.join(file_pastes)}",
                    title="File Pastes!")
                await message.channel.send(embed=paste_embed)
Exemple #21
0
    async def on_message(self, message: Message) -> None:
        """Find messages with blacklisted attachments."""
        if not message.attachments or not message.guild:
            return
        elif message.author.permissions_in(message.channel).manage_messages:
            return
        # TODO: Adjust the message and remove only filtered attachments instead of deleting the whole message
        file_extensions = {splitext(attachment.filename.lower())[1] for attachment in message.attachments}
        is_blocked = file_extensions - set(AntiMalware.whitelist)

        if is_blocked:
            embed = Embed(description=FILE_EMBED_DESCRIPTION, color=Color.dark_blue())

            with suppress(NotFound, ConnectionError):
                await message.delete()
            await message.channel.send(f"Hey {message.author.mention}!", embed=embed)
Exemple #22
0
 async def stack(self, ctx, *, query):
     so = Embed(color=Color.dark_blue())
     query = '+'.join(query.split())
     base = f"https://api.stackexchange.com/2.2/search/advanced?pagesize=1&order=desc&sort=votes&q={query}&site=stackoverflow"
     async with ClientSession() as session:
         data = await get(session, base)
     data = loads(data)
     so.set_thumbnail(url="https://i.ibb.co/X4DWhts/so.png")
     data = data['items'][0]
     so.set_footer(text=f"Tags: {','.join(data['tags'])}")
     #replace html special characters with actual strings
     title = unescape(data['title'])
     so.set_author(name=title,
                   url=data['link'],
                   icon_url=data['owner']['profile_image'])
     so.description = f"Score: {data['score']}\nAnswers: {data['answer_count']}\nBy [{data['owner']['display_name']}]({data['owner']['link']})"
     return await ctx.send(embed=so)
Exemple #23
0
    async def steal(self, ctx):
        """
        Steal a custom emoji
        """
        e = Embed(
            title="Steal Command",
            description=
            "React to this message with the emoji you'd like to steal within 60 seconds."
        )
        e.color = Color.dark_blue()
        statusmsg = await ctx.send(embed=e)

        def check(reaction, user):
            return user == ctx.author

        try:
            reaction, _ = await self.bot.wait_for('reaction_add',
                                                  timeout=60.0,
                                                  check=check)
        except asyncio.TimeoutError:
            e = Embed("Timed Out")
            e.color = Color.from_rgb(240, 73, 71)
            await statusmsg.edit(embed=e)
            return

        await statusmsg.clear_reactions()

        e = Embed(title="Stealing In Progress",
                  description="This may take a few seconds...")
        e.color = Color.gold()
        await statusmsg.edit(embed=e)

        async with aiohttp.ClientSession() as session:
            img = await fetch_img(session, str(reaction.emoji.url))

        emoji = await ctx.guild.create_custom_emoji(name=reaction.emoji.name,
                                                    image=img)

        e = Embed(title="Stole Emoji")
        e.add_field(name="Emoji", value=str(emoji))
        e.add_field(name="Name", value=emoji.name)
        e.color = Color.from_rgb(67, 180, 129)
        await statusmsg.edit(embed=e)
Exemple #24
0
    async def element(self, ctx, element_input):
        """
        Get a specific element by atomic number, symbol, or name
        """
        element = [
            el for el in periodic_table["elements"]
            if element_input.lower() in (str(el["number"]), el["name"].lower(),
                                         el["symbol"].lower())
        ][0]
        embed = Embed(title=element["name"], description=element["summary"])

        fields = [
            "number", "symbol", "category", "appearance", "atomic_mass",
            "phase", "density", "boil", "melt", "valence_electrons", "shells",
            "named_by", "electron_configuration", "electron_affinity",
            "electronegativity_pauling"
        ]
        for field in fields:
            display_name = field.replace("_", " ").title()
            if field == "valence_electrons":
                embed.add_field(name=display_name,
                                value=element["shells"][-1],
                                inline=True)
            elif type(element[field]) == list:
                embed.add_field(name=display_name,
                                value=", ".join(map(str, element[field])),
                                inline=True)
            elif element[field] == None:
                pass
            else:
                embed.add_field(name=display_name,
                                value=element[field],
                                inline=True)

        embed.set_footer(text=f"Source: {element['source']}")
        embed.color = Color.dark_blue()

        await ctx.send(embed=embed)
Exemple #25
0
    async def hangman(self, ctx: Context) -> None:
        """Play Hangman game."""

        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

        embed = Embed(title="Let's play Hangman!", color=Color.dark_green())
        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.add_field(name="**❯❯ Word Status**", value="**Not Yet Guessed**", inline=False)
        embed.set_footer(text=">>hangexit to exit the game! | Powered By HotWired.")
        message = await ctx.send(embed=embed)
        guess_embed = await ctx.send(embed=Embed(description="Please guess a letter or word: ", color=Color.gold()))
        if not self.is_playing_hangman(ctx.author, ctx.guild, ctx.channel):
            try:
                self.add_hangman_player(ctx.author, ctx.guild, ctx.channel)
            except errors.BadArgument:
                await ctx.send(f"Active games by {ctx.author.mention} found. Use `>>hangexit` to exit!")

        while not guessed and tries > 0 and self.is_playing_hangman(ctx.author, ctx.guild, ctx.channel):
            input = await self.bot.wait_for("message", check=check)
            guess = input.content.upper()

            await input.delete()

            if len(guess) == 1 and guess.isalpha():
                if guess in guessed_letters:
                    embed = Embed(title="Hangman Stats", color=Color.dark_blue())
                    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.add_field(name="**❯❯ Word Status**", value=f"You already guessed the letter {guess}", inline=False)
                    embed.set_footer(text="Powered By HotWired.")
                    await message.edit(embed=embed)
                elif guess not in word:
                    tries -= 1
                    guessed_letters.append(guess)

                    embed = Embed(title="Hangman Stats", color=Color.dark_blue())
                    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.add_field(name="**❯❯ Word Status**", value=f"{guess} is not in the word.", inline=False)
                    embed.set_footer(text="Powered By HotWired.")
                    await message.edit(embed=embed)
                else:
                    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

                    embed = Embed(title="Hangman Stats", color=Color.dark_blue())
                    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.add_field(name="**❯❯ Word Status**", value=f"Good job, {guess} is in the word!", inline=False)
                    embed.set_footer(text="Powered By HotWired.")
                    await message.edit(embed=embed)

            elif len(guess) == len(word) and guess.isalpha():
                if guess in guessed_words:
                    embed = Embed(title="Hangman Stats", color=Color.dark_blue())
                    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.add_field(name="**❯❯ Word Status**", value=f"You already guessed the word {guess}", inline=False)
                    embed.set_footer(text="Powered By HotWired.")
                    await message.edit(embed=embed)
                elif guess != word:
                    tries -= 1
                    guessed_words.append(guess)

                    embed = Embed(title="Hangman Stats", color=Color.dark_blue())
                    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.add_field(name="**❯❯ Word Status**", value=f"{guess} is not in the word.", inline=False)
                    embed.set_footer(text="Powered By HotWired.")
                    await message.edit(embed=embed)
                else:
                    guessed = True
                    word_completion = word
            else:
                embed = Embed(title="Hangman Stats", color=Color.dark_blue())
                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.add_field(name="**❯❯ Word Status**", value="Not a valid guess.", inline=False)
                embed.set_footer(text="Powered By HotWired.")
                await message.edit(embed=embed)

        await guess_embed.delete()
        if guessed:
            embed = Embed(title="Hangman Stats", color=Color.dark_blue())
            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 message.edit(embed=embed)
            await ctx.send(embed=Embed(description="Congrats, you guessed the word! You win! :partying_face: ", color=Color.dark_green()))
        else:
            embed = Embed(title="Hangman Stats", color=Color.dark_blue())
            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 message.edit(embed=embed)
            await ctx.send(
                embed=Embed(description=f"Sorry, you ran out of tries. The word was {word}. Maybe next time! :frowning: ", color=Color.red())
            )
Exemple #26
0
async def xnx(ctx, *args):
    if args:
        url = "https://www.xnxx.com/search/" + "+".join(args)
        await client.say(embed=Embed(description="**[XNXX](%s)**" % url,
                                     color=Color.dark_blue()))
    await client.delete_message(ctx.message)
Exemple #27
0
 def __init__(self, bot):
     self.colors = (Color.red(), Color.gold(), Color.green(),
                    Color.magenta(), Color.teal(), Color.dark_blue())
     self.bot = bot
     self.session = aiohttp.ClientSession(
         headers={'User-agent': 'RedditCrawler'})
Exemple #28
0
    if results['loadType'] == 'PLAYLIST_LOADED':
        return Playlist(results['playlistInfo']['name'], results['tracks'])
    if is_url or force_first or len(results['tracks']) == 1:
        return results['tracks'][0]
    return results['tracks']


embed_colors = {
    'youtube.com': Color.red(),
    'youtu.be': Color.red(),
    'open.spotify.com': Color.green(),
    'soundcloud.com': Color.orange(),
    'twitch.tv': Color.purple(),
    'bandcamp.com': Color.blue(),
    'vk.com': Color.blue(),
    'vimeo.com': Color.dark_blue()
}


def get_embed_color(query):
    if spotify_rx.match(query):
        return Color.green()
    if url_rx.match(query):
        for service in embed_colors:
            if service in query:
                return embed_colors[service]
        return Color.blurple()
    return Color.red()


class MusicCommandError(CommandInvokeError):