当前位置: 首页>>代码示例>>Python>>正文


Python CUT.untrack_user方法代码示例

本文整理汇总了Python中Core.chanusertracker.CUT.untrack_user方法的典型用法代码示例。如果您正苦于以下问题:Python CUT.untrack_user方法的具体用法?Python CUT.untrack_user怎么用?Python CUT.untrack_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Core.chanusertracker.CUT的用法示例。


在下文中一共展示了CUT.untrack_user方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: execute

# 需要导入模块: from Core.chanusertracker import CUT [as 别名]
# 或者: from Core.chanusertracker.CUT import untrack_user [as 别名]
    def execute(self, message, user, params):

        username = params.group(1)
        member = User.load(name=username, active=False)
        if member is None:
            message.alert("No such user '%s'" % (username,))
            return
        if member.access > user.access:
            message.reply(
                "You may not remove %s, his or her access (%s) exceeds your own (%s)"
                % (member.name, member.access, user.access)
            )
            return

        mbraxx = Config.getint("Access", "member")
        home = Config.get("Channels", "home")
        coraxx = Config.getint("Access", "core")
        core = Config.get("Channels", "core")

        if member.active and member.access >= mbraxx:
            message.privmsg("remuser %s %s" % (home, member.name), "P")
        if member.active and member.access >= coraxx:
            message.privmsg("remuser %s %s" % (core, member.name), "P")
        session.delete(member)
        session.commit()
        message.reply("Removed user %s" % (member.name,))
        CUT.untrack_user(member.name)
开发者ID:JDD,项目名称:DLR,代码行数:29,代码来源:remuser.py

示例2: execute

# 需要导入模块: from Core.chanusertracker import CUT [as 别名]
# 或者: from Core.chanusertracker.CUT import untrack_user [as 别名]
 def execute(self, message, user, params):
     
     username = params.group(1)
     access = params.group(2).lower()
     if access.isdigit():
         access = int(access)
     elif access in self.true:
         access = True
     elif access in self.false:
         access = False
     else:
         try:
             access = Config.getint("Access",access)
         except Exception:
             message.reply("Invalid access level '%s'" % (access,))
             return
     
     member = User.load(name=username, active=False)
     if member is None:
         message.alert("No such user '%s'" % (username,))
         return
     
     if type(access) is int and not member.active:
         message.reply("You should first re-activate user %s" %(member.name,))
         return
     
     if access > user.access or member.access > user.access:
         message.reply("You may not change access higher than your own")
         return
     
     mbraxx = Config.getint("Access","member")
     home = Config.get("Channels","home")
     
     if type(access) == int:
         if member.active == True and member.access < mbraxx and access >= mbraxx:
             message.privmsg("adduser %s %s 399" %(home, member.name,), Config.get("Services", "nick"))
             message.reply("%s has been added to %s"%(member.name, home,))
         if member.active == True and member.access >= mbraxx and access < mbraxx:
             message.privmsg("remuser %s %s"%(home, member.name,), Config.get("Services", "nick"))
             message.privmsg("ban %s *!*@%s.%s GTFO, EAAD"%(home, member.name, Config.get("Services", "usermask"),), Config.get("Services", "nick"))
         member.access = access
     else:
         if member.active != access and access == True and member.access >= mbraxx:
             message.privmsg("adduser %s %s 399" %(home, member.name,), Config.get("Services", "nick"))
             message.reply("%s has been added to %s"%(member.name, home,))
         if member.active != access and access == False and member.access >= mbraxx:
             message.privmsg("remuser %s %s"%(home, member.name,), Config.get("Services", "nick"))
             message.privmsg("ban %s *!*@%s.%s GTFO, EAAD"%(home, member.name, Config.get("Services", "usermask"),), Config.get("Services", "nick"))
         member.active = access
     session.commit()
     message.reply("Editted user %s access: %s" % (member.name, access,))
     if not member.active:
         CUT.untrack_user(member.name)
开发者ID:Hardware-Hacks,项目名称:merlin,代码行数:55,代码来源:edituser.py

示例3: execute

# 需要导入模块: from Core.chanusertracker import CUT [as 别名]
# 或者: from Core.chanusertracker.CUT import untrack_user [as 别名]
    def execute(self, message, user, params):
        
        usernames = params.group(1)
        access = params.group(2).lower()
        if access.isdigit():
            access = int(access)
        elif access in self.true:
            access = True
        elif access in self.false:
            access = False
        else:
            try:
                access = Config.getint("Access",access)
            except Exception:
                message.reply("Invalid access level '%s'" % (access,))
                return

        addnicks = []
        remnicks = []
        changed = []
        mbraxx = Config.getint("Access","member")
        home = Config.get("Channels","home")
            
        for username in usernames.split():
            member = User.load(name=username, active=False)
            if member is None:
                message.alert("No such user '%s'" % (username,))
                return
            
            if type(access) is int and not member.active:
                message.reply("You should first re-activate user %s" %(member.name,))
                return
            
            if access > user.access or member.access > user.access:
                message.reply("You may not change access higher than your own")
                return

            changed.append(username)

            if type(access) == int:
                if member.active == True and member.access < mbraxx and access >= mbraxx:
                    addnicks.append(member.name)
                if member.active == True and member.access >= mbraxx and access < mbraxx:
                    message.privmsg("remuser %s %s"%(home, member.name,), Config.get("Services", "nick"))
                    remnicks.append(member.name)
    #                message.privmsg("ban %s *!*@%s.%s GTFO, EAAD"%(home, member.name, Config.get("Services", "usermask"),), Config.get("Services", "nick"))
                member.access = access
            else:
                if member.active != access and access == True and member.access >= mbraxx:
                    addnicks.append(member.name)
                if member.active != access and access == False and member.access >= mbraxx:
                    message.privmsg("remuser %s %s"%(home, member.name,), Config.get("Services", "nick"))
                    remnicks.append(member.name)
     #               message.privmsg("ban %s *!*@%s.%s GTFO, EAAD"%(home, member.name, Config.get("Services", "usermask"),), Config.get("Services", "nick"))
                member.active = access
            if not member.active:
                CUT.untrack_user(member.name)
        session.commit()
        if addnicks:
            message.privmsg("adduser %s %s 24" %(home, ",".join(addnicks),), Config.get("Services", "nick"))
            message.reply("%s ha%s been added to %s"%(", ".join(addnicks), "ve" if len(addnicks) > 1 else "s", home,))
        if remnicks:
            message.reply("%s ha%s been removed from %s"%(", ".join(remnicks), "ve" if len(remnicks) > 1 else "s", home,))
        if changed:
            message.reply("Editted user%s %s access to %s" % ("s" if len(changed) > 1 else "", ", ".join(changed), access,))
开发者ID:liam-wiltshire,项目名称:merlin,代码行数:67,代码来源:edituser.py


注:本文中的Core.chanusertracker.CUT.untrack_user方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。