本文整理汇总了Python中Irc.get_nickname方法的典型用法代码示例。如果您正苦于以下问题:Python Irc.get_nickname方法的具体用法?Python Irc.get_nickname怎么用?Python Irc.get_nickname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Irc
的用法示例。
在下文中一共展示了Irc.get_nickname方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: message
# 需要导入模块: import Irc [as 别名]
# 或者: from Irc import get_nickname [as 别名]
def message(serv, source, target, text):
host = Irc.get_host(source)
Commands.Tracking.activity(source,target,serv)
if target != serv.nick and source == '[email protected]' and 'tipped' in text and 'to dogesoak' in text.lower():
try:
usr = text.split()[1]
req = Request(serv, target, usr)
val = int(text.split('much ',1)[1][2:].split(' ',1)[0])
try:
Commands.soak(req,[str(val)])
except:
req.say('An error occurred.')
#req.serv.send('PRIVMSG','Doger','tip ')
except:
print 'soaker error'
if Commands.lreq and target == serv.nick and source.split('!',1)[0] == 'Doger':
Commands.balancerepl(text)
if text[0] == '!' or target == serv.nick:
if serv.is_ignored(host):
print(serv.nick + ": (ignored) <" + Irc.get_nickname(source) + "> " + text)
return
print(serv.nick + ": <" + Irc.get_nickname(source) + "> " + text)
t = time.time()
score = serv.flood_score.get(host, (t, 0))
score = max(score[1] + score[0] - t, 0) + 4
if score > 40 and not serv.is_admin(source):
serv.ignore(host, 240)
serv.send("PRIVMSG", Irc.get_nickname(source), "You're sending commands too quickly. Your host is ignored for 240 seconds")
return
serv.flood_score[host] = (t, score)
if text[0] == '!':
text = text[1:]
src = Irc.get_nickname(source)
if target == serv.nick:
reply = src
else:
reply = target
if text.find(" ") == -1:
command = text
args = []
else:
command, args = text.split(" ", 1)
args = args.split(" ")
if command[0] != '_':
cmd = Commands.commands.get(command.lower(), None)
if not cmd.__doc__ or cmd.__doc__.find("admin") == -1 or serv.is_admin(source):
if cmd:
req = Request(serv, reply, source)
try:
ret = cmd(req, args)
except Exception as e:
type, value, tb = sys.exc_info()
traceback.print_tb(tb)
req.reply(repr(e))
示例2: message
# 需要导入模块: import Irc [as 别名]
# 或者: from Irc import get_nickname [as 别名]
def message(instance, source, target, text):
host = Irc.get_host(source)
if text == "\x01VERSION\x01":
p = subprocess.Popen(["git", "rev-parse", "HEAD"], stdout = subprocess.PIPE)
hash, _ = p.communicate()
hash = hash.strip()
p = subprocess.Popen(["git", "diff", "--quiet"])
changes = p.wait()
if changes:
hash += "[+]"
version = "Doger by mniip, version " + hash
Irc.instance_send(instance, ("NOTICE", Irc.get_nickname(source), "\x01VERSION " + version + "\x01"), priority = 20)
else:
commandline = None
if target == instance:
commandline = text
if text[0] == Config.config["prefix"]:
commandline = text[1:]
if commandline:
if Irc.is_ignored(host):
Logger.log("c", instance + ": %s <%s ignored> %s " % (target, Irc.get_nickname(source), text))
return
Logger.log("c", instance + ": %s <%s> %s " % (target, Irc.get_nickname(source), text))
if Config.config.get("ignore", None):
t = time.time()
score = Global.flood_score.get(host, (t, 0))
score = max(score[1] + score[0] - t, 0) + Config.config["ignore"]["cost"]
if score > Config.config["ignore"]["limit"] and not Irc.is_admin(source):
Logger.log("c", instance + ": Ignoring " + host)
Irc.ignore(host, Config.config["ignore"]["timeout"])
Irc.instance_send(instance, ("PRIVMSG", Irc.get_nickname(source), "You're sending commands too quickly. Your host is ignored for 240 seconds"))
return
Global.flood_score[host] = (t, score)
src = Irc.get_nickname(source)
if target == instance:
reply = src
else:
reply = target
commandline = commandline.rstrip(" \t")
if commandline.find(" ") == -1:
command = commandline
args = []
else:
command, args = commandline.split(" ", 1)
args = [a for a in args.split(" ") if len(a) > 0]
if command[0] != '_':
cmd = Commands.commands.get(command.lower(), None)
if not cmd.__doc__ or cmd.__doc__.find("admin") == -1 or Irc.is_admin(source):
if cmd:
req = Request(instance, reply, source, commandline)
t = threading.Thread(target = run_command, args = (cmd, req, args))
t.start()
示例3: _nick
# 需要导入模块: import Irc [as 别名]
# 或者: from Irc import get_nickname [as 别名]
def _nick(instance, source, newnick):
nick = Irc.get_nickname(source)
for channel in Global.account_cache:
if nick in Global.account_cache[channel]:
Global.account_cache[channel][newnick] = Global.account_cache[channel][nick]
Logger.log("w", "%s -> %s in %s" % (nick, newnick, channel))
del Global.account_cache[channel][nick]
示例4: account
# 需要导入模块: import Irc [as 别名]
# 或者: from Irc import get_nickname [as 别名]
def account(instance, source, account):
if account == "*":
account = False
nick = Irc.get_nickname(source)
for channel in Global.account_cache:
if nick in Global.account_cache[channel]:
Global.account_cache[channel][nick] = account
Logger.log("w", "Propagating %s=%s into %s" % (nick, account, channel))
示例5: part
# 需要导入模块: import Irc [as 别名]
# 或者: from Irc import get_nickname [as 别名]
def part(instance, source, channel, *_):
nick = Irc.get_nickname(source)
if nick == instance:
del Global.account_cache[channel]
Logger.log("w", "Removing cache for " + channel)
return
if nick in Global.account_cache[channel]:
del Global.account_cache[channel][nick]
Logger.log("w", "Removing %s from %s" % (nick, channel))
示例6: join
# 需要导入模块: import Irc [as 别名]
# 或者: from Irc import get_nickname [as 别名]
def join(instance, source, channel, account, _):
if account == "*":
account = False
nick = Irc.get_nickname(source)
with Global.account_lock:
if nick == instance:
Global.account_cache[channel] = {}
Global.account_cache[channel][nick] = account
for channel in Global.account_cache:
if nick in Global.account_cache[channel]:
Global.account_cache[channel][nick] = account
Logger.log("w", "Propagating %s=%s into %s" % (nick, account, channel))
示例7: quit
# 需要导入模块: import Irc [as 别名]
# 或者: from Irc import get_nickname [as 别名]
def quit(instance, source, _):
nick = Irc.get_nickname(source)
if nick == instance:
chans = []
for channel in Global.account_cache:
if nick in Global.account_cache[channel]:
chans.append(channel)
for channel in chans:
del Global.account_cache[channel]
Logger.log("w", "Removing cache for " + channel)
return
for channel in Global.account_cache:
if nick in Global.account_cache[channel]:
del Global.account_cache[channel][nick]
Logger.log("w", "Removing %s from %s" % (nick, channel))
示例8: __init__
# 需要导入模块: import Irc [as 别名]
# 或者: from Irc import get_nickname [as 别名]
def __init__(self, serv, target, source):
self.serv = serv
self.target = target
self.source = source
self.nick = Irc.get_nickname(source)
示例9: __init__
# 需要导入模块: import Irc [as 别名]
# 或者: from Irc import get_nickname [as 别名]
def __init__(self, instance, target, source, text):
self.instance = instance
self.target = target
self.source = source
self.nick = Irc.get_nickname(source)
self.text = text