From 2b5348b1dfa9e462c12dce14b268c0162600131d Mon Sep 17 00:00:00 2001 From: Sridhar Ratna Date: Tue, 1 Jan 2008 16:08:21 +0000 Subject: [PATCH] add cmd_source; remove freq limits; ,help is now public accessible --- plugins.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/plugins.py b/plugins.py index 758de85..d9b35de 100644 --- a/plugins.py +++ b/plugins.py @@ -5,7 +5,7 @@ from datetime import datetime import random, time, re, urllib PREFIX = ',' - +SOURCE = 'http://repo.or.cz/w/lusty.git' def handleMsg(bot, user, channel, msg): ignoreChannels = [bot.nickname, 'AUTH'] @@ -139,8 +139,6 @@ class Commands(BotActions): self.toUser('reloaded') cmd_r = cmd_reload - @admin(['srid']) - @limitFreq(15) def cmd_help(self, args=None): ignore = ('help', 'PING') for name, func, docstring in self: @@ -163,16 +161,21 @@ class Commands(BotActions): self.toChannel(result) cmd_e = cmd_eval - @limitFreq(60*2) def cmd_google(self, search_terms=None): "search the internet" if search_terms: - soup = soupify('http://www.google.com/search?' + urllib.urlencode({'q': search_terms})) - firstLink = soup.find('a', attrs={'class': 'l'})['href'].encode('utf-8').strip() + soup = soupify('http://www.google.com/search?' + \ + urllib.urlencode({'q': search_terms})) + firstLink = soup.find('a', attrs={'class': 'l'}) + firstLink = firstLink['href'].encode('utf-8').strip() log.msg('google:', firstLink) self.toChannel(firstLink) cmd_g = cmd_google + def cmd_source(self, args=None): + "how to access lusty's source code" + self.toUser(SOURCE) + def cmd_tell(self, args=None): if args: user, message = args.split(None, 1) @@ -205,12 +208,13 @@ class Commands(BotActions): name = attr[len('cmd_'):] if func in cmdMap: # find and overwrite the alias. - # the name of an alias is shorter than the name of the original version. + # the name of an alias is shorter than the name + # of the original version. if len(cmdMap[func]) < len(name): cmdMap[func] = name else: cmdMap[func] = name - + for func, name in cmdMap.items(): yield name, func, func.__doc__ @@ -292,7 +296,6 @@ class Filters(BotActions): ])) _filter_links_url = re.compile('.*(https?://[^ ]*).*') - @limitFreq(60*2) def filter_links(self, msg): "Show in channel" match = self._filter_links_url.match(msg) -- 2.11.4.GIT