def help(self, mask, target, args): """Show help %%help [<cmd>] """ if args['<cmd>']: predicates, meth = self.get(args['<cmd>'], (None, None)) if meth is not None: doc = meth.__doc__ or '' doc = [l.strip() for l in doc.split('\n') if l.strip()] buf = '' for line in doc: if '%%' not in line and buf is not None: buf += line + ' ' else: if buf is not None: for b in utils.split_message(buf, 160): yield b buf = None line = line.replace('%%', self.context.config.cmd) yield line else: cmds = ', '.join([self.cmd + k for k in sorted(self.keys())]) lines = utils.split_message('Available commands: ' + cmds, 160) for line in lines: yield line url = self.config.get('url') if url: yield 'Full help is available at ' + url
def help(self, mask, target, args): """Show help %%help [<cmd>] """ if args['<cmd>']: predicates, meth = self.get(args['<cmd>'], (None, None)) if meth is not None: doc = meth.__doc__ or '' doc = [l.strip() for l in doc.split('\n') if l.strip()] buf = '' for line in doc: if '%%' not in line and buf is not None: buf += line + ' ' else: if buf is not None: for b in utils.split_message(buf, 160): yield b buf = None line = line.replace('%%', self.bot.config.cmd) yield line else: cmds = ', '.join([self.cmd + k for k in sorted(self.keys())]) lines = utils.split_message('Available commands: ' + cmds, 160) for line in lines: yield line url = self.config.get('url') if url: yield 'Full help is available at ' + url
def help(self, mask, target, args): """Show help %%help [<cmd>] """ if args['<cmd>']: args = args['<cmd>'] # Strip out self.context.config.cmd from args so we can use # both !help !foo and !help foo if args.startswith(self.context.config.cmd): args = args[len(self.context.config.cmd):] args = self.aliases.get(args, args) predicates, meth = self.get(args, (None, None)) if meth is not None: doc = meth.__doc__ or '' doc = [ line.strip() for line in doc.split('\n') if line.strip() ] buf = '' for line in doc: if '%%' not in line and buf is not None: buf += line + ' ' else: if buf is not None: for b in utils.split_message(buf, 160): yield b buf = None line = line.replace('%%', self.context.config.cmd) yield line aliases = predicates.get('aliases', None) if aliases is not None: yield 'Aliases: {0}'.format(','.join(sorted(aliases))) else: yield ('No such command. Try %shelp for an ' 'overview of all commands.' % self.context.config.cmd) else: cmds = sorted((k for (k, (p, m)) in self.items() if p.get('show_in_help_list', True))) cmds_str = ', '.join([self.cmd + k for k in cmds]) lines = utils.split_message('Available commands: %s ' % cmds_str, 160) for line in lines: yield line url = self.config.get('url') if url: yield 'Full help is available at ' + url
def help(self, mask, target, args): """Show help %%help [<cmd>] """ if args['<cmd>']: args = args['<cmd>'] # Strip out self.context.config.cmd from args so we can use # both !help !foo and !help foo if args.startswith(self.context.config.cmd): args = args[len(self.context.config.cmd):] args = self.aliases.get(args, args) predicates, meth = self.get(args, (None, None)) if meth is not None: doc = meth.__doc__ or '' doc = [l.strip() for l in doc.split('\n') if l.strip()] buf = '' for line in doc: if '%%' not in line and buf is not None: buf += line + ' ' else: if buf is not None: for b in utils.split_message(buf, 160): yield b buf = None line = line.replace('%%', self.context.config.cmd) yield line aliases = predicates.get('aliases', None) if aliases is not None: yield 'Aliases: {0}'.format(','.join(sorted(aliases))) else: yield ('No such command. Try %shelp for an ' 'overview of all commands.' % self.context.config.cmd) else: cmds = sorted((k for (k, (p, m)) in self.items() if p.get('show_in_help_list', True))) cmds_str = ', '.join([self.cmd + k for k in cmds]) lines = utils.split_message( 'Available commands: %s ' % cmds_str, 160) for line in lines: yield line url = self.config.get('url') if url: yield 'Full help is available at ' + url
def notice(self, client, message): """send a notice to client""" if client and message: messages = utils.split_message(message, self.config.max_length) for msg in messages: client.fwrite(':{c.srv} NOTICE {c.nick} :{msg}', msg=msg)
def callFTU(self, messages, max_length=10): return list(split_message(' '.join(messages), max_length))
def callFTU(self, messages, **kwargs): return list(split_message(' '.join(messages), 80))