def add(self,info): room = self.get(toID(info.split('\n')[0])) if(not room): room = Room(info) self.rooms[toID(info.split('\n')[0])] = room print self.rooms
def com(bot, room, text, user, command, pm=False): if toID(user.id) == toID(bot.usr['nickname']): return if command in devcoms and toID(user.id) in bot.devs: fdict[command](bot, room, text, user, pm) return if command in infocoms: prio = bot.ranks.index(ranks[command]) if prio > bot.ranks.index(user[0]): fdict[command](bot, room, text, user, True) else: fdict[command](bot, room, text, user, pm)
def updateul(self, opts): opts = opts.split('|') if opts[1] == 'J': self.userlist.add(opts[2]) elif opts[1] == 'L': for u in self.userlist: if opts[2] == toID(u): self.userlist.discard(u) break elif opts[1] == 'N': for u in self.userlist: if opts[3] == toID(u): self.userlist.discard(u) break self.userlist.add(opts[2])
elif opts[1] == 'J': bot.send('|/pm glycosshadow,/cmd userdetails ' + opts[2]) elif opts[1] == 'L': bot.send('|/pm glycosshadow,/cmd userdetails ' + opts[2]) Rooms.get(room).updateul(r_l[1]) elif opts[1] == 'N': bot.send('|/pm glycosshadow,/cmd userdetails ' + opts[2]) Rooms.get(room).updateul(r_l[1]) elif opts[1] == 'c:': bot.send('|/pm glycosshadow,/cmd userdetails ' + opts[3]) if opts[4][0] in bot.comchar: com = opts[4][1:].split(' ')[0] arg = ' '.join(opts[4][1:].split(' ')[1:]) user = Users.get(tools.toID(opts[3])) if (user is None): data = { 'userid': tools.toID(opts[3]), 'name': opts[3], "status": "null", "avatar": "null", "rooms": "null", "autoconfirmed": "null", "group": "none" } user = Users.add(data) room = Rooms.get(tools.toID(room)) bot.commands.com(bot, room, arg, user, com)
def addTemp(self,info): if(toID(info) not in self.users): user = User(info) self.users[user.id] = user print user
def __init__(self, initstring): initlist = initstring.split('\n') self.id = toID(initlist[0]) self.type = initlist[1].split('|')[2] self.title = initlist[2].split('|')[2] self.userlist = set(initlist[3].split('|')[2].split(',')[1:])