本文整理汇总了Python中supybot.ircmsgs.notice函数的典型用法代码示例。如果您正苦于以下问题:Python notice函数的具体用法?Python notice怎么用?Python notice使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了notice函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: doJoin
def doJoin(self, irc, msg):
channel = msg.args[0]
if self.registryValue('enabled', channel):
if not ircutils.strEqual(irc.nick, msg.nick):
irc = callbacks.SimpleProxy(irc, msg)
now = time.time()
throttle = self.registryValue('throttle', channel)
if now - self.lastBacklog.get((channel, msg.nick), now-1-throttle) < throttle:
return
else:
self.lastBacklog[channel, msg.nick] = now
try:
lines = int(self.db["1337allthechannels1337", msg.nick])
except:
lines = int(self.registryValue('lines'))
if lines != 0:
irc.queueMsg(ircmsgs.notice(msg.nick, "Hello "+msg.nick+". I will now show you up to "+str(lines)+" messages from "+channel+", before you joined. To change this behavior, write me: @setbackloglines [0-25]. Setting it to zero disables this feature. Time is GMT."))
logg = self.logck.get(channel, lines)
for i in range(0, lines):
if len(logg) <= 0:
break;
else:
irc.queueMsg(ircmsgs.notice(msg.nick,str((logg[:1]).pop())))
logg = logg[1:]
self.doLog(irc, channel, '*** %s <%s> has joined %s', msg.nick, msg.prefix, channel)
开发者ID:C0MPAQ,项目名称:Supybot-Backlog,代码行数:30,代码来源:plugin.py
示例2: wtp
def wtp(self, irc, msg, args):
"""Best place."""
coms = ['EN', 'BR', 'FR', 'TR', 'RU', 'ES', 'CN', 'VK', 'NL', 'PL', 'HU', 'RO', 'ID', 'DE']
room = random.randint(1,10)
mice = random.randint(1,35)
com = random.choice(coms)
if mice == 1:
irc.sendMsg(ircmsgs.notice(msg.nick, "Based on the gathered server, room, and player statistics, you're best off playing in room %s on %s, despite the presence of 1 mice." % (room, com)))
else:
irc.sendMsg(ircmsgs.notice(msg.nick, "Based on the gathered server, room, and player statistics, you're best off playing in room %s on %s, despite the presence of %s mice." % (room, com, mice)))
开发者ID:JordyNL,项目名称:supybot_plugins,代码行数:10,代码来源:plugin.py
示例3: testReply
def testReply(self):
prefix = "[email protected]"
channelMsg = ircmsgs.privmsg("#foo", "bar baz", prefix=prefix)
nonChannelMsg = ircmsgs.privmsg("supybot", "bar baz", prefix=prefix)
self.assertEqual(ircmsgs.notice(nonChannelMsg.nick, "foo"), callbacks.reply(channelMsg, "foo", private=True))
self.assertEqual(ircmsgs.notice(nonChannelMsg.nick, "foo"), callbacks.reply(nonChannelMsg, "foo"))
self.assertEqual(
ircmsgs.privmsg(channelMsg.args[0], "%s: foo" % channelMsg.nick), callbacks.reply(channelMsg, "foo")
)
self.assertEqual(
ircmsgs.privmsg(channelMsg.args[0], "foo"), callbacks.reply(channelMsg, "foo", prefixNick=False)
)
self.assertEqual(
ircmsgs.notice(nonChannelMsg.nick, "foo"), callbacks.reply(channelMsg, "foo", notice=True, private=True)
)
开发者ID:carriercomm,项目名称:Limnoria,代码行数:15,代码来源:test_callbacks.py
示例4: onlinehelpers
def onlinehelpers(self, irc, msg, args, type):
"""Returns online helpers list."""
try:
req = urllib2.Request('http://www.aha2y.nl/API/transformice/online_helpers.php')
response = urllib2.urlopen(req)
modlist = response.read()
if type:
if type == "--verbose":
irc.reply(modlist, prefixNick=False)
else:
irc.sendMsg(ircmsgs.notice(msg.nick, "Incorrect usage."))
else:
irc.sendMsg(ircmsgs.notice(msg.nick, modlist))
except urllib2.HTTPError, err:
irc.sendMsg(ircmsgs.notice(msg.nick, "Error: the API seems to be down. Please try again later."))
开发者ID:JordyNL,项目名称:supybot_plugins,代码行数:15,代码来源:plugin.py
示例5: botlist
def botlist(self, irc, msg, args):
"""takes no arguments
Sends notice to you with list of our bot"""
global channel
channel = msg.args[0]
global nick
nick = msg.nick
if channel == '#bots':
with open('Bots/%s.json' % 'botlist', 'r') as bots:
b = json.loads(bots.read())
bot_names = ', '.join(v for v in b)
irc.queueMsg(ircmsgs.notice(nick, bot_names))
else:
irc.queueMsg(ircmsgs.notice(nick, "This command is available only on #bots channel"))
开发者ID:kg-bot,项目名称:SupyBot,代码行数:15,代码来源:plugin.py
示例6: doPrivmsg
def doPrivmsg(self, irc, msg):
if irc.isChannel(msg.args[0]):
(tgt, payload) = msg.args
if tgt in self.channels:
for line in self._processLine(self.channels[tgt], payload):
irc.queueMsg(ircmsgs.notice(tgt, line.encode('utf-8')))
irc.noReply()
开发者ID:abeluck,项目名称:sousveillance,代码行数:7,代码来源:plugin.py
示例7: doPrivmsg
def doPrivmsg(self, irc, msg):
nick = msg.nick
channel = msg.args[0]
message = msg.args[1]
if channel == '#e-sim.secura.support':
nicks = ', '.join(irc.state.channels['#e-sim.secura.support'].users)
if nick in nicks:
if message == '!rules':
irc.reply('You can use following arguments: \x034acc, bots, bugs, exploiting, password, trading, hts, pi, tat, eps, sp, f, responsibility, spam\x03 = For example: \x034+rules acc\x03')
if message == '!commands':
irc.reply('>>> \x02Commands\x02: = \x02!rules\x02 & \x02!ts\x02 & \x02!ts help\x02 & \x02!wiki\x02 & \x02!ip form\x02 & \x02!forum\x02 & \x02!esim laws\x02')
if message == '!ts':
irc.reply('http://tickets.e-sim.org/')
if message == '!ts help':
irc.reply('http://secura.e-sim.org/article.html?id=16595')
if message == '!wiki':
irc.reply('http://wiki.e-sim.org/index.php/Category:Tutorials')
if message == '!ip form':
irc.reply('http://tinyurl.com/d9e23a')
if message == '!forum':
irc.reply('http://forum.e-sim.org/')
if message == '!esim laws':
irc.reply('http://secura.e-sim.org/laws.html')
if channel != '#e-sim.secura.support':
irc.queueMsg(ircmsgs.notice(nick, "This command is available only on one channel, this channel is set to +s (secret) and I'm not going to tell you channel name, sorry."))
开发者ID:kg-bot,项目名称:SupyBot,代码行数:25,代码来源:plugin.py
示例8: _msgmaker
def _msgmaker(self, target, s):
msg = dynamic.msg
channel = dynamic.channel
if self.registryValue("noticeNonPrivmsgs", dynamic.channel) and msg.command != "PRIVMSG":
return ircmsgs.notice(target, s)
else:
return ircmsgs.privmsg(target, s)
开发者ID:technogeeky,项目名称:Supybot,代码行数:7,代码来源:plugin.py
示例9: testReplyTo
def testReplyTo(self):
prefix = '[email protected]'
msg = ircmsgs.privmsg('#foo', 'bar baz', prefix=prefix)
self.assertEqual(callbacks.reply(msg, 'blah', to='blah'),
ircmsgs.privmsg('#foo', 'blah: blah'))
self.assertEqual(callbacks.reply(msg, 'blah', to='blah', private=True),
ircmsgs.notice('blah', 'blah'))
开发者ID:AssetsIncorporated,项目名称:Limnoria,代码行数:7,代码来源:test_callbacks.py
示例10: doPrivmsg
def doPrivmsg(self, irc, msg):
if irc.isChannel(msg.args[0]):
(tgt, payload) = msg.args
for p in self.providers:
for line in self.providers[p].doPrivmsg(tgt, payload):
irc.queueMsg(ircmsgs.notice(tgt, line.encode('utf-8')))
irc.noReply()
开发者ID:intrigeri,项目名称:ticketbot,代码行数:7,代码来源:plugin.py
示例11: receivedCommand
def receivedCommand(self, data):
"""Received a command over the UDP wire."""
error = None
commanditems = data.split()
if len(commanditems) > 2:
network = commanditems.pop(0)
channel = commanditems.pop(0)
text = ' '.join(commanditems)
netfound = False
for irc in world.ircs:
if irc.network == network:
netfound = True
chanfound = False
for onchannel in irc.state.channels:
if channel == onchannel[1:]:
chanfound = True
m = ircmsgs.notice(onchannel, text)
irc.sendMsg(m)
if not chanfound:
error = 'Bad Channel "%s"' % channel
if not netfound:
error = 'Bad Network "%s"' % network
if error:
self.log.info('Attempted external notice: %s', error)
else:
self.log.info('Successful external notice')
开发者ID:D0MF,项目名称:supybot-plugins-1,代码行数:26,代码来源:plugin.py
示例12: onlinemods
def onlinemods(self, irc, msg, args):
"""Returns online moderator list."""
try:
web = urllib.urlopen("http://cheese.formice.com/online-mods")
s = web.read()
except urllib2.HTTPError, err:
irc.sendMsg(ircmsgs.notice(msg.nick, "Error: the API seems to be down. Please try again later."))
开发者ID:JordyNL,项目名称:supybot_plugins,代码行数:7,代码来源:plugin.py
示例13: rpm
def rpm(self, irc, msg, args, remoteuser, otherIrc, text):
"""<remoteUser> <network> <text>
Sends a private message to a user on a remote network."""
found = found2 = False
if not self.registryValue("remotepm.enable"):
irc.error("This command is not enabled; please set 'config plugins.relaylink.remotepm.enable' "
"to True.", Raise=True)
for relay in self.relays:
channels = otherIrc.state.channels
for key, channel_ in channels.items():
if ircutils.toLower(relay.targetChannel) \
== ircutils.toLower(key) and remoteuser in channel_.users:
found = True
break
for ch in irc.state.channels:
if ircutils.toLower(relay.sourceChannel) == \
ircutils.toLower(ch) and msg.nick in irc.state.channels[ch].users:
found2 = True
break
if found and found2:
prefix = msg.prefix if self.registryValue("remotepm.useHostmasks") else msg.nick
if self.registryValue("remotepm.useNotice"):
otherIrc.queueMsg(ircmsgs.notice(remoteuser, "Message from %s on %s: %s" % (prefix, irc.network, text)))
else:
otherIrc.queueMsg(ircmsgs.privmsg(remoteuser, "Message from %s on %s: %s" % (prefix, irc.network, text)))
else:
irc.error("User '%s' does not exist on %s or you are not sharing "
"a channel with them." % (remoteuser, otherIrc.network), Raise=True)
开发者ID:lilsnooker,项目名称:SupyPlugins,代码行数:29,代码来源:plugin.py
示例14: send
def send(s):
if not relay.hasTargetIRC:
self.log.info('LinkRelay: IRC %s not yet scraped.' %
relay.targetNetwork)
elif relay.targetIRC.zombie:
self.log.info('LinkRelay: IRC %s appears to be a zombie'%
relay.targetNetwork)
elif relay.targetChannel not in relay.targetIRC.state.channels:
self.log.info('LinkRelay: I\'m not in in %s on %s' %
(relay.targetChannel, relay.targetNetwork))
else:
if 'network' not in args:
if self.registryValue('includeNetwork', relay.targetChannel):
args['network'] = '@' + irc.network
else:
args['network'] = ''
s %= args
if isPrivmsg or \
self.registryValue('nonPrivmsgs', channel) == 'privmsg':
msg = ircmsgs.privmsg(relay.targetChannel, s)
elif self.registryValue('nonPrivmsgs', channel) == 'notice':
msg = ircmsgs.notice(relay.targetChannel, s)
else:
return
msg.tag('relayedMsg')
relay.targetIRC.sendMsg(msg)
开发者ID:arvindkhadri,项目名称:Supybot-plugins,代码行数:26,代码来源:plugin.py
示例15: versioncheck
def versioncheck(self, irc, msg, args=None, nick=None):
"""[<nick>]
Checks the cjdns version of <nick>, or your nick if no args are given."""
host = None
if nick is not None and args is not None:
if nick in irc.state.nicksToHostmasks:
hostmask = irc.state.nicksToHostmasks[nick]
host = hostmask.split("@")[-1]
else:
irc.error("Can't find user %s" % nick)
else:
host = msg.host
if host is not None:
if nick is None:
nick = msg.nick
cjdns = cjdnsadmin.connectWithAdminInfo()
ping = cjdns.RouterModule_pingNode(host)
if "version" in ping:
version = ping['version']
if not version in self.versions:
github = requests.get("https://api.github.com/repos/cjdelisle/cjdns/commits/%s" % version).json()
self.versions[version] = datetime.strptime(github['commit']['author']['date'], "%Y-%m-%dT%H:%M:%SZ")
if self.versions[version] > self.latest['time']:
github = requests.get("https://api.github.com/repos/cjdelisle/cjdns/commits").json()
self.latest = {
"time": datetime.strptime(github[0]['commit']['author']['date'], "%Y-%m-%dT%H:%M:%SZ"),
"sha": github[0]['sha']
}
for version in github:
self.versions[version['sha']] = datetime.strptime(version['commit']['author']['date'])
committime = self.versions[version]
hostmask = "%s!%[email protected]%s" % (msg.nick, msg.user, msg.host)
if version != self.latest['sha']:
if datetime.now() - committime > timedelta(weeks=4):
sendNotice = True
if hostmask not in self.recentnotices:
self.recentnotices[hostmask] = datetime.now()
else:
if datetime.now() - self.recentnotices[hostmask] < timedelta(hours=6):
sendNotice = False
if sendNotice:
self.log.info("%s is running a commit from %s" % (msg.nick, pretty.date(committime)))
irc.queueMsg(ircmsgs.privmsg("#hyperboria", "%s is running an old version of cjdns! Using a commit from %s, by the looks of it. You really ought to update." % (msg.nick, pretty.date(committime))))
elif datetime.now() - committime > timedelta(weeks=2):
sendNotice = True
if hostmask not in self.recentnotices:
self.recentnotices[hostmask] = datetime.now()
else:
if datetime.now() - self.recentnotices[hostmask] < timedelta(hours=6):
sendNotice = False
if sendNotice:
self.log.info("%s is running a commit from %s" % (msg.nick, pretty.date(committime)))
irc.queueMsg(ircmsgs.notice(msg.nick, "You're running an old version of cjdns! Using a commit from %s, by the looks of it. You really ought to update." % pretty.date(committime)))
elif args is not None:
irc.reply("%s is up to date" % nick)
irc.reply("%s is running %s (from %s)" % (nick, version, pretty.date(committime)))
elif "error" in ping and args is not None:
irc.reply("Error checking version of %s: %s" % (host, ping['error']))
开发者ID:lukevers,项目名称:VersionCheck,代码行数:59,代码来源:plugin.py
示例16: _send
def _send(self, irc, identifier, channel, text):
if self.registryValue('bold'):
identifier = ircutils.bold(identifier)
notice = self.registryValue('notice')
if notice:
irc.queueMsg(ircmsgs.notice(channel, "%s: %s" % (identifier, text)))
else:
irc.queueMsg(ircmsgs.privmsg(channel, "%s: %s" % (identifier, text)))
开发者ID:IotaSpencer,项目名称:supyplugins,代码行数:8,代码来源:plugin.py
示例17: announce_entry
def announce_entry(self, irc, channel, feed, entry):
if self.should_send_entry(channel, entry):
s = self.format_entry(channel, feed, entry, True)
if self.registryValue("notice", channel):
m = ircmsgs.notice(channel, s)
else:
m = ircmsgs.privmsg(channel, s)
irc.queueMsg(m)
开发者ID:ProgVal,项目名称:Limnoria,代码行数:8,代码来源:plugin.py
示例18: g
def g(self, irc, msg, args, subject, message):
"""[@subject] <message>
Sends a global notice / If '"@2+word subject" Some message' format is used, then subject allows multiple words."""
caller = msg.nick
subject = self.getSubject(subject)
if subject != "":
subject = "[%s] - " % (subject)
irc.queueMsg(ircmsgs.notice("Global", "global %s%s (sent by %s)" % (subject, message, caller)))
开发者ID:IotaSpencer,项目名称:supyplugins,代码行数:8,代码来源:plugin.py
示例19: doJoin
def doJoin(self, irc, msg):
t = msg.prefix
nick_split = string.split(t, '!')
nick = nick_split[0]
big_nick = nick_split[0]
channel = msg.args[0]
if channel == '#bots':
irc.queueMsg(ircmsgs.notice(nick, "Hello %s, welcome to \x02#BOTS\x02, type \x0310+botlist\x03 to see our available bots, and use \x0310+botdesc BOT-NAME\x03, to see description and info about some bot from \x0310+botlist\x03 list" % nick))
开发者ID:kg-bot,项目名称:SupyBot,代码行数:8,代码来源:plugin.py
示例20: doJoin
def doJoin(self, irc, msg):
channel = msg.args[0]
nick = msg.nick
if self.registryValue('channels', channel):
mess = self.registryValue('mess', channel)
irc.queueMsg(ircmsgs.notice(nick, mess))
irc.noReply()
else: return
开发者ID:Vl4dTheImpaler,项目名称:supybot-plugins,代码行数:8,代码来源:plugin.py
注:本文中的supybot.ircmsgs.notice函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论