parent
988a2acbee
commit
2425395575
@ -0,0 +1,33 @@ |
|||||||
|
import brathuhn, datetime, time |
||||||
|
|
||||||
|
last_active = dict() |
||||||
|
|
||||||
|
def active(mfrom,msg): |
||||||
|
global last_active |
||||||
|
body = unicode(msg.getBody()) |
||||||
|
res = mfrom.getResource() |
||||||
|
date=datetime.datetime.fromtimestamp(time.time()) |
||||||
|
last_active[res]=(body,date.strftime("%a, %d-%b-%Y %H:%M:%S")) |
||||||
|
brathuhn.addGroupListener(active) |
||||||
|
|
||||||
|
|
||||||
|
def last_active_cmd(msg,args): |
||||||
|
if( len(args)==2 ): |
||||||
|
res = args[1] |
||||||
|
if res in last_active: |
||||||
|
if res[-1]!='s': |
||||||
|
mymsg=res+"'s" |
||||||
|
else: |
||||||
|
mymsg=res+"'" |
||||||
|
la = last_active[res] |
||||||
|
mymsg+= " last message on "+la[1]+' : "'+la[0]+'"' |
||||||
|
|
||||||
|
brathuhn.sendMsg(brathuhn.ROOM,mymsg,'groupchat') |
||||||
|
else: |
||||||
|
brathuhn.sendMsg(brathuhn.ROOM,"no message in record",'groupchat') |
||||||
|
else: |
||||||
|
brathuhn.sendMsg(brathuhn.ROOM,"Usage: "+args[0]+" nick",'groupchat') |
||||||
|
brathuhn.addCommand("last_active","Usage: !last_active nick",last_active_cmd) |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in new issue