From fcd8b4de17851c3fa5a22a321953f926a3c927f6 Mon Sep 17 00:00:00 2001 From: Zodiac Date: Tue, 18 Feb 2025 06:48:02 -0800 Subject: [PATCH] update notes and alias for yt --- plugins/my_yt.py | 2 +- plugins/notes.py | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/plugins/my_yt.py b/plugins/my_yt.py index 63fee42..c1581fe 100644 --- a/plugins/my_yt.py +++ b/plugins/my_yt.py @@ -168,7 +168,7 @@ class YouTubePlugin: f"\x0312https://youtu.be/{info['videoId']}\x0F\x03" ) - @command(options_first=True, use_shlex=True) + @command(options_first=True, use_shlex=True, aliases=['y'],) async def yt(self, mask, target, args): """ %%yt [--] ... diff --git a/plugins/notes.py b/plugins/notes.py index 40cb1c6..2f63f37 100644 --- a/plugins/notes.py +++ b/plugins/notes.py @@ -168,7 +168,8 @@ class NoteTaking: self.User = Query() self.log = logging.getLogger(__name__) - @command + + @command(aliases=['notes'], public=True) async def note(self, mask, target, args): """ Unified note command. @@ -189,7 +190,18 @@ class NoteTaking: Keyword to search in notes. """ try: - if args.get('today'): + if not args: + # Display the help message if no arguments are provided + help_msg = ircstyle.style("Usage: !note [options]\n", fg="red", bold=True) + help_msg += "Subcommands:\n" + help_msg += ircstyle.style("today", fg="yellow") + " - View or update today's daily note.\n" + help_msg += ircstyle.style("daily [--date ]", fg="yellow") + " - View or update a daily note for a specific date (default is today).\n" + help_msg += ircstyle.style("general [--tags <tags>]", fg="yellow") + " - View or update a general note with the given title. Optionally, specify tags.\n" + help_msg += ircstyle.style("list [daily|general]", fg="yellow") + " - List all notes of a specific type (either 'daily' or 'general').\n" + help_msg += ircstyle.style("search <type> <keyword>", fg="yellow") + " - Search for a keyword in notes of a specific type.\n" + help_msg += ircstyle.style("summary", fg="yellow") + " - Display a summary of note counts.\n" + self.bot.privmsg(target, help_msg) + elif args.get('today'): await self._note_today(mask, target, args) elif args.get('daily'): await self._note_daily(mask, target, args) @@ -202,8 +214,7 @@ class NoteTaking: elif args.get('summary'): await self._note_summary(target) else: - help_msg = ircstyle.style("Usage: !note <subcommand> [options]\n", fg="red", bold=True) - help_msg += "Subcommands: today, daily, general, list, search, summary" + help_msg = ircstyle.style("Invalid subcommand! Use !note for a list of available commands.\n", fg="red", bold=True) self.bot.privmsg(target, help_msg) except Exception as e: self.bot.log.error(f"Error processing note command: {e}", exc_info=True)