From 2fb444f62a3198a291a77981676a6a1d028ebbee Mon Sep 17 00:00:00 2001 From: CreeperXP <67541714+CreeperXP@users.noreply.github.com> Date: Wed, 20 Oct 2021 08:40:42 +0300 Subject: [PATCH] google search --- cogs/link.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 cogs/link.py diff --git a/cogs/link.py b/cogs/link.py new file mode 100644 index 0000000..a793773 --- /dev/null +++ b/cogs/link.py @@ -0,0 +1,26 @@ +import nextcord +from nextcord.ext import commands +from urllib.parse import quote_plus + + +class Link(commands.Cog): + def __init__(self, bot:commands.Bot): + self.bot = bot + + + class Google(nextcord.ui.View): + def __init__(self, query: str): + super().__init__() + query = quote_plus(query) + url = f'https://www.google.com/search?q={query}' + self.add_item(nextcord.ui.Button(label='Click Here', url=url)) + + + @commands.command(alias = "link",) + @commands.cooldown(1, 15, commands.BucketType.member) + async def google(ctx, *, query: str): + await ctx.send(f'Google Result for: `{query}`', view=Google(query)) + + +def setup(bot:commands.Bot): + bot.add_cog(Link(bot)) \ No newline at end of file