Skip to content

Commit

Permalink
feat: Add docs search command (#96)
Browse files Browse the repository at this point in the history
Adds a command to generate a link that searches NorthstarDocs with the passed search term
  • Loading branch information
Bobbyperson authored Dec 28, 2024
1 parent 3523090 commit dd93bb9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions reaper/cogs/doc_search.py
Original file line number Diff line number Diff line change
@@ -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))
1 change: 1 addition & 0 deletions reaper/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit dd93bb9

Please sign in to comment.