From 393abf180b6bfcf89ab8544ec691a97d840f0963 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 4 Jan 2014 21:38:58 +0100 Subject: ircbot: more (fancy) features --- ircbot/contoller.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'ircbot/contoller.py') diff --git a/ircbot/contoller.py b/ircbot/contoller.py index 71d04536..9466343d 100755 --- a/ircbot/contoller.py +++ b/ircbot/contoller.py @@ -33,7 +33,11 @@ class NewsBot(irc.bot.SingleServerIRCBot): args_array = event.arguments[0].split() if args_array[0][:-1]==self.name: answer = self.read_message(args_array[1:]) - self.connection.privmsg(self.chan, answer) + self.send(answer) + + def send(self, string): + for line in string.split('\n'): + self.connection.privmsg(self.chan, line) def on_pubmsg(self, connection, event): @@ -63,7 +67,19 @@ class NewsBot(irc.bot.SingleServerIRCBot): return "bots saved to " + feedfile elif args[0] == 'caps': - return "add del save caps" + return "add del save caps list" + + elif args[0] == 'list': + output_buffer = '' + for bot in bots: + output_buffer += bot + ' url: ' + bots[bot].url + '\n' + return output_buffer + + elif args[0] == 'info': + if args[1] in bots: + return 'title: ' + bots[args[1]].feed.feed.title + '\n' + 'size: ' + len(bots[args[1]].feed.entries) + else: + return 'bot not found' else: return "unknown command" -- cgit v1.2.3