reimu is a simple Skype bot framework.
touch foo.py
Edit foo.py
def ping(msg):
'''!ping:ping-pong test'''
return 'pong'
def greet(msg):
name = msg.FromDisplayName
return 'Hello, %s' % name
Function is called with argument 'msg' when chat message matches.
Function must return string/unicode.
'msg' is a instance of Skype4Py/Message.
For more information, see Skype4Py Reference#Message
Edit ./patterns.py
import foo
import user module.
patterns = [
(r'^!ping$', foo.ping),
('hi', foo.greet),
]
Add regex pattern and function that returns message. patterns = [(REGEX_STRING, FUNCTION), ...]
(r'^!help$', show_help)
is automatically added to patterns.
To generate help document, add docstring to function.
python run_bot.py
Execution of all mapped function will timeout if it couldn't finish within 3 seconds.
To change timeout length, edit PROCESS_TIMEOUT
in core/processor.py