@@ 46,7 46,7 @@ def handle_msg(nick, line, words, pwords):
if cmd == 'help':
help(nick)
- elif cmd not in ('roll', 'pick', 'shuf', 'shuffle'):
+ elif cmd not in ('roll', 'pick', 'shuf', 'shuffle', 'do', 'don\'t', 'should', 'are'):
send(f'{nick}, I don\'t know how to do that! My help is at {MAN}')
elif len(pwords) < 1:
send(f'{nick}, {cmd} what?')
@@ 56,6 56,28 @@ def handle_msg(nick, line, words, pwords):
pick(nick, words, pwords)
elif cmd in ('shuf', 'shuffle'):
shuf(nick, words, pwords)
+ elif cmd == 'do':
+ if pwords[0].lower() == 'i':
+ do_i(nick, words[1:], pwords[1:])
+ elif pwords[:2] == ['you', 'think']:
+ dyt(nick)
+ else:
+ send(f'{nick}, do what?')
+ elif cmd == 'should':
+ if pwords[0].lower() == 'i':
+ do_i(nick, words[1:], pwords[1:])
+ else:
+ dyt(nick)
+ elif cmd == 'don\'t':
+ if pwords[0].lower() == 'i':
+ dyt(nick)
+ elif pwords[:2] == ['you', 'think']:
+ dyt(nick)
+ else:
+ send(f'{nick}, don\'t what?')
+ elif cmd == 'are':
+ dyt(nick)
+
def handle_action(line, words, pwords):
@@ 64,16 86,61 @@ def handle_action(line, words, pwords):
### CHOICES, CHOICES ###
-def pick(nick, words, pwords):
- terms = botlib.split_list(words, pwords)
- picked = choice(terms)
- send(f'{nick}, how about {" ".join(picked)}?')
+def pick(nick, words, pwords, ignore=['or']):
+ formats = [
+ 'my sources tell me {} is the best option.',
+ 'how about {}?',
+ 'I\'ve got a good feeling about {}.',
+ 'if I *had* to pick, I\'d say {}.',
+ 'signs point to {}.',
+ '{}!',
+ 'try {}... if you dare!',
+ 'a terrible fate will befall you! ...unless you pick {}!',
+ 'after extensive deliberation, I think {} is the only option',
+ 'nothing ventured, nothing gained! try {}.',
+ ]
+
+ terms = botlib.split_list(words, pwords, ignore)
+ picked = " ".join(choice(terms)).rstrip('?')
+ reply = choice(formats).format(picked)
+ send(f'{nick}, {reply}')
def shuf(nick, words, pwords):
- terms = botlib.split_list(words, pwords)
+ terms = botlib.split_list(words, pwords, ['and'])
shuffle(terms)
send(f'{nick}: {", ".join(map(" ".join, terms))}')
+def do_i(nick, words, pwords):
+ if 'or' not in pwords:
+ dyt(nick)
+ else:
+ for word in words:
+ if word.endswith(','):
+ pick(nick, words, pwords, ['or', 'do', 'should', 'i'])
+ break
+ else:
+ dyt(nick)
+
+def dyt(nick):
+ replies = [
+ 'yes',
+ 'yeah!',
+ 'absolutely!',
+ 'sure',
+ 'signs point to yes',
+ 'totally!',
+ 'no',
+ 'nah',
+ 'signs point to no',
+ 'never in a million years!',
+ 'maybe',
+ 'dunno',
+ 'not sure',
+ 'ask again later'
+ ]
+
+ send(f'{nick}, {choice(replies)}')
+
### DICE ###
@@ 170,7 237,7 @@ def dice(nick, words, pwords):
result = nick
- terms = botlib.split_list(words, pwords)
+ terms = botlib.split_list(words, pwords, ['and'])
print(f'{terms=}')
for term in terms:
try: