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_call(["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)