def approve(self, mess, args): """An admin-only command""" admin = str(mess.getFrom()).split('@')[0] in admins if not admin: return 'You are not admin' if len(args.split()) >= 1: if args.lower() in infobits.keys() and not infobits.get(args, ('not found', True))[1]: self.setbit(mess, args) infobits.update({' '.join(args.lower().split('_')): (infobits.get(args, ('not found', True))[0], True)}) return 'InfoBit Approved' return 'Error'
def setbit(self, mess, args): """Set an infobit use 'set infobit description of infobit' and wait for admin approval""" args = args.split() admin = str(mess.getFrom()).split('@')[0] in admins if len(args) > 1: if ' '.join(args[0].lower().split('_')) in infobits.keys() and not admin: return 'Somebody already told me what that means' infobits.update({' '.join(args[0].lower().split('_')): (' '.join(args[1:]), admin)}) print 'Somebody set ' + ' '.join(args[0].lower().split('_')) return 'Infobit set!' return 'Invalid usage'