commit e4a40c943ef0a8db336ddfb84dce30b1921e3945
parent 795a5a3187649f05f2e1cc63ca79de5b9147fd2a
Author: Jake Bauer <jbauer@paritybit.ca>
Date: Sat, 21 Nov 2020 03:32:03 -0500
Add 8-Ball
Diffstat:
M | bot.py | | | 31 | +++++++++++++++++++++++++++++-- |
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/bot.py b/bot.py
@@ -25,13 +25,32 @@ import requests
from datetime import datetime
from pytz import timezone
-VERSION = "v0.4.3"
+VERSION = "v0.5.0"
AUTHOR = "Jake Bauer"
server = "irc.paritybit.ca"
port = 6697
channels = ["#test"]
botnick = "testbot"
quotesfile = "quotes.txt"
+eightBallResponses = ["It is certain.",
+ "It is decidedly so.",
+ "Without a doubt.",
+ "Yes – definitely.",
+ "You may rely on it.",
+ "As I see it, yes.",
+ "Most likely.",
+ "Yes.",
+ "Signs point to yes.",
+ "Reply hazy, try again",
+ "Ask again later.",
+ "Better not tell you now.",
+ "Cannot predict now.",
+ "Concentrate and ask again.",
+ "Don't count on it."
+ "My reply is no."
+ "My sources say no."
+ "Outlook not so good."
+ "Very doubtful."]
ircsock = None
@@ -68,7 +87,7 @@ def main():
print(ircmsg)
if ircmsg.find(":,tbhelp") != -1:
- message = "PRIVMSG "+ get_channel(ircmsg) +" :Available commands: ,tbhelp ,tbversion ,tbwhereami ,tbquote ,tbtime ,tbdiceroll ,tbweather\n"
+ message = "PRIVMSG "+ get_channel(ircmsg) +" :Available commands: ,tbhelp ,tbversion ,tbwhereami ,tbquote ,tbtime ,tbdiceroll ,tbweather ,tb8ball\n"
send_msg(message)
elif ircmsg.find(":,tbversion") != -1:
@@ -110,6 +129,14 @@ def main():
message = "PRIVMSG " + get_channel(ircmsg) + " :Please specify a city (e.g. ,tbweather Toronto).\n"
send_msg(message)
+ elif ircmsg.find(":,tb8ball") != -1:
+ try:
+ ircmsg.split(' ')[4]
+ message = "PRIVMSG " + get_channel(ircmsg) + " :" + random.choice(eightBallResponses) + "\n"
+ except Exception as e:
+ message = "PRIVMSG " + get_channel(ircmsg) + " :Please ask me a question.\n"
+ send_msg(message)
+
elif ircmsg.find("PING ") != -1:
print("Responding to PING.")
message = "PONG :" + botnick + "\n"