Exemplo n.º 1
0
    @commands.command(aliases=["render"])
    async def warender(self, ctx: commands.Context, *, query: str) -> None:
        """Spits out what WolframAlpha thought your query was. Useful for rendering equations."""
        async with ctx.typing():
            response = await Wolfram.query(query=query,
                                           formats="image",
                                           mag="3",
                                           width="1500",
                                           podindex="1")
            if (check := self.checkquery(query=response)) is not None:
                return await ctx.send(embed=check)

        if (inputpod := next(
            (pod
             for pod in response.pods if pod.title == "Input"), None)) is None:
            fail = Embeds.status(success=False,
                                 desc="Couldn't find a rendered pod.")
            return await ctx.send(embed=fail)

        await ctx.send(inputpod.subpods[0].image)

    @commands.command(aliases=["solve"])
    async def wasteps(self, ctx: commands.Context, *, query: str) -> None:
        """Provide step-by-step solutions to the query passed in. Useful for solving equations."""
        async with ctx.typing():
            response = await Wolfram.query(
                query=query,
                formats="image",
                mag="3",
                width="1500",
                podstate="Step-by-step+solution",
            )
Exemplo n.º 2
0
            )

            m, s = self.get_formatted_length(result.length, False)
            embed.set_footer(
                text=f"Track goes for {m} minutes and {s} seconds.",
                icon_url=ctx.author.avatar_url,
            )
            if result.thumb is not None:
                embed.set_thumbnail(url=result.thumb)
            await ctx.send(embed=embed)

            player.queue.add_tracks(result)
            if not player.is_playing:
                await player.playback()
        else:
            fail = Embeds.status(success=False,
                                 desc="Failed to find any results.")
            await ctx.send(embed=fail)

    @commands.command()
    async def search(self, ctx: commands.Context, *,
                     query: t.Optional[str]) -> None:
        """Search for your favourite tunes on YouTube."""
        if query is None:
            # Maybe the user didn't know to pass in a query?
            embed = discord.Embed(colour=Colours.regular,
                                  timestamp=Embeds.now())
            embed.description = (
                "No query passed in. Try passing in something: `$search arabic music`"
            )
            embed.set_footer(text="See $help voice for more commands.",
                             icon_url=Icons.info)