Added announce command.

This commit is contained in:
Jeremy Fincher 2004-04-18 00:38:20 +00:00
parent e7f6aa884f
commit 069d48b269

View File

@ -330,8 +330,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
except Exception, e: except Exception, e:
irc.reply(utils.exnToString(e)) irc.reply(utils.exnToString(e))
else: else:
# This should never happen, so I haven't bothered updating # This should never happen.
# this error string to say --allow-eval.
irc.error('You must run supybot with the --allow-eval ' irc.error('You must run supybot with the --allow-eval '
'option for this command to be enabled.') 'option for this command to be enabled.')
else: else:
@ -341,6 +340,20 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
'this command to be enabled.') 'this command to be enabled.')
_exec = eval _exec = eval
def announce(self, irc, msg, args):
"""<text>
Sends <text> to all channels the bot is currently on and not
lobotomized in.
"""
text = privmsgs.getArgs(args)
u = ircdb.users.getUser(msg.prefix)
text = 'Announcement from my owner (%s): %s' % (u.name, text)
for channel in irc.state.channels:
c = ircdb.channels.getChannel(channel)
if not c.lobotomized:
irc.queueMsg(ircmsgs.privmsg(channel, text))
def defaultplugin(self, irc, msg, args): def defaultplugin(self, irc, msg, args):
"""[--remove] <command> [<plugin>] """[--remove] <command> [<plugin>]