minetestbot-modules/ping.py

32 lines
914 B
Python
Raw Normal View History

2013-01-07 10:00:44 -08:00
#!/usr/bin/env python
"""
ping.py - Phenny Ping Module
Author: Sean B. Palmer, inamidst.com
About: http://inamidst.com/phenny/
"""
import random
def hello(phenny, input):
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
greeting = random.choice(('Hi', 'Hey', 'Hello', 'sup'))
punctuation = random.choice(('', '!', '.'))
2013-01-07 10:00:44 -08:00
phenny.say(greeting + ' ' + input.nick + punctuation)
hello.rule = r'(?i)(hi|hello|hey) $nickname[ \t]*$'
def interjection(phenny, input):
for x in phenny.bot.commands["high"].values():
if x[0].__name__ == "aa_hook":
if x[0](phenny, input):
return # Abort function
2013-01-07 10:00:44 -08:00
phenny.say(input.nick + '!')
interjection.rule = r'$nickname!'
interjection.priority = 'high'
interjection.thread = False
if __name__ == '__main__':
print __doc__.strip()