added module notify_all, small change in module-loader in main.py

master
fbr 14 years ago
parent cab54b2b90
commit 632f6f07e9
  1. 3
      main.py
  2. 31
      modules/active/notify_all.py

@ -9,6 +9,7 @@ cwd = os.getcwd()
sys.path.append(os.path.join(cwd,"sys"))
sys.path.append(os.path.join(cwd,"modules","active"))
print cwd
import demonize, brathuhn, config
#Demonize
if not demonize.demonize(config.PIDFILE,False,config.LOGFILE):
@ -23,6 +24,8 @@ for f in files:
mod = f[:-3]
elif f.endswith(".pyc"):
mod = f[:-4]
else:
continue;
if not mod in modules:
modules.append(mod)
for mod in modules:

@ -0,0 +1,31 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
import brathuhn
##############################################
def notify_all(msg, args):
message = "";
userJID = brathuhn.getUsers().items()
for a in userJID:
message += "{0}, ".format(a[0].getResource());
message = message[:-2];
if len(args)>=2 and args[1] != "":
message += ": ";
for a in args[1:]:
message += "{0} ".format(a);
brathuhn.sendMsg(brathuhn.ROOM, message,'groupchat')
##############################################
brathuhn.addCommand("all","Usage: !all [msg]; Notify everyone in Channel", notify_all)
##############################################
Loading…
Cancel
Save