Пример #1
0
def rbColor():
    """Returns one of the main colors of RoboTito."""
    colors = [Color.from_rgb(255, 94, 43),
              Color.from_rgb(82, 92, 253),
              Color.from_rgb(72, 159, 181),
              Color.from_rgb(255, 134, 0)]
    return choice(colors)
Пример #2
0
    def _gencard(self, cardtype, tag=""):
        """Generates the message and embed for an x- or o-card invoke"""
        if cardtype == "x":
            title = "Someone has tapped the X card!"
            desc = "Please cease the current topic of conversation."
            color = Color.from_rgb(*colcon["xcard"])
        elif cardtype == "o":
            title = "Someone has tapped the O card!"
            desc = "Keep up the good work!"
            color = Color.from_rgb(*colcon["ocard"])

        if tag:
            desc = f"They specifically mentioned \"{tag}\"\n{desc}"

        return ("@here", Embed(color=color, title=title, description=desc))
def send_webhook():
    url = ("")
    webhook = Webhook.from_url(url, adapter=RequestsWebhookAdapter())

    embed = Embed(title="UNDEFEATED Checkout",
                  url="http://baidu.com",
                  color=Color.from_rgb(115, 238, 139))

    embed.set_thumbnail(
        url=
        "https://images-ext-2.discordapp.net/external/csqhvlOs6r2HxJ70dwPMg9Xn_5ZSn9wWRt9PUDNOwKE/%3Fv%3D1585072279/https/cdn.shopify.com/s/files/1/0094/2252/products/CINDER_YZY_1.jpg?width=80&height=80"
    )

    embed.add_field(name="Product", value="YEEZY BOOST 350 V2 - BLACK --/ 8")

    embed.add_field(name="Size", value="8")

    embed.add_field(name="Billing Profile", value="Cook in silence")

    embed.add_field(name="Checkout Time", value="17.73s")

    embed.add_field(name="Monitor Delay", value="8000ms")

    embed.add_field(name="Retry Delay", value="9000ms")

    embed.add_field(name="Mode", value="Autocheckout")

    embed.add_field(name="Opinion", value="Pre generated checkout").set_footer(
        text="Sole AIO Shopify Mode",
        icon_url=
        "https://media.discordapp.net/attachments/698457195729125447/699465230060879973/image0.jpg?width=300&height=300"
    )

    webhook.send(embed=embed, avatar_url=avatar_url(), username="******")
Пример #4
0
 def embed_constructor(self, status: Literal["online", "offline"]):
     if status == "online":
         return Embed(title=f"{self.emojis.power_on} Online!",
                      color=Color.dark_green())
     else:
         return Embed(title=f"{self.emojis.power_off} Offline!",
                      color=Color.from_rgb(91, 10, 0))
def send_webhook(content):
    url = ("")
    webhook = Webhook.from_url(url, adapter=RequestsWebhookAdapter())

    embed = Embed(title="You cooked",color=Color.from_rgb(161,90,182))

    embed.set_thumbnail(url="https://images-ext-2.discordapp.net/external/fhOQCdD2Y0MsocSBk5eEI4nLXmb_pcemyIB838kBGuo/https/images.footlocker.com/pi/55088500/cart/55088500.jpeg")

    embed.add_field(name="Website",value="Footlocker")

    embed.add_field(name="Product", value="Jordan Retro 1 High OG - Men's")

    embed.add_field(name="Size", value="||9.5||")

    embed.add_field(name="Price", value="$170.00")

    embed.add_field(name="Link",value="55088500")

    embed.add_field(name="Profile",value="||Cook in silence||")

    embed.add_field(name="Proxy",value="||bash||")

    embed.add_field(name="Time stamp(utc)",value="2020-04-11 15:08:28PM")

    webhook.send(content,embed=embed, avatar_url=avatar_url(), username="******")
Пример #6
0
    async def createembed(self, ctx):
        text = ctx.getargs()
        if not text:
            await ctx.sendEmbed(title="Embed-Creator", description=f"""
Verwendung des Chat-Embed-Generators:
```/createembed <Titel>
[Beschreibung]
[Parameter1]
[Parameter2]
[...]
```
Parameter brauchen je eine Zeile und beginnen immer mit `{par}`.
Optionen werden immer mit `{opt}` getrennt.

Verfügbare Parameter:""", color=self.color, inline=False, fields=[
        ("Feld (bis zu 25)",f"{par}field{opt}<Titel>{opt}<Inhalt>{opt}[Inline]"),
        ("Footer",          f"{par}footer{opt}<Titel>{opt}[Bild-URL]"),
        ("Author",          f"{par}author{opt}<Name>{opt}[Link]"),
        ("Thumbnail",       f"{par}thumbnail{opt}<Bild-URL>"),
        ("Color",           f"{par}color{opt}<RED>{opt}<GREEN>{opt}<BLUE>")
        ])
        else:
            lines = text.split("\n")
            data = {
                "title": lines.pop(0),
                "description": "",
                "color": self.color,
                "footertext": "",
                "footerurl": "",
                "authorname": "",
                "authorurl": "",
                "fields": [],
                "thumbnailurl": "",
                "timestamp": False
            }

            for line in lines:
                if len(line) >= 4 and line.startswith(par):
                    line = line[2::]
                    options = line.split(opt)
                    command = options.pop(0).lower().strip()
                    if command in ["field","f","field"] and len(options) >= 2:
                        data["fields"].append((options[0],options[1]) if (len(options) < 3 or not (options[2].lower() in ["f","false","no"])) else (options[0],options[1],False))
                    elif command in ["footer","foot"] and len(options) >= 1:
                        data["footertext"] = options[0]
                        data["footerurl"] = options[1] if len(options) > 1 else ""
                    elif command in ["author"] and len(options) >= 1:
                        data["authorname"] = options[0]
                        data["authorurl"] = options[1] if len(options) > 1 else ""
                    elif command in ["thumbnailurl", "thumbnail", "thumb"] and len(options) >= 1:
                        data["thumbnailurl"] = options[0]
                    elif command in ["color", "c"] and len(options) >= 3:
                        try:
                            data["color"] = Color.from_rgb(int(options[0]),int(options[1]),int(options[2]))
                        except ValueError:
                            pass
                else:
                    data["description"] += "\n"+line

            await ctx.sendEmbed(**data)
Пример #7
0
async def _eval(ctx, *, inp: str):
    """
    Evaluates code
    """
    try:
        e = Embed(title="Eval Successful")
        e.add_field(name="Input", value=f"```py\n{inp}\n```", inline=False)
        e.add_field(name="Output", value=f"```py\n{eval(inp)}\n```")
        e.color = Color.from_rgb(67, 180, 129)
        await ctx.send("", embed=e)
    except Exception as error:
        e = Embed(title="Eval Error")
        e.add_field(name="Input", value=f"```py\n{inp}\n```", inline=False)
        e.add_field(name="Error", value=f"```text\n{error}\n```", inline=False)
        e.color = Color.from_rgb(240, 73, 71)
        await ctx.send("", embed=e)
Пример #8
0
def send_webhook():
    url = ''
    webhook = Webhook.from_url(url, adapter=RequestsWebhookAdapter())

    embed = Embed(title='Successful Checkout!:white_check_mark:',color=Color.from_rgb(50,205,50))
    embed.set_thumbnail(url='https://images-ext-2.discordapp.net/external/xSpQEjwaK72NQT27CL1M7cVg7XFIUisuFAEmV4ZfVRs/https/assets.supremenewyork.com/185568/sm/bq8EZBTj4n8.jpg?width=80&height=80')
    embed.add_field(name='Product',value='Motion Logo Hooded Sweatshirt')\
    .add_field(name='Size/Color',value='Large/White')\
    .add_field(name='订单号(order#)',value='||78654958||')\
    .add_field(name='ProfileName',value='Test')\
    .add_field(name='Checkout IP',value='||TCB||')\
    .add_field(name='App Version',value='0.5.3')\
    .add_field(name='模式(mode)',value='browser')\
    .add_field(name='Checkout Speed',value='6.876s')\
    .add_field(name='Queued',value='True')\
    .add_field(name='Dropped Time',value='2020-04-09T15:00:13.681Z')\
    .add_field(name='CaptchaBypass',value='True')\
    .add_field(name='ThreeDBypass',value='False')\
    .add_field(name='RestockMode',value='True')\
    .add_field(name='TicketMode',value='True')\
    .add_field(name='Status',value='paid')\
    .add_field(name='PookyCookie',value='Cookie: ticket=9ef03a7826de73de51ff397ed687ef13de976f101b5db095e98b8d24c9f26513e8bb1b841b038b0b4bb3652061160c5e8cea9a7d273c933c51bc19dfe66622741586444415_ticket=469f0ed8604253f2dfa701edd245a48c4890f8a527cf622756a106611a06ff8dd3a0ab4e9392426e16f284ac227e7cc597a831f4dc9a725278e1c98bfba8e2fe1586444418')\
    .set_footer(icon_url=icon_url(),text='2020-04-09T15:02:35.664Z')

    webhook.send(embed=embed,username="******")
Пример #9
0
async def send_embed(message):
    queue = queues[message.guild.id]
    track = queue.tracks[queue.now_playing_index]
    next_track = ""
    if len(queue.tracks) > 1 and queue.now_playing_index + 1 < len(
            queue.tracks):
        next_track = queue.tracks[queue.now_playing_index + 1].title
    else:
        next_track = "None"
    embed = Embed(
        title=track.title,
        description=f"{gen_progress_bar(queue.start_time, track.duration)}",
        color=Color.from_rgb(0, 241, 183))
    embed.set_thumbnail(url=track.cover)
    embed.add_field(name="Next", value=next_track)
    embed.add_field(name="Requested by", value=track.requestedBy.mention)
    if not queue.now_playing:
        queue.now_playing = await message.channel.send(embed=embed)
        await queue.now_playing.add_reaction("⏮")
        await queue.now_playing.add_reaction("⏯")
        await queue.now_playing.add_reaction("⏭")
        await queue.now_playing.add_reaction("⏹")
        await queue.now_playing.add_reaction("🔀")
        await queue.now_playing.add_reaction("🔃")
    else:
        await queue.now_playing.edit(embed=embed)
    queue.now_playing_interval_helper = time.time()
Пример #10
0
    async def rw(self, ctx, users):
        if self.tournament.status != 4:
            raise commands.BadArgument(
                "The tournament must have begun in order to add winners.")

        u_list = users.split(",")

        for user in u_list:
            user = await self._parse_player(ctx, user)

            if user not in self.tournament.participants and user != self.tournament.host:
                raise commands.BadArgument(
                    f"**{user.name}** is not in the tournament.")

            if user not in self.tournament.winners:
                raise commands.BadArgument(f"**{user.name}** is not a winner.")

            self.tournament.winners.remove(user)
            await ctx.send(
                f":heavy_minus_sign: Removed **{user.name}** from the winners."
            )

            Log("Winner Removed",
                description=
                f"{ctx.author.mention} removed {user.mention} from the winners of **{self.tournament.name}**.",
                color=Color.from_rgb(200, 200, 0))
Пример #11
0
    def __init__(self,
                 ctx,
                 author_name=None,
                 attachment=None,
                 author_url=None,
                 url=None,
                 desc=None,
                 footer_icon=None,
                 thumbnail=None,
                 image=None,
                 title=None,
                 color=None,
                 fields={},
                 footer=None) -> None:
        self.ctx = ctx
        self.color = self.ctx.guild.me.roles[::-1][
            0].color if color is None else color
        self.title = "" if title is None else str(title)
        self.description = "" if desc is None else str(desc)
        self.current_time = datetime.now()
        self.fields = None if (fields == {}) else fields
        self.footer = "Command executed by " + str(
            self.ctx.author) if footer is None else str(footer)
        self.url = url
        self.image_url = image
        self.thumbnail_url = thumbnail
        self.footer_icon = str(self.ctx.author.avatar_url
                               ) if footer_icon is None else str(footer_icon)
        self.attachment_url = attachment

        if isinstance(self.color, tuple):
            self.color = Color.from_rgb(*self.color)
        elif ((isinstance(self.color, str)) and (self.color.startswith("#"))):
            self._convert_hex_to_rgb()
Пример #12
0
async def run(message):
    if not await utils.check_voice_channel(message):
        await message.reply("You have to be in a voice channel")
        return

    if not utils.check_for_existing_queue(message):
        await message.reply("Nothing is playing")
        return

    queue = utils.get_queue(message.guild.id)

    queue.loop += 1

    if queue.loop > 2:
        queue.loop = 0

    mode = ""
    if queue.loop == 0:
        mode = "None"
    elif queue.loop == 1:
        mode = "Queue"
    elif queue.loop == 2:
        mode = "Song"
    await message.channel.send(embed=Embed(
        description="Now looping {0}".format(mode),
        colour=Color.from_rgb(141, 41, 255)),
                               delete_after=5)
Пример #13
0
 async def invite(self, ctx):
     """Get invite link for ZedUtils"""
     embed = discord.Embed(
         title="Invite ZedUtils",
         description="[Top.gg](https://top.gg/bot/746465008967221259)",
         color=Color.from_rgb(230, 230, 230))
     await ctx.send(embed=embed)
Пример #14
0
    async def maps(self, ctx):
        embed = Embed(
            title="Map Bans",
            color=Color.from_rgb(0, 0, 0)
        )

        # The numbers are used for the map picker
        text = """
        :green_circle: **The Skeld** (1)
        :blue_circle: **Mira HQ** (2)
        :red_circle: **Polus** (3)
        """

        embed.add_field(
            name="VOTE",
            value=text
        )


        msg = await ctx.send(embed=embed)

        reactions = [
            "🟢",
            "🔵",
            "🔴"
        ]

        for r in reactions:
            await msg.add_reaction(r)
Пример #15
0
def send_webhook():
    url = 'webhook'
    webhook = Webhook.from_url(url, adapter=RequestsWebhookAdapter())
    embed = Embed(title='Successfully checked out!',
                  color=Color.from_rgb(50, 205, 50),
                  description='Tupac Hologram Tee')

    embed.set_thumbnail(url=product_url())

    embed.add_field(name='Store', value='Supreme EU', inline=True)\
        .add_field(name='size', value='XLarge', inline=True)\
        .add_field(name='Profile', value='||test||', inline=True)

    embed.add_field(name='Order', value='||4567891||', inline=True)\
        .add_field(name='Proxy List', value='||test||', inline=True)\
        .add_field(name='Color', value='black', inline=True)

    embed.add_field(name='Category', value='T-Shirts', inline=True)\
        .add_field(name='3D Secure', value='Enabled', inline=True)\
        .add_field(name='Mode', value='Safe', inline=True)

    embed.set_footer(text='CyberAIO•27/02/2020 16:03:37.984',
                     icon_url=avatar_url())

    webhook.send(embed=embed, avatar_url=avatar_url(), username="******")
Пример #16
0
    async def pixelate(self, ctx: Context, user: Member = None) -> None:
        """Pixelate command, takes in an optional parameter user else pixelates author's avatar."""
        async with ctx.channel.typing():
            user = ctx.author.avatar_url if not user else user.avatar_url
            img_bytes = user.read()
            image = Image.open(BytesIO(await img_bytes))

            img_color = self.dominant_color(image)

            img_small = image.resize((24, 24), resample=Image.BILINEAR)
            result = img_small.resize((1024, 1024), Image.NEAREST)

            buffer = BytesIO()
            result.save(buffer, format="PNG")
            buffer.seek(0)

            img_file = File(buffer, filename="pixelated.png")
            img_url = 'attachment://pixelated.png'

            img_emb = Embed(color=Color.from_rgb(int(
                img_color[0]), int(img_color[1]), int(img_color[2])))
            img_emb.set_author(name="Here is your pixelated Image",
                               icon_url=user)
            img_emb.set_image(url=img_url)

            await ctx.send(embed=img_emb, file=img_file)
Пример #17
0
 async def create_role(self, ctx, name):
     random_color = Color.from_rgb(randint(0, 255), randint(0, 255), randint(0, 255))
     new_role = await ctx.guild.create_role(name=name, color=random_color)
     if new_role:
         await ctx.send(f'Created new role - {new_role.name}')
     else:
         await ctx.send(f'Failed')
Пример #18
0
    async def shuffle(self, ctx, *choices: str):
        """
		Given a list, output that list shuffled.
		Allows options to be given in the form "thisXnum", which will add "num" instances of "this" to the pool.
		For example, "Crash Paragon Nautica villainX3" would output a list six items long.
		Of note:
		- "X" isn't case sensitive
		- The number must be positive
		- Multi-word names can be accomplished by surrounding the whole choice in quotes (e.g. "Death Bladex4" would put four "Death Blade"s on the list). This includes the "Xnum" part.
		"""
        final = []
        for c in choices:
            # split all in the form thingXnum
            base, mult = re.match(r"(.*?)(?:x(\d+))?$", c, flags=re.I).groups()
            # int(mult), or 1 if mult is None
            mult = int(mult or 1)
            for _ in range(mult):
                final.append(base)

        shuffle(final)
        ebd = Embed(color=Color.from_rgb(*colcon["shuffle"]),
                    title="Your shuffled list is:",
                    description="\n".join(final))

        await ctx.send(embed=ebd)
Пример #19
0
    async def roll_sdocs(self, ctx):
        """
		Since which special dice are available can change, but this documentation cannot, please call this command to see what they currently are.
		"""
        ebd = Embed(
            color=Color.from_rgb(*colcon["roll"]),
            title=self._parse_emoji(ctx, "Available special dice"),
            description=
            "Each category will say what it is, then what the delimiter is (the \"d\" in \"XdY\"), then will have a list of possible dice in that category. Each dice will show its name, then will list the possible options for \"Y\" that will roll that dice. Frequently this will include longer versions, as well as shorter aliases."
        )

        for category, data in dcon.items():
            title = f"{category} : {data['delimiter']}"
            desc = {}
            for name in data["faces"].keys():
                desc[name] = data["aliases"][name]

            values = []
            for name, aliases in desc.items():
                values.append(f"{name}: {', '.join(aliases)}")

            ebd.add_field(name=self._parse_emoji(ctx, title),
                          value=self._parse_emoji(ctx, "\n".join(values)),
                          inline=False)

        await ctx.send(embed=ebd)
Пример #20
0
async def run(message):
    queue = utils.get_queue(message.guild.id)
    output = ""

    if not queue:
        await message.channel.send("No queue found on this server")
        return
    page = queue.queue_page
    available_pages = len(queue.tracks) / 15
    if page < 0:
        page = 0
    elif page > available_pages:
        page = math.ceil(available_pages)
    counter = (page * 15)+1

    if len(queue.tracks) >= 1:
        for i in get_tracks_from_to(1+(15*page), 14+(15*page), queue):
            if queue.now_playing_index + 1 == counter:
                output += "🔴 "
            output = output + "{0}. {1}\n".format(counter, i.title)
            counter += 1
    if output:
        if not queue.queue_message:
            queue.queue_message = await message.channel.send("Page {0}```{1}```".format(page+1, output))
            if available_pages > 1:
                await queue.queue_message.add_reaction("⬆")
                await queue.queue_message.add_reaction("⬇")
                await queue.queue_message.add_reaction("❌")
        else:
            await queue.queue_message.edit(content="Page {0}```{1}```".format(page+1, output))
        await queue.queue_message.add_reaction("❌")
    else:
        await message.channel.send(embed=Embed(description="Queue is empty!", colour=Color.from_rgb(237, 19, 19)))
Пример #21
0
async def load(ctx, *, module: str):
    """
    Loads a module.
    """
    bot.load_extension(module)
    e = Embed(title="Loaded")
    e.add_field(name="Module", value=module)
    e.color = Color.from_rgb(67, 180, 129)
    await ctx.send("", embed=e)
Пример #22
0
async def on_command_error(ctx, error):
    ignored = (CommandNotFound)
    error = getattr(error, 'original', error)
    if isinstance(error, ignored):
        return
    e = Embed(title="Error")
    e.add_field(name="Error", value=f"```text\n{error}\n```", inline=False)
    e.color = Color.from_rgb(240, 73, 71)
    await ctx.send("", embed=e)
Пример #23
0
async def on_voice_state_update(member, before, after):
    if member.id == client.user.id:
        if not after.channel:
            queue = utils.get_queue(before.channel.guild.id)
            if not queue:
                return
            await utils.destroy_queue(before.channel.guild.id)
            await queue.first_message.channel.send(
                embed=Embed(description="I got disconnected from the channel.",
                            colour=Color.from_rgb(237, 19, 19)))
Пример #24
0
async def announce_single_song(track, channel):
    description = ""
    if not re.match("://", track.url):
        description = "Queued **{0}** [{1}]".format(track.title,
                                                    track.requestedBy.mention)
    else:
        description = "Queued **[{0}]({1})** [{2}]".format(
            track.title, track.url, track.requestedBy.mention)
    embd = Embed(description=description, colour=Color.from_rgb(141, 41, 255))
    await channel.send(embed=embd, delete_after=20)
Пример #25
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)
Пример #26
0
    async def trivia(self, ctx):
        url = "https://opentdb.com/api.php?amount=1&difficulty=medium&type=multiple"
        clr = lambda: randrange(0, 255)
        colour = Color.from_rgb(clr(), clr(), clr())
        async with ClientSession() as session:
            url = await fetch(session, url)
        url = l(url)
        quest = Embed(color=colour)
        url = url['results'][0]
        quest.title = f"""Q) **{url['question'].replace('&quot;', "'").replace('&#039;', "'")}**"""
        quest.set_author(name=url['category'],
                         icon_url="https://i.ibb.co/FztStPF/trivia-Icon.png",
                         url="https://opentdb.com/")
        correct = url['correct_answer']
        answers = url['incorrect_answers']
        answers.append(correct)
        shuffle(answers)
        quest.description = f"A. {answers[0]}\nB. {answers[1]}\nC. {answers[2]}\nD. {answers[3]}"
        mcq = await ctx.send(embed=quest)
        reacts = ['🇦', '🇧', '🇨', '🇩']

        r2a = {
            '🇦': answers[0],
            '🇧': answers[1],
            '🇨': answers[2],
            '🇩': answers[3]
        }
        ans = {"R": {*()}, "W": {*()}}
        for react in reacts:
            await mcq.add_reaction(react)

        while True:
            try:
                reaction, user = await self.bot.wait_for('reaction_add',
                                                         timeout=20.0)
                e = str(reaction.emoji)
            except TimeoutError:
                break
            if user != self.bot.user and reaction.message.id == mcq.id:
                if r2a[e] == correct:
                    ans["R"].add(user.id)
                else:
                    ans["W"].add(user.id)

        des = ""
        for right in ans["R"]:
            if right not in ans["W"]:
                des += f"<@{right}> won 10 🥥\n"
                self.db.transact(uid=right, amt=10)
        if des != "":
            des = f"```Correct answer was {correct}```\n{des}"
            await ctx.send(embed=Embed(description=des, color=colour))
        else:
            des = f"```Correct answer was {correct}```\nNo winners 😢"
            await ctx.send(embed=Embed(description=des, color=colour))
Пример #27
0
async def add_to_queue(message, query):
    info = None
    if spotify.is_track(query):
        info = spotify.get_track(query)
        new_track = Track.Track(query, info, message)
        queues[message.guild.id].tracks.append(new_track)
        await announce_single_song(new_track, message.channel)
    elif spotify.is_playlist(query):
        info = spotify.get_playlist(query)
        tracks_count = len(info)
        for track in info:
            queues[message.guild.id].tracks.append(
                Track.Track(query, track, message))

        embd = Embed(description="Queued **{0}** tracks".format(tracks_count),
                     colour=Color.from_rgb(141, 41, 255))
        await message.channel.send(embed=embd, delete_after=20)
    else:
        try:
            info = ytdl.extract_info(query, download=False)
            if not info:
                return
            if "entries" in info:
                info = info["entries"][0]
            info["cover"] = info.get("thumbnail")
        except:
            await message.channel.send(
                embed=Embed(description="No results found or content is 18+",
                            colour=Color.from_rgb(237, 19, 19)))
            if len(queues[message.guild.id].tracks) == 0:
                queues[message.guild.id].end_time = time.time()
                queues_to_check.append(message.guild.id)
            return
        new_track = Track.Track(query, info, message)
        await announce_single_song(new_track, message.channel)
        queues[message.guild.id].tracks.append(new_track)
    try:
        queues_to_check.remove(message.guild.id)
    except:
        pass
    if not queues[message.guild.id].is_playing:
        stream(message)
Пример #28
0
    async def ping(self, context):
        ping = round(self.client.latency * 1000)

        embed = discord.Embed(
            title = f"Your ping is {str(ping)} ms",
            colour = (ping < 65 and discord_color.green) or (ping > 170 and discord_color.from_rgb(255, 255, 0)) or (discord_color.red)
        )

        embed.add_field(title = )

        await context.send()
Пример #29
0
async def get_reddit_poll_embed(reddit: Reddit,
                                submission: Submission) -> Union[Embed, None]:
    if submission.submission_type is not SubmissionType.POLL:
        return None
    poll_data: PollData = submission.poll_data
    total_vote_count: int
    voting_end_timestamp: float
    options: List[PollOption]
    # noinspection PyUnresolvedReferences
    total_vote_count, voting_end_timestamp, options = (
        poll_data.total_vote_count, poll_data.voting_end_timestamp / 1000.0,
        poll_data.options)

    voting_end = datetime.datetime.fromtimestamp(voting_end_timestamp,
                                                 datetime.timezone.utc)
    poll_active: bool = datetime.datetime.now(
        datetime.timezone.utc) < voting_end
    embed: Embed = Embed(
        title=submission.title[:EmbedLimit.title],
        url=f"https://www.reddit.com/poll/{submission.id}",
        description="Poll is active. No results."
        if poll_active else EmptyEmbed,
        color=Color.from_rgb(255, 69, 0),
        timestamp=voting_end,
    ).set_author(
        name=f"{total_vote_count:,} vote{'' if total_vote_count == 1 else 's'}"
        f": Poll {'active' if poll_active else 'closed'}", ).set_footer(
            text="Voting ends at")

    if poll_active:
        return embed

    poll_option_bar_fill = [
        "\U0001F7E5", "\U0001F7E6", "\U0001F7E9", "\U0001F7E8", "\U0001F7EA",
        "\U0001F7E7"
    ]
    for i in range(len(options)):
        option: PollOption = options[i]
        vote_count: int
        text: str
        # noinspection PyUnresolvedReferences
        vote_count, text = (option.vote_count, option.text)
        percentage: int = round(
            float(vote_count) / float(total_vote_count) *
            100.0) if total_vote_count != 0 else 0
        option_bar = get_poll_option_bar(percentage, poll_option_bar_fill[i],
                                         "\u2B1B")
        embed.add_field(
            name=text,
            value=
            f"{option_bar} {vote_count:,} vote{'' if vote_count == 1 else 's'} ({percentage}%)",
            inline=False)

    return embed
Пример #30
0
async def list_bills(ctx: commands.Context) -> None:
    bills = await get_from_db(Bill)
    for (bill, ) in bills:
        owner = bot.get_user(int(bill.owner))
        embed = Embed(
            title='Link to message',
            url=
            f'https://discord.com/channels/{server}/{channel}/{bill.message_id}',
            color=Color.from_rgb(23, 191, 29))
        embed.set_author(name=owner.name, icon_url=owner.avatar_url)
        await ctx.channel.send(embed=embed)