本文整理汇总了Python中supybot.schedule.addEvent函数的典型用法代码示例。如果您正苦于以下问题:Python addEvent函数的具体用法?Python addEvent怎么用?Python addEvent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addEvent函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: newquestion
def newquestion(self):
if self.num == 0:
self.active = False
elif (
self.unanswered > self.registryValue("inactiveShutoff", self.channel)
and self.registryValue("inactiveShutoff", self.channel) >= 0
):
self.reply("Seems like no one's playing any more.")
self.active = False
elif len(self.questions) == 0:
self.reply("Oops! I ran out of questions!")
self.active = False
if not self.active:
self.stop()
return
self.hints = 0
self.num -= 1
self.numAsked += 1
which = self.rng.randint(0, len(self.questions) - 1)
q = self.questions.pop(which)
sep = self.registryValue("questionFileSeparator")
self.q = q[: q.find(sep)]
self.a = q[q.find(sep) + len(sep) :].split(sep)
self.reply(
"\x03%s#%d of %d: %s" % (self.registryValue("color", self.channel), self.numAsked, self.total, self.q)
)
def event():
self.timedEvent()
eventTime = time.time() + self.registryValue("timeout", self.channel) / (
self.registryValue("numHints", self.channel) + 1
)
if self.active:
schedule.addEvent(event, eventTime, "next_%s" % self.channel)
开发者ID:quantumlemur,项目名称:Supybot-Plugins,代码行数:35,代码来源:plugin.py
示例2: doPrivmsg
def doPrivmsg(self, irc, msg):
if irc.isChannel(msg.args[0]):
speakChan = msg.args[0]
dbChan = plugins.getChannel(speakChan)
canSpeak = False
now = time.time()
throttle = self.registryValue('randomSpeaking.throttleTime',
speakChan)
prob = self.registryValue('randomSpeaking.probability', speakChan)
delay = self.registryValue('randomSpeaking.maxDelay', speakChan)
if now > self.lastSpoke + throttle:
canSpeak = True
if canSpeak and random.random() < prob:
f = self._markov(speakChan, irc, prefixNick=False,
to=speakChan, Random=True)
schedule.addEvent(lambda: self.q.enqueue(f), now + delay)
self.lastSpoke = now + delay
words = self.tokenize(msg)
# This shouldn't happen often (CTCP messages being the possible
# exception)
if not words:
return
if self.registryValue('ignoreBotCommands', speakChan) and \
callbacks.addressed(irc.nick, msg):
return
words.insert(0, None)
words.insert(0, None)
words.append(None)
def doPrivmsg(db):
for (first, second, follower) in utils.seq.window(words, 3):
db.addPair(dbChan, first, second, follower,
isFirst=(first is None and second is None),
isLast=(follower is None))
self.q.enqueue(doPrivmsg)
开发者ID:GlitterCakes,项目名称:PoohBot,代码行数:34,代码来源:plugin.py
示例3: newquestion
def newquestion(self):
inactiveShutoff = self.registryValue('inactiveShutoff',
self.channel)
if self.num == 0:
self.active = False
elif self.unanswered > inactiveShutoff and inactiveShutoff >= 0:
self.reply(_('Seems like no one\'s playing any more.'))
self.active = False
elif len(self.questions) == 0:
self.reply(_('Oops! I ran out of questions!'))
self.active = False
if not self.active:
self.stop()
return
self.hints = 0
self.num -= 1
self.numAsked += 1
which = self.rng.randint(0, len(self.questions)-1)
q = self.questions.pop(which)
sep = self.registryValue('questionFileSeparator')
self.q = q[:q.find(sep)]
self.a = q[q.find(sep)+len(sep):].split(sep)
color = self.registryValue('color', self.channel)
self.reply(_('\x03%s#%d of %d: %s') % (color, self.numAsked,
self.total, self.q))
def event():
self.timedEvent()
timeout = self.registryValue('timeout', self.channel)
numHints = self.registryValue('numHints', self.channel)
eventTime = time.time() + timeout / (numHints + 1)
if self.active:
schedule.addEvent(event, eventTime, 'next_%s' % self.channel)
开发者ID:AlanBell,项目名称:Supybot-plugins,代码行数:32,代码来源:plugin.py
示例4: request
def request(self, irc, msg, args, channel, reason):
"""<channel> - channel name for which you make request, <reason> - reason why do you want bot (it must be some good reason, not some bullshit)
Request bot for <channel>, you must specify <reason> why do you want it."""
# TODO: Before anything happens we should check if <channel> is valid IRC channel name
# because if it's not we won't be able to join it, collect irc.state and our code will
# probably brake in the unwanted manner
#TODO: If we're already on channel nothing should be done and user should be
# presented with explanation (we still have to implement that in our code)"""
nick = msg.nick
isChannelBanned = self._checkChannelBan(channel)
# TODO: change this because this will probably return dict of more info about ban
if isChannelBanned == "Valid":
isRequesterBanned = self._checkRequesterBan(nick)
# TODO: Change this because this will probably behave like channel ban and will return dict
if isRequesterBanned == "Valid":
# We're doing it this way because it's much more easier than trying to reimplement
# admin join function with all those network, group, et. stuff
adminPlugin = irc.getCallback("Admin")
adminPlugin.join(irc, msg, [channel.lower()])
# We must schedule this command because when bot joins some channel it neads few seconds
# to collect irc.state and we can't access those right after the join
schedule.addEvent(self._channelState, time.time() + 5, args=[irc, msg, nick, channel, adminPlugin])
elif isRequesterBanned == "Banned":
irc.reply("You can't request bot becuase you're on ban list.")
else:
irc.reply("There was some ugly internal error. Please try again and notify my owner about this.")
elif isChannelBanned == "Banned":
irc.reply("This channel is banned and you can't request bot for it.")
else:
irc.reply("There was some ugly internal error. Please try again and notify my owner about this.")
开发者ID:kg-bot,项目名称:SupyBot,代码行数:32,代码来源:plugin.py
示例5: starthello
def starthello(self, irc, msg, args):
"""Nothing"""
channel = msg.args[0]
eventName = "%s_sayhello" % channel
def sayHello():
irc.queueMsg(ircmsgs.privmsg("DonVitoCorleone", "Function _sayHello is called"))
eventNumber = self.read_timer_number()
eventNumber = eventNumber["n"]
irc.queueMsg(ircmsgs.privmsg("DonVitoCorleone", "eventN is %i" % eventNumber))
if eventNumber <= 1:
irc.queueMsg(ircmsgs.privmsg("DonVitoCorleone", "It's diferent"))
self.write_timer_number()
"""if eventNumber <= 5:
irc.sendMsg(ircmsgs.privmsg("DonVitoCorleone", "Current i before is %i" % eventNumber))
eventNumber += 1
irc.queueMsg(ircmsgs.privmsg("DonVitoCorleone", "I after is %i" % eventNumber))
irc.queueMsg(ircmsgs.privmsg("DonVitoCorleone", "Hello World"))
else:
irc.queueMsg(ircmsgs.privmsg("DonVitoCorleone", schedule.schedule.events.keys()))
schedule.removeEvent(eventName)
irc.queueMsg(ircmsgs.privmsg("DonVitoCorleone", "Going to remove event %s" % eventName))"""
schedule.addPeriodicEvent(sayHello, 60, eventName, now=False)
def stopHello():
print "Going to stop %s" % eventName
try:
schedule.removeEvent(eventName)
print "Event %s stopped" % eventName
except Exception as e:
print e
schedule.addEvent(stopHello, time.time() + 100)
开发者ID:kg-bot,项目名称:SupyBot,代码行数:30,代码来源:plugin.py
示例6: _topic_callback
def _topic_callback(self):
sections = {
self.testing_rc_bugs.get_number_bugs: 'RC bug count',
self.stable_rc_bugs.get_number_bugs: 'Stable RC bug count',
self.new_queue.get_size: 'NEW queue',
RmQueue().get_size: 'RM queue',
}
with self.topic_lock:
values = {}
for callback, prefix in sections.iteritems():
values[callback] = callback()
for channel in self.irc.state.channels:
new_topic = topic = self.irc.state.getTopic(channel)
for callback, prefix in sections.iteritems():
if values[callback]:
new_topic = rewrite_topic(new_topic, prefix, values[callback])
if topic != new_topic:
log.info("Queueing change of topic in #%s to '%s'" % (channel, new_topic))
self.queued_topics[channel] = new_topic
event_name = '%s_topic' % channel
try:
schedule.removeEvent(event_name)
except KeyError:
pass
schedule.addEvent(lambda channel=channel: self._update_topic(channel),
time.time() + 60, event_name)
开发者ID:xtaran,项目名称:debian-devel-changes-bot,代码行数:31,代码来源:plugin.py
示例7: doPrivmsg
def doPrivmsg(self, irc, msg):
if irc.isChannel(msg.args[0]):
channel = plugins.getChannel(msg.args[0])
canSpeak = False
now = time.time()
throttle = self.registryValue('randomSpeaking.throttleTime',
channel)
prob = self.registryValue('randomSpeaking.probability', channel)
delay = self.registryValue('randomSpeaking.maxDelay', channel)
irc = callbacks.SimpleProxy(irc, msg)
if now > self.lastSpoke + throttle:
canSpeak = True
if canSpeak and random.random() < prob:
f = self._markov(channel, irc, prefixNick=False, to=channel,
Random=True)
schedule.addEvent(lambda: self.q.enqueue(f), now + delay)
self.lastSpoke = now + delay
words = self.tokenize(msg)
words.insert(0, '\n')
words.insert(0, '\n')
words.append('\n')
# This shouldn't happen often (CTCP messages being the possible exception)
if not words or len(words) == 3:
return
if self.registryValue('ignoreBotCommands', channel) and \
callbacks.addressed(irc.nick, msg):
return
def doPrivmsg(db):
for (first, second, follower) in utils.seq.window(words, 3):
db.addPair(channel, first, second, follower)
self.q.enqueue(doPrivmsg)
开发者ID:D0MF,项目名称:supybot-plugins,代码行数:31,代码来源:plugin.py
示例8: shoa
def shoa(self, irc, msg, args):
"""
Shoa ist anberaumt
"""
if(self._checkCPO(irc, msg)):
nicks = []
nick4 = []
def unlimit():
irc.queueMsg(ircmsgs.unlimit(msg.args[0], 0))
irc.queueMsg(ircmsgs.limit(msg.args[0], 1))
schedule.addEvent(unlimit, time.time() + 3*60)
for nick in irc.state.channels[msg.args[0]].users:
if nick not in irc.state.channels[msg.args[0]].ops:
nicks.append(nick)
i = 0
for nick in nicks:
i = i+1
nick4.append(nick)
if (len(nick4) >= 4):
irc.queueMsg(ircmsgs.kicks(msg.args[0], nicks, 'Reichskristallnacht'))
nick4 = []
elif ((len(nicks) - i) < 4):
irc.queueMsg(ircmsgs.kicks(msg.args[0], nicks, 'Reichskristallnacht'))
irc.noReply()
开发者ID:krautchan,项目名称:erica,代码行数:31,代码来源:plugin.py
示例9: k
def k(self, irc, msg, args, nicks):
"""[user] ... [user]
Kick mit Timeban
"""
if(self._checkCPO(irc, msg)):
hostmasks = []
for nick in nicks:
prefix = irc.state.nickToHostmask(nick)
user = ircutils.userFromHostmask(prefix)
host = ircutils.hostFromHostmask(prefix)
hostmask = '*!*@%s' % host
if(host.find('mibbit.com') != -1):
hostmask = '*!%[email protected]*.mibbit.com' % user
hostmasks.append(hostmask)
hostmask = '*!*@%s' % self._numToDottedQuad(user)
hostmasks.append(hostmask)
irc.queueMsg(ircmsgs.bans(msg.args[0], hostmasks))
irc.queueMsg(ircmsgs.kicks(msg.args[0], nicks, 'Your behavior is not conducive to the desired environment.'))
def unban():
irc.queueMsg(ircmsgs.unbans(msg.args[0], hostmasks))
schedule.addEvent(unban, time.time() + 900)
irc.noReply()
开发者ID:krautchan,项目名称:erica,代码行数:31,代码来源:plugin.py
示例10: __init__
def __init__(self, irc, victim, wires, detonateTime, goodWire, channel, sender, showArt, showCorrectWire, debug):
self.victim = victim
self.startTime = time.time();
self.detonateTime = detonateTime
self.wires = wires
self.goodWire = goodWire
self.active = True
self.channel = channel
self.sender = sender
self.irc = irc
self.showArt = showArt
self.showCorrectWire = showCorrectWire
self.debug = debug
self.thrown = False
self.responded = False
self.rng = random.Random()
self.rng.seed()
if self.debug:
self.irc.reply('I just created a bomb in %s' % channel)
def detonate():
self.detonate(irc)
schedule.addEvent(detonate, self.startTime + self.detonateTime, '%s_bomb' % self.channel)
formattedTime = "%02d:%02d:%02d" % (detonateTime / 3600, detonateTime / 60, detonateTime % 60)
s = 'stuffs a bomb down %s\'s pants. The display reads [%s]. The wires are: %s.' % (self.victim, formattedTime, utils.str.commaAndify(wires))
self.irc.queueMsg(ircmsgs.action(self.channel, s))
if self.victim == irc.nick:
time.sleep(1)
cutWire = self.rng.choice(self.wires)
self.irc.queueMsg(ircmsgs.privmsg(self.channel, '@cutwire %s' % cutWire))
time.sleep(1)
self.cutwire(self.irc, cutWire)
开发者ID:alxsoares,项目名称:supybot-plugins,代码行数:31,代码来源:plugin.py
示例11: _giveClue
def _giveClue(self, irc, channel, now=False):
state = self.states[channel]
(delay, clue, valid) = state.getClue()
def event():
try:
schedule.removeEvent("Eureka-nextClue-%s" % channel)
except KeyError:
pass
if clue is None:
assert valid is None
irc.reply(
_("Nobody replied with (one of this) " "answer(s): %s.")
% ", ".join([y for x, y in state.answers if x == "r"]),
prefixNick=False,
)
self._ask(irc, channel)
else:
irc.reply(_("Another clue: %s") % clue, prefixNick=False)
self._giveClue(irc, channel)
eventName = "Eureka-nextClue-%s" % channel
if now and eventName in schedule.schedule.events:
schedule.schedule.events[eventName]()
schedule.removeEvent(eventName)
schedule.addEvent(event, time.time() + delay, eventName)
开发者ID:Azelphur,项目名称:Supybot-plugins,代码行数:26,代码来源:plugin.py
示例12: perform_standup
def perform_standup(self):
"""Perform the daily standup"""
# based on what time it is, guess which standup we are having
# Which team is it?
irc = self.irc
now = datetime.datetime.now()
stand_up = None
for st in self.__standups:
# What time is it?
hour, min, sec = st["time"]
if hour == now.hour and min == now.minute:
stand_up = st
break
else: # did not find one
print "Did not find a matching standup"
return
irc.queueMsg(
ircmsgs.privmsg(
stand_up["channel"],
"%s - %s - Yesterday, Today, Blocked?" % (" ".join(stand_up["members"]), stand_up["name"]),
)
)
# schedule the next event
next_time = self._nextStandup(stand_up["name"])
schedule.addEvent(self.perform_standup, next_time, stand_up["name"])
print "[Perform Standup] Scheduling standup at %s for %s" % (str(next_time), stand_up["name"])
开发者ID:kwoodson,项目名称:bot-plugins,代码行数:26,代码来源:plugin.py
示例13: doPrivmsg
def doPrivmsg(self, irc, msg):
channel, text = msg.args
text = text.lower()
if '#' in channel:
#print self.regex
#irc.reply('testing %s against %s' % (text, self._regexString))
if self.regex.match(text):
try:
hostmask = irc.state.nickToHostmask(msg.nick)
except KeyError:
return
(nick, user, host) = ircutils.splitHostmask(hostmask)
user = self._fnUser.sub('*', user)
banmask = ircutils.joinHostmask('*', user, msg.host)
if ircutils.hostmaskPatternEqual(banmask, irc.prefix):
return
irc.queueMsg(ban(channel, banmask, 'For swearing. 5 minute timeout'))
irc.queueMsg(kick(channel, msg.nick, 'For swearing'))
def unBan():
if channel in irc.state.channels and \
banmask in irc.state.channels[channel].bans:
irc.queueMsg(unban(channel, banmask))
schedule.addEvent(unBan, time.time()+300)
elif 'fag' in text.split():
try:
hostmask = irc.state.nickToHostmask(msg.nick)
except KeyError:
return
(nick, user, host) = ircutils.splitHostmask(hostmask)
irc.reply('No thanks %s I don\'t smoke' % user)
return msg
开发者ID:chan-jesus,项目名称:no-cussing-supybot-plugin,代码行数:31,代码来源:plugin.py
示例14: version
def version(self, irc, msg, args, channel, optlist):
"""[<channel>] [--nicks]
Sends a CTCP VERSION to <channel>, returning the various
version strings returned. It waits for 10 seconds before returning
the versions received at that point. If --nicks is given, nicks are
associated with the version strings; otherwise, only the version
strings are given.
"""
self.versions = ircutils.IrcDict()
nicks = False
for (option, arg) in optlist:
if option == 'nicks':
nicks = True
irc.queueMsg(ircmsgs.privmsg(channel, '\x01VERSION\x01'))
def doReply():
if self.versions:
L = []
for (reply, nicks) in self.versions.iteritems():
if nicks:
L.append(format('%L responded with %q', nicks, reply))
else:
L.append(reply)
irc.reply(format('%L', L))
else:
irc.reply('I received no version responses.')
wait = self.registryValue('versionWait')
schedule.addEvent(doReply, time.time()+wait)
开发者ID:Athemis,项目名称:Limnoria,代码行数:28,代码来源:plugin.py
示例15: run_callback
def run_callback(callback, id_):
''' Run the callback 'now' on main thread. '''
try:
schedule.removeEvent(id_)
except KeyError:
pass
schedule.addEvent(callback, time.time(), id_)
开发者ID:gmorell,项目名称:supybot-git,代码行数:7,代码来源:plugin.py
示例16: doPrivmsg
def doPrivmsg(self, irc, msg):
channel = msg.args[0]
nick = msg.prefix.split('!')[0]
if channel not in self.states:
return
reply = None
state = self.states[channel]
for mode, answer in state.answers:
if mode == 'r':
if msg.args[1].lower() == answer.lower():
state.adjust(nick, state.question[0])
reply = _('Congratulations %s! The answer was %r.')
reply %= (nick, answer)
elif mode == 'm':
if answer.match(msg.args[1]):
state.adjust(nick, state.question[0])
reply = _('Congratulations %s! The answer was %r.')
reply %= (nick, msg.args[1])
if reply is not None:
schedule.removeEvent('Eureka-nextClue-%s' % channel)
otherAnswers = [y for x,y in state.answers
if x == 'r' and y.lower() != msg.args[1].lower()]
if len(otherAnswers) == 1:
reply += ' ' + _('Another valid answer is: \'%s\'.')
reply %= otherAnswers[0]
elif len(otherAnswers) >= 2:
reply += ' ' + _('Other valid answers are: \'%s\'.')
reply %= '\', \''.join([x for x in otherAnswers])
irc.reply(reply, prefixNick=False)
schedule.addEvent(self._ask, time.time() + 6, args=(irc, channel, True)) # Delay in seconds for next question after answered question (just change 6 to seconds you want to use).
开发者ID:kg-bot,项目名称:SupyBot,代码行数:30,代码来源:plugin.py
示例17: social
def social(self, irc, msg, args, channel, user, junk):
"""[#powder] <user>
Sets a redirection ban from #powder to #powder-social,
kicks the user (exploiting a users auto-rejoin
to force them to #powder-social) then lifts the ban.
Also sends the user a notice informing them of what happened."""
if channel not in '#powder':
channel = '#powder'
hostmask = irc.state.nickToHostmask(user)
irc.queueMsg(ircmsgs.IrcMsg(
'MODE #powder +b {0}$#powder-social'.format(hostmask)))
irc.queueMsg(ircmsgs.IrcMsg(
'KICK #powder {0} :Take it to #powder-social'.format(user)))
irc.queueMsg(ircmsgs.invite(user, '#powder-social'))
irc.queueMsg(ircmsgs.IrcMsg((
'NOTICE {0} :{1} has requested you take your current conversation',
'to #powder-social.').format(
user, msg.nick)))
expires = time.time() + 300
def f():
irc.queueMsg(ircmsgs.IrcMsg(
'MODE #powder -b {0}$#powder-social'.format(hostmask)))
schedule.addEvent(f, expires)
开发者ID:Brilliant-Minds,项目名称:Limnoria-Plugins,代码行数:27,代码来源:plugin.py
示例18: quiet
def quiet(self, irc, msg, args, channel, nick, expiry):
"""[<channel>] <nick> [<expiry>]
Quietens <nick> from <channel> for <expiry>. If <expiry> isn't given,
the duration is permanent.
<channel> is only necessary if the message isn't sent in the channel
itself.
"""
if irc.isNick(nick):
bannedNick = nick
try:
bannedHostmask = irc.state.nickToHostmask(nick)
except KeyError:
irc.error(format(_('I haven\'t seen %s.'), bannedNick), Raise=True)
else:
bannedNick = ircutils.nickFromHostmask(nick)
bannedHostmask = nick
if not irc.isNick(bannedNick):
self.log.warning('%q tried to quiet a non nick: %q',
msg.prefix, bannedNick)
raise callbacks.ArgumentError
banmaskstyle = conf.supybot.protocols.irc.banmask
banmask = banmaskstyle.makeBanmask(bannedHostmask)
if ircutils.strEqual(nick, irc.nick):
irc.error('I cowardly refuse to quiet myself.', Raise=True)
thismsg=self.registryValue('message')
self._sendMsg(irc, ircmsgs.mode(channel, ("+q", banmask)))
if self.registryValue('SendMsgPvt'):
self._sendMsg(irc, ircmsgs.privmsg(nick,nick+", "+thismsg ))
else:
self._sendMsg(irc, ircmsgs.privmsg(channel,nick+", "+thismsg ))
def f():
irc.queueMsg(ircmsgs.mode(channel, ("-q", banmask)))
if expiry:
schedule.addEvent(f, expiry)
开发者ID:GlitterCakes,项目名称:PoohBot,代码行数:35,代码来源:plugin.py
示例19: saveLast
def saveLast(self,irc,msg,match):
r".+"
channel = msg.args[0]
try: self.buffer[channel]
except: self.buffer[channel]=[]
# Stuff for multikick
if channel in self.kickuser:
for each in self.kickuser[channel]:
if each in msg.nick.lower() and not self.kickuser[channel][each]['num'] <= 0:
irc.queueMsg(ircmsgs.ban(msg.args[0], msg.nick))
irc.queueMsg(ircmsgs.kick(msg.args[0], msg.nick, "{}".format(self.kickuser[channel][each]['msg'].replace('#n',str(self.kickuser[channel][each]['num'])))))
self.kickuser[channel][each]['num']-=1
def un():
irc.queueMsg(ircmsgs.unban(msg.args[0],msg.nick))
schedule.addEvent(un,time.time()+random.randint(10,60)) # 30,120
# END
line = match.group(0).replace('\x01ACTION','*').strip('\x01')
if msg.nick.lower() in self.annoyUser:
def fu():
irc.queueMsg(ircmsgs.IrcMsg('NOTICE {} :\x02\x03{},{}{}'.format(msg.nick,random.randint(0,15),random.randint(0,15),line)))
schedule.addEvent(fu,time.time()+random.randint(2,60))
if re.match(r"^u[/].*[/].*[/].*$", match.group(0)) or re.match(r"^s[/].*[/].*$", match.group(0)):
return 1
self.buffer[channel].insert(0,[msg.nick,line])
if len(self.buffer[channel]) > self.buffsize: self.buffer[channel].pop(self.buffsize)
return 1
开发者ID:jacksonmj,项目名称:StewieGriffin,代码行数:30,代码来源:plugin.py
示例20: __init__
def __init__(self, irc, victim, wires, detonateTime, goodWire, channel, sender, showArt, showCorrectWire, debug):
self.victim = victim
self.detonateTime = detonateTime
self.wires = wires
self.goodWire = goodWire
self.active = True
self.channel = channel
self.sender = sender
self.irc = irc
self.showArt = showArt
self.showCorrectWire = showCorrectWire
self.debug = debug
self.thrown = False
self.responded = False
self.rng = random.Random()
self.rng.seed()
if self.debug:
self.irc.reply('I just created a bomb in %s' % channel)
def detonate():
self.detonate(irc)
schedule.addEvent(detonate, time.time() + self.detonateTime, '%s_bomb' % self.channel)
s = 'stuffs a bomb down %s\'s pants. The timer is set for %s seconds! There are %s wires. Use !cut <wire> to defuse the bomb. The wires are: %s.' % (self.victim, self.detonateTime, len(wires), utils.str.commaAndify(wires))
self.irc.queueMsg(ircmsgs.action(self.channel, s))
if self.victim == irc.nick:
time.sleep(1)
cutWire = self.rng.choice(self.wires)
self.irc.queueMsg(ircmsgs.privmsg(self.channel, '@cutwire %s' % cutWire))
time.sleep(1)
self.cutwire(self.irc, cutWire)
开发者ID:lostlabyrinth,项目名称:Supybot-Plugins,代码行数:29,代码来源:plugin.py
注:本文中的supybot.schedule.addEvent函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论