mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-18 14:40:51 +01:00
Fixed to kill bold much more accurately.
This commit is contained in:
parent
81e1c09981
commit
9cbc766b7c
@ -35,6 +35,8 @@ Removes all bold output by the bot.
|
|||||||
|
|
||||||
from baseplugin import *
|
from baseplugin import *
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
import ircmsgs
|
import ircmsgs
|
||||||
import callbacks
|
import callbacks
|
||||||
|
|
||||||
@ -47,10 +49,19 @@ def configure(onStart, afterConnect, advanced):
|
|||||||
from questions import expect, anything, something, yn
|
from questions import expect, anything, something, yn
|
||||||
onStart.append('load KillBold')
|
onStart.append('load KillBold')
|
||||||
|
|
||||||
|
# For some stupid reason, this doesn't work.
|
||||||
|
## boldre = re.compile('(?:\x02([^\x02\x03\x0f]*\x03))|'
|
||||||
|
## '(?:\x02([^\x02\x0f]*)(?:[\x02\x0f]|$))')
|
||||||
|
boldre1 = re.compile('(?:\x02([^\x02\x03\x0f]*\x03))')
|
||||||
|
boldre2 = re.compile('(?:\x02([^\x02\x0f]*)(?:[\x02\x0f]|$))')
|
||||||
|
|
||||||
class KillBold(callbacks.Privmsg):
|
class KillBold(callbacks.Privmsg):
|
||||||
|
priority = 10
|
||||||
def outFilter(self, irc, msg):
|
def outFilter(self, irc, msg):
|
||||||
if msg.command == 'PRIVMSG':
|
if msg.command == 'PRIVMSG':
|
||||||
return ircmsgs.privmsg(msg.args[0],msg.args[1].replace('\x02', ''))
|
s = boldre1.sub(r'\1', msg.args[1])
|
||||||
|
s = boldre2.sub(r'\1', s)
|
||||||
|
return ircmsgs.privmsg(msg.args[0], s)
|
||||||
else:
|
else:
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user