| Paste number 50966: | my supybot plugins |
| Pasted by: | Chairos |
| When: | 1 year, 7 months ago |
| Share: | Tweet this! | http://paste.lisp.org/+13BQ |
| Channel: | #pylons |
| Paste contents: |
# This one was written when the registration lapsed on a channel, and we could only re-reg it with ops, and nobody in the channel had ops. So we had everyone leave the channel (except we had a lot of idlers), and set the bot to try to seize ops when the channel was finally empty.
class Danish(callbacks.Plugin):
"""Add the help for "@plugin help Danish" here
This should describe *how* to use this plugin."""
def _sendMsg(self, irc, msg):
irc.queueMsg(msg)
irc.noReply()
def doPart(self, irc, msg):
channel = msg.args[0]
if channel=="#void" and irc.nick != msg.nick:
L = list(irc.state.channels[channel].users)
if len(L)==1:
self._sendMsg(irc, ircmsgs.part(channel, msg.nick))
networkGroup = conf.supybot.networks.get(irc.network)
self._sendMsg(irc, networkGroup.channels.join(channel))
s = smtplib.SMTP("me@example.com", "me@example.com", "From: me@example.com\nTo: me@example.com\nSubject: Danish seized\n\nI've got it!\n")
name = "Danish"
conf.registerPlugin(name, False)
callbacks = irc.removeCallback(name)
if callbacks:
for callback in callbacks:
callback.die()
del callback
gc.collect()
# we also had this notice when people joined the channel
class Signpost(callbacks.Plugin):
"""Add the help for "@plugin help Signpost" here
This should describe *how* to use this plugin."""
def doJoin(self, irc, msg):
# print dir(irc)
# print dir(msg)
if msg.args[0] == "#void" and irc.nick != msg.nick:
irc.reply("There's been a leak at the plant, and we have to evacuate #void until further notice. Please make your way over to #ether now. Thank you, The Management." )
# standard trigger; this was to replace the primary functionality of our long-lost eggdrop bot
class Jukebox(callbacks.Plugin):
"""Add the help for "@plugin help Jukebox" here
This should describe *how* to use this plugin."""
def jukebox(self, irc, msg, args, song, donothing):
"""<song>
Play it, Sam. Play the <song>."""
irc.reply("borrows some money from %s without remembering to ask, then walks over to the jukebox and plays o/` %s o/`, \"Compliments of ... um ... I forgot!\"" % (msg.nick, song), action=True)
jukebox = wrap(jukebox, ['text', 'inChannel'])
This paste has no annotations.