Jabber/XMPP conference bot & framework
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
brathuhn/cowsay.py

23 lines
637 B

import brathuhn, subprocess
def cowsay(msg,args):
cowfile="default"
text=""
if( len(args)==2 ):
text=args[1]
elif( len(args)>=3 ):
cowfile=args[1]
for i in range(2,len(args)):
text+=args[i]+" "
else:
brathuhn.sendMsg(brathuhn.ROOM,"Usage: "+args[0]+" [cowfile] text",'groupchat')
return
try:
txt=subprocess.check_output(["cowsay","-f",cowfile,text])
for line in txt.split('\n'):
#brathuhn.sendStyledMsg(brathuhn.ROOM,line,'groupchat',)
brathuhn.sendMonoMsg(brathuhn.ROOM,line,'groupchat')
except subprocess.CalledProcessError:
pass
brathuhn.addCommand("cowsay","Usage: !cowsay [cowfile] text",cowsay)