Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/plugin.py
diff options
context:
space:
mode:
authorRichard Darst <rkd@zgib.net>2009-05-11 17:54:36 (GMT)
committer Richard Darst <rkd@zgib.net>2009-05-11 17:54:36 (GMT)
commit07575ac98459ba12823845b8054e7fd2e8648c50 (patch)
tree8f97a334090c332fd7d4e8f337852415ba66b987 /plugin.py
parentc792b3bb414dd14c879cb1615f4f71e4ecff0b58 (diff)
add pingall command. Pings all nicks on the channel.
- currently can be used by anyone. This can be changed if it is abused. darcs-hash:20090511175436-82ea9-ef91d5b2b83fcaac11878d456824300a665c7720.gz
Diffstat (limited to 'plugin.py')
-rw-r--r--plugin.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/plugin.py b/plugin.py
index b67a5ab..f85368f 100644
--- a/plugin.py
+++ b/plugin.py
@@ -116,6 +116,42 @@ class MeetBot(callbacks.Plugin):
irc.reply("Saved %d meetings."%numSaved)
savemeetings = wrap(savemeetings, ['owner'])
+ def pingall(self, irc, msg, args, message):
+ """Send a broadcast ping to all users on the channel.
+
+ An message to be sent along with this ping must also be
+ supplied for this command to work.
+ """
+ nick = msg.nick
+ channel = msg.args[0]
+ payload = msg.args[1]
+
+ # We require a message to go out with the ping, we don't want
+ # to waste people's time:
+ if channel[0] != '#':
+ irc.reply("Not joined to any channel.")
+ return
+ if message is None:
+ irc.reply("You must supply a description with the `pingall` command. We don't want to go wasting people's times looking for why they are pinged.")
+ return
+
+ # Send announcement message
+ irc.sendMsg(ircmsgs.privmsg(channel, message))
+ # ping all nicks in lines of about 256
+ nickline = ''
+ nicks = sorted(irc.state.channels[channel].users,
+ key=lambda x: x.lower())
+ for nick in nicks:
+ nickline = nickline + nick + ' '
+ if len(nickline) > 256:
+ irc.sendMsg(ircmsgs.privmsg(channel, nickline))
+ nickline = ''
+ irc.sendMsg(ircmsgs.privmsg(channel, nickline))
+ # Send announcement message
+ irc.sendMsg(ircmsgs.privmsg(channel, message))
+
+ pingall = wrap(pingall, [optional('text', None)])
+
Class = MeetBot