From 7bbc82d17574f69a2d8f6e668ec251de82fa7b22 Mon Sep 17 00:00:00 2001 From: Irene Sheen Date: Sat, 9 May 2026 10:27:59 +0200 Subject: [PATCH] Add /help command --- src/quadnite_bot/command_registry.py | 2 + src/quadnite_bot/commands/help.py | 17 +++++ src/quadnite_bot/static/commands_list.txt | 71 -------------------- src/quadnite_bot/static/help/10_random.txt | 5 ++ src/quadnite_bot/static/help/20_wordplay.txt | 8 +++ src/quadnite_bot/static/help/30_question.txt | 8 +++ src/quadnite_bot/static/help/40_roleplay.txt | 42 ++++++++++++ src/quadnite_bot/static/help/50_dice.txt | 16 +++++ 8 files changed, 98 insertions(+), 71 deletions(-) create mode 100644 src/quadnite_bot/commands/help.py delete mode 100644 src/quadnite_bot/static/commands_list.txt create mode 100644 src/quadnite_bot/static/help/10_random.txt create mode 100644 src/quadnite_bot/static/help/20_wordplay.txt create mode 100644 src/quadnite_bot/static/help/30_question.txt create mode 100644 src/quadnite_bot/static/help/40_roleplay.txt create mode 100644 src/quadnite_bot/static/help/50_dice.txt diff --git a/src/quadnite_bot/command_registry.py b/src/quadnite_bot/command_registry.py index d3cc1ba..466c380 100644 --- a/src/quadnite_bot/command_registry.py +++ b/src/quadnite_bot/command_registry.py @@ -2,6 +2,7 @@ from quadnite_bot.command import CommandDispatcher from quadnite_bot.commands.absurdify import AbsurdifyCommand from quadnite_bot.commands.dice import DiceMatch from quadnite_bot.commands.echo import EchoCommand +from quadnite_bot.commands.help import HelpCommand from quadnite_bot.commands.random import CoinCommand, QuestionCommand, WordCommand, WordsCommand from quadnite_bot.commands.response import ResponseCommands @@ -15,3 +16,4 @@ dispatcher.add_command(WordCommand()) dispatcher.add_command(WordsCommand()) dispatcher.add_command(CoinCommand()) dispatcher.add_command(ResponseCommands()) +dispatcher.add_command(HelpCommand()) diff --git a/src/quadnite_bot/commands/help.py b/src/quadnite_bot/commands/help.py new file mode 100644 index 0000000..ea1c216 --- /dev/null +++ b/src/quadnite_bot/commands/help.py @@ -0,0 +1,17 @@ +from pathlib import Path +from deltachat2 import NewMsgEvent +from quadnite_bot.command import Command, Context + + +class HelpCommand(Command): + command = "help" + + def __init__(self): + self.responses = [] + for file in sorted((Path(__file__).resolve().parent.parent / "static/help").iterdir()): + with open(file) as f: + self.responses.append(f.read()) + + def process_event(self, ctx: Context, event: NewMsgEvent) -> None: + for response in self.responses: + ctx.reply(response) diff --git a/src/quadnite_bot/static/commands_list.txt b/src/quadnite_bot/static/commands_list.txt deleted file mode 100644 index 922fe8f..0000000 --- a/src/quadnite_bot/static/commands_list.txt +++ /dev/null @@ -1,71 +0,0 @@ -Random - -coin - Tosses a coin -wiki - Search Wikipedia -arch_wiki - Search the Arch wiki -kys - Kill yourself -insult - As expected, insults - -Wordplay - -question - Get a random question -word - Get a random word -words - Get n random words -weebify - Weebifies the given text -absurdify - mAke tExT aBSUrd -expand - Expands a given abbreviation - -Ask a question - -is are can -will did shall -was do does -should - -Roleplay - -angry bite -blush bored -bonk boop -chase cheer -cringe cry -cuddle dab -dance die -eat facepalm -feed glomp -happy hate -holdhands hide -highfive hug -kill kiss -laugh lick -love lurk -nervous no -nom nuzzle -panic pat -peck poke -pout run -shoot shrug -sip slap -sleep snuggle -stab tease -think thumbsup -tickle triggered -twerk wag -wave wink -yes - -Miscellaneous - -help - Need help? Go here -feedback - Send feedback, suggestions for kys, insult text -rate - Rate me on TGDR - -Dice - -[num]d[sides] [modifier] - -num is the number of the dices to roll. (Optional) -sides is the number of sides of the dice. (Required) -modifier is in the form of + or - followed by a number. (Optional) - -Examples: 1d6, 2d10 + 5, 3d20 - 2, 2d20 diff --git a/src/quadnite_bot/static/help/10_random.txt b/src/quadnite_bot/static/help/10_random.txt new file mode 100644 index 0000000..9346aec --- /dev/null +++ b/src/quadnite_bot/static/help/10_random.txt @@ -0,0 +1,5 @@ +Random + +/coin - Tosses a coin +/wiki [search term] - Search Wikipedia +/arch_wiki [search term] - Search the Arch wiki diff --git a/src/quadnite_bot/static/help/20_wordplay.txt b/src/quadnite_bot/static/help/20_wordplay.txt new file mode 100644 index 0000000..1c560d9 --- /dev/null +++ b/src/quadnite_bot/static/help/20_wordplay.txt @@ -0,0 +1,8 @@ +Wordplay + +/question - Get a random question +/word - Get a random word +/words [n] - Get n random words +/weebify [text] - Weebifies the given text +/absurdify [text] - mAke tExT aBSUrd +/expand [word] - Expands a given abbreviation diff --git a/src/quadnite_bot/static/help/30_question.txt b/src/quadnite_bot/static/help/30_question.txt new file mode 100644 index 0000000..9d9b1df --- /dev/null +++ b/src/quadnite_bot/static/help/30_question.txt @@ -0,0 +1,8 @@ +Ask a question + +/ [question] + +/is /are /can +/will /did /shall +/was /do /does +/should diff --git a/src/quadnite_bot/static/help/40_roleplay.txt b/src/quadnite_bot/static/help/40_roleplay.txt new file mode 100644 index 0000000..c9128d3 --- /dev/null +++ b/src/quadnite_bot/static/help/40_roleplay.txt @@ -0,0 +1,42 @@ +Roleplay + +/ [@user1] [@user2] ... [@userN] [message] + +(All arguments to the commands are optional) + +/angry /bite +/blush /bored +/bonk /boop +/chase /cheer +/cringe /cry +/cuddle /dab +/dance /die +/eat /facepalm +/feed /glomp +/happy /hate +/holdhands /hide +/highfive /hug +/kill /kiss +/laugh /lick +/love /lurk +/nervous /no +/nom /nuzzle +/panic /pat +/peck /poke +/pout /run +/shoot /shrug +/sip /slap +/sleep /snuggle +/stab /tease +/think /thumbsup +/tickle /triggered +/twerk /wag +/wave /wink +/yes + + +Examples: + +/hug @foobar +/slap making me angry +/holdhands @baz biz diff --git a/src/quadnite_bot/static/help/50_dice.txt b/src/quadnite_bot/static/help/50_dice.txt new file mode 100644 index 0000000..e5f7f08 --- /dev/null +++ b/src/quadnite_bot/static/help/50_dice.txt @@ -0,0 +1,16 @@ +Dice + +[num]d[sides] [keep modifier] [modifier] + +num is the number of the dices to roll. (Optional) +sides is the number of sides of the dice. (Required) +keep_modifier is in the form of kh or kl followed by a number. This only keeps either the highest or lowest dice. (Optional) +modifier is in the form of +, -, >, <, >= or <= followed by a number. In case of + or -, the number is added or subtracted to the total. In case of >, <, >= or <=, the dice roll is checked against the condition and counted as a success if it matches it.(Optional) + +Examples: +1d6 +2d10 + 5 +3d20 kh2 - 2 +2d20 kl 2 +10d6 >= 6 +6d20 < 10