forked from veiset/Brunobot
-
Notifications
You must be signed in to change notification settings - Fork 0
modules
veiset edited this page Mar 28, 2012
·
3 revisions
A very simple module that listen to the command '.test', and replies with the message 'test'.
''' Required for Brunobot module'''
version = '1.0'
name = 'cmdtest'
usage = 'test'
description = 'Only reply to the command "test". A very simple module.'
require = ['communication']
listen = ['cmd']
cmd = ['test']
..
def main(data):
communication.say(data['channel'],'test.')
..
version = '1.0'
name = 'cmdtest'
usage = 'test'
description = 'Only reply to the command "test". A very simple module.'
require = ['communication']
listen = ['cmd']
cmd = ['test']
def main(data):
communication.say(data['channel'],'test.')
A simple module that listens to a command and stores the variable given as parameter.
''' Required for Brunobot module'''
version = '1.0'
name = 'messages'
require = ['communication','presist']
listen = ['cmd']
cmd = ['store','listmsgs']
presist = ['messages']
usage = 'store <message>, listmsgs'
description = 'A basic example module that stores messages.'
store = []
def main(data):
msg = data['argv']
nick = data['nick']
cmd = data['cmd']
channel = data['channel']
if cmd == 'store' and msg:
msg = " ".join(msg)
store.append([nick,msg])
communication.say(channel,'Your message have been stored.')
if cmd == 'listmsgs':
for message in store:
communication.say(channel,'%s stored: %s' % (message[0],message[1])
Example of interaction (assuming command_prefix = "."):
vz : .store Hello!
brunobot : Your message have been stored.
andern : .store What.
brunobot : Your message have been stored.
vz : .listmsgs
brunobot : vz stored: Hello!
brunobot : andern stored: What.
Examples
some long text