Add searchalias and searchnote command

Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
This commit is contained in:
Ari Archer 2022-07-22 13:55:08 +03:00
parent a13efe7a4e
commit 0ae934a802
Signed by untrusted user who does not match committer: ari
GPG key ID: A50D5B4B599AF8A2

View file

@ -690,6 +690,38 @@ class CommandParser:
" ".join(args),
)
@staticmethod
def cmd_searchnote(user: str, args: List[str]) -> str:
"""Noauth command, searches for a note
Syntax: searchnote <search>"""
if not args:
return guac_msg("chat", f"@{user} Gimme a query to find a note")
query: str = " ".join(args)
for note in CONFIG["notes"]:
if query in note:
return guac_msg("chat", f"@{user} Found note: {note}")
return guac_msg("chat", f"@{user} No notes that matches this found")
@staticmethod
def cmd_searchalias(user: str, args: List[str]) -> str:
"""Noauth command, searches for an alias
Syntax: searchalias <search>"""
if not args:
return guac_msg("chat", f"@{user} ??huh?? What alias should I look for?")
query: str = " ".join(args)
for alias in CONFIG["aliases"]:
if query in alias:
return guac_msg("chat", f"@{user} Found alias: {alias}")
return guac_msg("chat", f"@{user} No aliases matches your query")
class MessageParser:
@staticmethod