Permalink
Browse files

[inkblot] +mw to interwiki.py, bugfix

git-svn-id: https://dev.upnl.org/svn/ircbot2/trunk@52 66f668a4-574d-4515-85ec-6e73d9c367eb
  • Loading branch information...
1 parent 16bc179 commit a0d43771059d7f86af7ea02619938858c7bd16c5 @puzzlet committed Feb 18, 2010
Showing with 9 additions and 3 deletions.
  1. +4 −1 BufferingBot.py
  2. +3 −0 plugins/interwiki.py
  3. +1 −1 plugins/ipw.py
  4. +1 −1 plugins/mathnet.py
View
@@ -91,7 +91,7 @@ def purge(self):
traceback.print_exc()
self.push(message)
return
- if not message.is_system_message():
+ if not self.is_system_message(message):
line_counts[target] += 1
for target, line_count in line_counts.iteritems():
message = "-- Message lags over %f seconds. Skipping %d line(s).." \
@@ -105,6 +105,9 @@ def purge(self):
def has_buffer_by_command(self, command):
return any(_.command == command for _ in self.heap)
+ def is_system_message(self, message):
+ return message.startswith('--') # XXX
+
class BufferingBot(ircbot.SingleServerIRCBot):
def __init__(self, network_list, nickname, realname,
reconnection_interval=60, use_ssl=False):
@@ -12,6 +12,7 @@ def get_mediawiki_page(page, enc):
LOCATION = {
u'b': u'wikibooks',
u'm': u'meta',
+ u'mw': u'mediawiki',
u's': u'wikisource',
u'wikt': u'wiktionary',
}
@@ -30,6 +31,8 @@ def get_wikipedia_url(page, lang=u'ko', location=u'wikipedia'):
page = get_mediawiki_page(page, 'utf-8')
if location in (u'meta', u'commons'):
return u'http://%s.wikimedia.org/wiki/%s' % (location, page)
+ elif location in (u'mediawiki'):
+ return u'http://www.%s.org/wiki/%s' % (location, page)
return u'http://%s.%s.org/wiki/%s' % (lang, location, page)
def on_msg(bot, connection, event):
View
@@ -10,7 +10,7 @@ def on_msg(bot, connection, event):
source = source.split('@')[0]
if '=' in source: source = source.split('=',1)[1]
if '~' in source: source = source.split('~',1)[1]
- if source in ['uniko', 'kouni', '|']:
+ if source in ['I|', '|I', '|']:
msg = re.sub(r'^<.*?> ', '', msg, 1)
if not msg.startswith('!ipw'):
return
View
@@ -22,7 +22,7 @@ def on_pubmsg(bot, connection, event):
source = source.split('@')[0]
if '=' in source: source = source.split('=',1)[1]
if '~' in source: source = source.split('~',1)[1]
- if source in ['uniko', 'kouni', '|']:
+ if source in ['I|', '|I', '|']:
msg = re.sub(r'^<.*?> ', '', msg, 1)
commands = ['mathnet', 'mn']

0 comments on commit a0d4377

Please sign in to comment.