本文整理汇总了Python中supybot.ircutils.nickEqual函数的典型用法代码示例。如果您正苦于以下问题:Python nickEqual函数的具体用法?Python nickEqual怎么用?Python nickEqual使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nickEqual函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: getTopUsers
def getTopUsers(self, channel, word, n):
L = [(id, d[word]) for ((chan, id), d) in self.iteritems()
if ircutils.nickEqual(channel, chan) and word in d]
utils.sortBy(lambda (_, i): i, L)
L = L[-n:]
L.reverse()
return L
开发者ID:D0MF,项目名称:supybot-plugins-1,代码行数:7,代码来源:plugin.py
示例2: delWord
def delWord(self, channel, word):
if word in self.channelWords[channel]:
del self.channelWords[channel][word]
for ((chan, id), d) in self.iteritems():
if ircutils.nickEqual(chan, channel):
if word in d:
del d[word]
开发者ID:D0MF,项目名称:supybot-plugins-1,代码行数:7,代码来源:plugin.py
示例3: combine
def combine(msgs, reverse=True, stamps=False, nicks=True, compact=True,
joiner=r' \ ', nocolor=False):
"""
Formats and returns a list of IrcMsg objects (<msgs>) as a string.
<reverse>, if True, prints messages from last to first.
<stamps>, if True, appends timestamps to messages.
<reverse>, if True, orders messages by earliest to most recent.
<compact>, if False, append nicks to consecutive messages
<joiner>, the character joining lines together (default: ' \ ').
<nocolor>, if True, strips color from messages.
Sample output:
<bigman> DUNK \ <bigbitch> \ bluh \ bluh
"""
output = []
lastnick = ''
for msg in reversed(msgs) if reverse else msgs:
isaction = ircmsgs.isAction(msg)
if isaction:
text = '[%s %s]' % (msg.nick, ircmsgs.unAction(msg))
else:
if compact and ircutils.nickEqual(msg.nick, lastnick) or not nicks:
text = msg.args[1]
else:
lastnick = msg.nick
text = '<%s> %s' % (msg.nick, msg.args[1])
if stamps:
stampfmt = '%d-%m-%y %H:%M:%S'
stamp = time.strftime(stampfmt, time.localtime(msg.receivedAt))
text = '[{0}] {1}'.format(stamp, text)
output.append(ircutils.stripFormatting(text))
return joiner.join(output)
开发者ID:Wintervenom,项目名称:Xn,代码行数:31,代码来源:wvmsupybot.py
示例4: tell
def tell(self, irc, msg, args, target, text):
"""<nick> <text>
Tells the <nick> whatever <text> is. Use nested commands to your
benefit here.
"""
if target.lower() == 'me':
target = msg.nick
if ircutils.isChannel(target):
irc.error('Dude, just give the command. No need for the tell.')
return
if not ircutils.isNick(target):
irc.errorInvalid('nick', target)
if ircutils.nickEqual(target, irc.nick):
irc.error('You just told me, why should I tell myself?',Raise=True)
if target not in irc.state.nicksToHostmasks and \
not ircdb.checkCapability(msg.prefix, 'owner'):
# We'll let owners do this.
s = 'I haven\'t seen %s, I\'ll let you do the telling.' % target
irc.error(s, Raise=True)
if irc.action:
irc.action = False
text = '* %s %s' % (irc.nick, text)
s = '%s wants me to tell you: %s' % (msg.nick, text)
irc.reply(s, to=target, private=True)
开发者ID:MrTiggr,项目名称:supybot_fixes,代码行数:25,代码来源:plugin.py
示例5: cutwire
def cutwire(self, irc, msg, args, channel, cutWire):
"""<colored wire>
Will cut the given wire if you've been timebombed."""
channel = ircutils.toLower(channel)
try:
if not self.bombs[channel].active:
return
if not ircutils.nickEqual(self.bombs[channel].victim, msg.nick):
irc.reply('You can\'t cut the wire on someone else\'s bomb!')
return
else:
self.responded = True
spellCheck = False
for item in self.bombs[channel].wires :
if item.lower() == cutWire.lower():
spellCheck = True
if spellCheck == False :
irc.reply("That doesn't appear to be one of the options.")
return
self.bombs[channel].cutwire(irc, cutWire)
except KeyError:
pass
irc.noReply()
开发者ID:alxsoares,项目名称:supybot-plugins,代码行数:26,代码来源:plugin.py
示例6: tell
def tell(self, irc, msg, args, target, text):
"""<nick> <text>
Tells the <nick> whatever <text> is. Use nested commands to your
benefit here.
"""
if irc.nested:
irc.error("This command cannot be nested.", Raise=True)
if target.lower() == "me":
target = msg.nick
if ircutils.isChannel(target):
irc.error("Dude, just give the command. No need for the tell.")
return
if not ircutils.isNick(target):
irc.errorInvalid("nick", target)
if ircutils.nickEqual(target, irc.nick):
irc.error("You just told me, why should I tell myself?", Raise=True)
if target not in irc.state.nicksToHostmasks and not ircdb.checkCapability(msg.prefix, "owner"):
# We'll let owners do this.
s = "I haven't seen %s, I'll let you do the telling." % target
irc.error(s, Raise=True)
if irc.action:
irc.action = False
text = "* %s %s" % (irc.nick, text)
s = "%s wants me to tell you: %s" % (msg.nick, text)
irc.replySuccess()
irc.reply(s, to=target, private=True)
开发者ID:krattai,项目名称:AEBL,代码行数:27,代码来源:plugin.py
示例7: defuse
def defuse(self, irc, msg, args, channel):
"""Takes no arguments
Defuses the active bomb (channel ops only)"""
channel = ircutils.toLower(channel)
try:
if self.bombs[channel].active:
if ircutils.nickEqual(self.bombs[channel].victim, msg.nick) and not (ircutils.nickEqual(self.bombs[channel].victim, self.bombs[channel].sender) or ircdb.checkCapability(msg.prefix, 'admin')):
irc.reply('You can\'t defuse a bomb that\'s in your own pants, you\'ll just have to cut a wire and hope for the best.')
return
self.bombs[channel].defuse()
irc.reply('Bomb defused')
else:
irc.error('There is no active bomb')
except KeyError:
pass
irc.error('There is no active bomb')
开发者ID:jacksonmj,项目名称:StewieGriffin,代码行数:17,代码来源:plugin.py
示例8: addWord
def addWord(self, channel, word):
if channel not in self.channelWords:
self.channelWords[channel] = {}
self.channelWords[channel][word] = 0
for ((chan, id), d) in self.iteritems():
if ircutils.nickEqual(chan, channel):
if word not in d:
d[word] = 0
开发者ID:D0MF,项目名称:supybot-plugins-1,代码行数:8,代码来源:plugin.py
示例9: doForce
def doForce(self, irc, msg, match):
r'^no,\s+(\w+,\s+)?(.+?)\s+(?<!\\)(was|is|am|were|are)\s+(.+?[?!. ]*)$'
(nick, key, isAre, value) = match.groups()
value = value.rstrip()
key.rstrip('?')
if not msg.addressed:
if nick is None:
self.log.debug('Not forcing because we weren\'t addressed and '
'payload wasn\'t of the form: no, irc.nick, ..')
return
nick = nick.rstrip(' \t,')
if not ircutils.nickEqual(nick, irc.nick):
self.log.debug('Not forcing because the regexp nick didn\'t '
'match our nick.')
return
else:
if nick is not None:
stripped = nick.rstrip(' \t,')
if not ircutils.nickEqual(stripped, irc.nick):
key = nick + key
isAre = isAre.lower()
if self.added:
return
channel = dynamic.channel
if isAre in ('was', 'is', 'am'):
if self.db.hasIs(channel, key):
oldValue = self.db.getIs(channel, key)
if oldValue.lower() == value.lower():
self.reply(format('I already had it that way, %s.',
msg.nick))
return
self.log.debug('Forcing %q to %q.', key, value)
self.added = True
self.db.setIs(channel, key, value)
else:
if self.db.hasAre(channel, key):
oldValue = self.db.getAre(channel, key)
if oldValue.lower() == value.lower():
self.reply(format('I already had it that way, %s.',
msg.nick))
return
self.log.debug('Forcing %q to %q.', key, value)
self.added = True
self.db.setAre(channel, key, value)
self.confirm()
开发者ID:eif0,项目名称:d0b,代码行数:45,代码来源:plugin.py
示例10: duck
def duck(self, irc, ducker):
if self.thrown and ircutils.nickEqual(self.victim, ducker):
self.irc.queueMsg(
ircmsgs.privmsg(
self.channel,
"{} ducks! The bomb misses, and explodes harmlessly a few meters away.".format(self.victim),
)
)
self.defuse()
开发者ID:Brilliant-Minds,项目名称:Limnoria-Plugins,代码行数:9,代码来源:plugin.py
示例11: duck
def duck(self, irc, ducker):
if self.thrown and ircutils.nickEqual(self.victim, ducker):
self.irc.queueMsg(
ircmsgs.privmsg(
self.channel,
"%s ducks! The bomb misses, and explodes harmlessly a few meters away." % self.victim,
)
)
self.active = False
self.thrown = False
schedule.removeEvent("%s_bomb" % self.channel)
开发者ID:EnderBlue,项目名称:supybot,代码行数:11,代码来源:plugin.py
示例12: grab
def grab(self, irc, msg, args, channel, nick):
"""[<channel>] <nick>
Grabs a quote from <channel> by <nick> for the quotegrabs table.
<channel> is only necessary if the message isn't sent in the channel
itself.
"""
# chan is used to make sure we know where to grab the quote from, as
# opposed to channel which is used to determine which db to store the
# quote in
chan = msg.args[0]
if chan is None:
raise callbacks.ArgumentError
if ircutils.nickEqual(nick, msg.nick):
irc.error(_("You can't quote grab yourself."), Raise=True)
for m in reversed(irc.state.history):
if m.command == "PRIVMSG" and ircutils.nickEqual(m.nick, nick) and ircutils.strEqual(m.args[0], chan):
self._grab(channel, irc, m, msg.prefix)
irc.replySuccess()
return
irc.error(_("I couldn't find a proper message to grab."))
开发者ID:ki113d,项目名称:Limnoria,代码行数:21,代码来源:plugin.py
示例13: cutwire
def cutwire(self, irc, msg, args, channel, cutWire):
"""<colored wire>
Will cut the given wire if you've been timebombed."""
channel = ircutils.toLower(channel)
try:
if not self.bombs[channel].active:
return
if not ircutils.nickEqual(self.bombs[channel].victim, msg.nick) and not ircdb.checkCapability(msg.prefix, 'admin'):
irc.reply('You can\'t cut the wire on someone else\'s bomb!')
return
self.bombs[channel].cutwire(irc, cutWire)
except KeyError:
pass
irc.noReply()
开发者ID:jacksonmj,项目名称:StewieGriffin,代码行数:15,代码来源:plugin.py
示例14: cutwire
def cutwire(self, irc, msg, args, channel, cutWire):
"""<colored wire>
Will cut the given wire if you've been timebombed."""
channel = ircutils.toLower(channel)
try:
if not self.bombs[channel].active:
return
if not ircutils.nickEqual(self.bombs[channel].victim, msg.nick):
irc.reply("You can't cut the wire on someone else's bomb!")
return
self.bombs[channel].cutwire(irc, cutWire)
except KeyError:
pass
irc.noReply()
开发者ID:EnderBlue,项目名称:supybot,代码行数:15,代码来源:plugin.py
示例15: ungrab
def ungrab(self, irc, msg, args, channel, grab):
"""[<channel>] <number>
Removes the grab <number> (the last by default) on <channel>.
<channel> is only necessary if the message isn't sent in the channel
itself. You may only ungrab quotes you made or grabbed.
"""
try:
original = self.db.get(channel, grab)
if ircutils.nickEqual(ircutils.nickFromHostmask(original.grabber), msg.nick) or ircutils.nickEqual(original.by, msg.nick):
self.db.remove(channel, grab)
irc.replySuccess()
else:
irc.error('Can only ungrab quotes made or grabbed by you.')
except dbi.NoRecordError:
if grab is None:
irc.error('Nothing to ungrab.')
else:
irc.error('Invalid grab number.')
开发者ID:Chalks,项目名称:Supybot,代码行数:19,代码来源:plugin.py
示例16: doPrivmsg
def doPrivmsg(self, irc, msg):
if not (self.source and irc.network == self.network and \
ircutils.nickEqual(msg.nick, self.target)):
return
elif time.time() - self.lastreply > self.timeout:
self._result('Gave up waiting for a response.')
return
text = msg.args[1]
count = re.sub(r'.*\((\d+) more messages?\)\W?$', r'\1', text)
if count.isdigit():
self.replies.append(re.sub(r'%s$' % pagetext, '', text))
if self.page < self.pagelimit:
self.page += 1
self._proxy('more')
return
else:
text = ' [Truncated]'
text = ''.join(self.replies) + text
self._result(text)
self.replies = []
self.page = 0
开发者ID:Wintervenom,项目名称:Xn,代码行数:21,代码来源:plugin.py
示例17: grab
def grab(self, irc, msg, args, channel, expr):
"""[<channel>] [<nick|expr>:] <expr>
Grabs the last message in the channel backlog that matches the
expression in <expr>, optionally from <nick>, which is also part
of <expr>, and can, therefore, use expression syntax.
See $exprhelp for expression syntax and $delims for valid
delimiter characters.
"""
chan = msg.args[0]
if chan is None:
raise callbacks.ArgumentError
gmsg = wvm.find(irc, chan, expr, limit=1)
if len(gmsg) == 0:
irc.error("Couldn't find a matching line to grab.")
return
gmsg = gmsg[0]
if ircutils.nickEqual(msg.nick, gmsg.nick):
irc.error("You can't grab yourself, Michael Jackson.",
Raise=True)
self._grab(channel, irc, gmsg, msg.prefix)
text = wvm.formatmsg(gmsg)
irc.reply('Grabbed: %s' % text)
开发者ID:Wintervenom,项目名称:Xn,代码行数:23,代码来源:plugin.py
示例18: goodwire
def goodwire(self, irc, msg, args ):
channel = msg.args[0]
if not self.registryValue('allowBombs', msg.args[0]):
irc.noReply()
return
try:
if not ircutils.nickEqual(self.bombs[channel].victim, msg.nick):
irc.reply("You can't see the wires from there.")
return
else:
self.responded = True
if self.bombs[channel].active:
randNum = self.rng.randint(0,6)
if randNum == 0 :
s = "uhhhhh uhhhh I think it's the %s wire!" % ( self.bombs[channel].goodWire)
else:
s = "they're all %s wires!" % self.rng.choice(self.bombs[channel].wires)
irc.reply( s.upper())
return
else:
irc.reply("No active time bomb at the moment.")
except KeyError:
pass
开发者ID:alxsoares,项目名称:supybot-plugins,代码行数:24,代码来源:plugin.py
示例19: rmvar
def rmvar(self, irc, msg, args, name, keys):
"""<var> [<key> ...]
Deletes the variable <var> or one or more matching <key>s in <var>.
"""
try:
if name.startswith("_"):
name = "%s-%s" % (name, msg.nick)
name = name.lower()
owner = self.variables[name][2]
if not ircutils.nickEqual(owner, msg.nick):
irc.error("Variable <%s> locked by %s." % (name, owner))
return
if not keys:
del (self.variables[name])
else:
for key in keys:
try:
del (self.variables[name][0][key])
except:
pass
irc.reply("")
except KeyError:
irc.error("Variable <%s> is undefined." % name)
开发者ID:Wintervenom,项目名称:Xn,代码行数:24,代码来源:plugin.py
示例20: _tell
def _tell(self, irc, msg, args, target, text, notice):
if irc.nested:
irc.error('This command cannot be nested.', Raise=True)
if target.lower() == 'me':
target = msg.nick
if ircutils.isChannel(target):
irc.error(_('Hey, just give the command. No need for the tell.'))
return
if not ircutils.isNick(target):
irc.errorInvalid('nick', target)
if ircutils.nickEqual(target, irc.nick):
irc.error(_('You just told me, why should I tell myself?'),
Raise=True)
if target not in irc.state.nicksToHostmasks and \
not ircdb.checkCapability(msg.prefix, 'owner'):
# We'll let owners do this.
s = _('I haven\'t seen %s, I\'ll let you do the telling.') % target
irc.error(s, Raise=True)
if irc.action:
irc.action = False
text = '* %s %s' % (irc.nick, text)
s = _('%s wants me to tell you: %s') % (msg.nick, text)
irc.replySuccess()
irc.reply(s, to=target, private=True, notice=notice)
开发者ID:Poorchop,项目名称:Limnoria,代码行数:24,代码来源:plugin.py
注:本文中的supybot.ircutils.nickEqual函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论