mirror of
https://github.com/RussellChamp/tilde-projects.git
synced 2026-10-28 00:22:34 +00:00
Ported banterbot to pinhook framework and some other changes
This commit is contained in:
1 parent
0627b4a9e3
commit
bc102890b2
39 files changed
+1629
-507
No files matched your search
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import pinhook.plugin
|
||||
from util import rhymesWith
|
||||
|
||||
poetic_file = "/home/nossidge/poems/words_poetic.txt"
|
||||
|
||||
@pinhook.plugin.register('!rhymes')
|
||||
def rhymes_plugin(msg):
|
||||
word = ""
|
||||
if msg.arg == "":
|
||||
with open(poetic_file, "r") as words:
|
||||
word = random.choice(words.readlines()).strip("\n")
|
||||
else:
|
||||
word = msg.arg.split()[0]
|
||||
|
||||
rhymes = rhymesWith.rhymeZone(word)
|
||||
if len(rhymes) == 0:
|
||||
return pinhook.plugin.message("{}: Couldn't find anything that rhymes with '{}' :(".format(msg.nick, word))
|
||||
else:
|
||||
return pinhook.plugin.message("{}: Here, these words rhyme with '{}': {}".format(msg.nick, word, ", ".join(rhymes)))
|
||||
Reference in new issue
Block a user