本文整理汇总了Python中Core.chanusertracker.CUT.nick_in_chan方法的典型用法代码示例。如果您正苦于以下问题:Python CUT.nick_in_chan方法的具体用法?Python CUT.nick_in_chan怎么用?Python CUT.nick_in_chan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core.chanusertracker.CUT
的用法示例。
在下文中一共展示了CUT.nick_in_chan方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: router
# 需要导入模块: from Core.chanusertracker import CUT [as 别名]
# 或者: from Core.chanusertracker.CUT import nick_in_chan [as 别名]
def router(self, message, command):
for name, regex, access in self.routes:
params = regex.match(command)
if params is None:
continue
else:
break
else:
raise ParseError
route = getattr(self, name)
user = self.check_access(message, access)
if user is None:
raise UserError
if getattr(route, "_USER", False) is True:
if self.is_user(user) is False:
message.get_pnick()
raise UserError
if getattr(route, "_PLANET", False) is True:
if self.user_has_planet(user) is False:
raise PrefError
if getattr(route, "_CHANNEL", None) is not None:
if self.is_chan(message, route._CHANNEL) is False:
raise ChanParseError(route._CHANNEL)
if getattr(route, "_USER_IN", None) is not None:
if CUT.nick_in_chan(message.get_nick(), route._USER_IN) is not True:
raise ChanParseError(route._USER_IN)
return route, name, user, params
示例2: notice
# 需要导入模块: from Core.chanusertracker import CUT [as 别名]
# 或者: from Core.chanusertracker.CUT import nick_in_chan [as 别名]
def notice(self, text, target=None, priority=0):
# If we're opped in a channel in common with the user, we can reply with
# CNOTICE instead of NOTICE which doesn't count towards the flood limit.
if hasattr(self, "_channel") and CUT.opped(self.get_chan()) and CUT.nick_in_chan(target or self.get_nick(), self.get_chan()):
self.write("CNOTICE %s %s :%s" % (target or self.get_nick(), self.get_chan(), text), priority=priority)
else:
self.write("NOTICE %s :%s" % (target or self.get_nick(), text), priority=priority)
示例3: privmsg
# 需要导入模块: from Core.chanusertracker import CUT [as 别名]
# 或者: from Core.chanusertracker.CUT import nick_in_chan [as 别名]
def privmsg(self, text, target=None, priority=0):
if os.path.isfile("/tmp/meetingmode"):
return
# Privmsg someone. Target defaults to the person who triggered this line
# Should we send colours?
if (
Config.has_option("Connection", "color")
and not Config.has_option("NoColor", target)
and not (target[0] in ["#", "&"] and Config.has_option("NoColorChan", target[1:]))
):
text = "\x03" + Config.get("Connection", "color") + text + "\x0F"
color = True
else:
color = False
# If we're opped in a channel in common with the user, we can reply with
# CPRIVMSG instead of PRIVMSG which doesn't count towards the flood limit.
if (
(not target or target[0] not in "#&")
and hasattr(self, "_channel")
and CUT.opped(self.get_chan())
and CUT.nick_in_chan(target or self.get_nick(), self.get_chan())
):
self.write("CPRIVMSG %s %s :%s" % (target or self.get_nick(), self.get_chan(), text), color, priority)
else:
self.write("PRIVMSG %s :%s" % (target or self.get_nick(), text), color, priority)
示例4: execute
# 需要导入模块: from Core.chanusertracker import CUT [as 别名]
# 或者: from Core.chanusertracker.CUT import nick_in_chan [as 别名]
def execute(self, message, user, params):
if params.group(1):
if not user.is_admin():
message.alert("Insufficient access to send the help to %s." % params.group(1))
return
from Hooks.scans.request import request
tnick = params.group(1).strip()
if not CUT.nick_in_chan(tnick,request().scanchan()):
message.alert("%s does not appear to be in the scanner channel. Aborting." % tnick)
return
if message.reply_type() == NOTICE_REPLY:
message.notice(self.helptext, tnick, 2)
else:
message.privmsg(self.helptext, tnick, 2)
elif message.reply_type() == PUBLIC_REPLY and not user.is_admin():
message.alert("Insufficient access to spam the channel. Try another prefix." % params.group(1))
else:
message.reply(self.helptext, 2)