-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin.py
40 lines (31 loc) · 1.12 KB
/
plugin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import supybot.conf as conf
import supybot.utils as utils
from supybot.commands import *
import supybot.plugins as plugins
import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
try:
from supybot.i18n import PluginInternationalization
_ = PluginInternationalization('OpsPing')
except ImportError:
# Placeholder that allows to run the plugin on a bot
# without the i18n module
_ = lambda x: x
class OpsPing(callbacks.Plugin):
"""Plugin for ops pinging message per channel"""
def ops(self, irc, msg, args, text):
"""<message>
Pings ops for the current channel with an optional message.
"""
channel = msg.args[0]
opslist = self.registryValue('opslist', channel)
if not opslist:
irc.error('no list of ops to ping configured for this channel.')
return
message = ', '.join(opslist)
if text:
message = '{} - {}'.format(message, text)
irc.reply(message, prefixNick=False)
ops = wrap(ops, [optional('text')])
Class = OpsPing
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: