paritybot

A fun IRC bot.
git clone https://git.sr.ht/~jbauer/paritybot
Log | Files | Refs | README | LICENSE

commit b59dcf9b45dcd436487201bea8eb0a197e1360e3
parent 8d8e9e04306d5a6a4e47b8b489f1e4b88046c494
Author: Sol Fisher Romanoff <sol@solfisher.com>
Date:   Sun, 17 Oct 2021 01:39:11 -0400

Add additional information to +help

Diffstat:
Mbot.py | 22++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/bot.py b/bot.py @@ -58,7 +58,21 @@ class Bot: self.admins = [] self.eightBallResponses = [] self.quotesfile = "" - self.commandList = "+help +version +quit +quote +time +roll +weather +8ball +repeat +addadmin +rmadmin +admins +chgpass" + self.commandList = { + "help": "+help: List all available commands", + "version": "+version: Print information about the bot", + "quit": "+quit: End this session", + "quote": "+quote: Print a random quote", + "time": "+time <timezone>: Print the time in a given timezone", + "roll": "+roll <number>: Print a random number in a given range", + "weather": "+weather <city>: Print the weather in a given city", + "8ball": "+8ball: Correctly and accurately predict the future", + "repeat": "+repeat <message>: Print a given message", + "addadmin": "+addadmin <user>: Give a user admin privileges", + "rmadmin": "+rmadmin <user>: Revoke a user's admin privileges", + "admins": "+admins: List admins", + "chgpass": "+chgpass <password>: Change the bot's password to a given string", + } self.exception = "" def load_config(self): @@ -186,7 +200,11 @@ class Bot: return False def command_help(self, incoming): - self.send_message("PRIVMSG " + self.get_channel(incoming) + " :Available commands: " + self.commandList + "\n") + try: + self.send_message("PRIVMSG " + self.get_channel(incoming) + " :" + self.commandList[incoming.split(' ')[4]] + "\n") + except: + self.send_message("PRIVMSG " + self.get_channel(incoming) + " :Available commands: " + " ".join(("+" + x) for x in self.commandList.keys()) + "\n") + self.send_message("PRIVMSG " + self.get_channel(incoming) + " :+help <command> for more information" + "\n") def command_version(self, incoming): self.send_message("PRIVMSG " + self.get_channel(incoming) + " :" + self.nick + "version " + self.VERSION + " by " + self.AUTHOR + ".\n")