diff --git a/reaper/cogs/doc_search.py b/reaper/cogs/doc_search.py new file mode 100644 index 0000000..517e81e --- /dev/null +++ b/reaper/cogs/doc_search.py @@ -0,0 +1,20 @@ +from discord.ext import commands +import urllib + + +class DocSearch(commands.Cog): + def __init__(self, bot: commands.Bot) -> None: + self.bot = bot + + @commands.hybrid_command( + description="Generates a search query link for NorthstarDocs based on search term" + ) + async def docsearch(self, ctx, *, query): + query = query.replace(" ", "+") + # convert special characters to link friendly format + urllib.parse.quote_plus(query) + await ctx.send(f"https://docs.northstar.tf/?q={query}") + + +async def setup(bot: commands.Bot) -> None: + await bot.add_cog(DocSearch(bot)) diff --git a/reaper/main.py b/reaper/main.py index d043a49..47ce8cc 100644 --- a/reaper/main.py +++ b/reaper/main.py @@ -30,6 +30,7 @@ "cogs.allowed_users", "cogs.auto_react_reports", "cogs.auto_response", + "cogs.doc_search", "cogs.global_replies", "cogs.help_command", "cogs.image_response",