test
This commit is contained in:
parent
4405766e95
commit
b929d65dc0
@ -1,5 +1,5 @@
|
||||
|
||||
from sopel import plugin
|
||||
import sopel.privileges
|
||||
|
||||
|
||||
class Users():
|
||||
@ -14,12 +14,12 @@ class Users():
|
||||
}
|
||||
|
||||
self.channel_privilege_dict = {
|
||||
"OPER": plugin.OPER,
|
||||
"OWNER": plugin.OWNER,
|
||||
"ADMIN": plugin.ADMIN,
|
||||
"OP": plugin.OP,
|
||||
"HALFOP": plugin.HALFOP,
|
||||
"VOICE": plugin.VOICE,
|
||||
"OPER": sopel.privileges.OPER,
|
||||
"OWNER": sopel.privileges.OWNER,
|
||||
"ADMIN": sopel.privileges.ADMIN,
|
||||
"OP": sopel.privileges.OP,
|
||||
"HALFOP": sopel.privileges.HALFOP,
|
||||
"VOICE": sopel.privileges.VOICE,
|
||||
}
|
||||
|
||||
"""Bot Priviledges"""
|
||||
@ -98,17 +98,17 @@ class Users():
|
||||
|
||||
if not isinstance(privilege, int):
|
||||
if privilege.upper() == "OPER":
|
||||
privilege = plugin.OPER
|
||||
privilege = self.channel_privilege_dict["OPER"]
|
||||
elif privilege.upper() == "OWNER":
|
||||
privilege = plugin.OWNER
|
||||
privilege = self.channel_privilege_dict["OWNER"]
|
||||
elif privilege == "ADMIN":
|
||||
privilege = plugin.ADMIN
|
||||
privilege = self.channel_privilege_dict["ADMIN"]
|
||||
elif privilege.upper() == "OP":
|
||||
privilege = plugin.OP
|
||||
privilege = self.channel_privilege_dict["OP"]
|
||||
elif privilege.upper() in ["HALFOP", "HOP"]:
|
||||
privilege = plugin.HALFOP
|
||||
privilege = self.channel_privilege_dict["HALFOP"]
|
||||
elif privilege.upper() == "VOICE":
|
||||
privilege = plugin.VOICE
|
||||
privilege = self.channel_privilege_dict["VOICE"]
|
||||
else:
|
||||
return False
|
||||
|
||||
@ -122,7 +122,7 @@ class Users():
|
||||
|
||||
def list_channel_users_oper(self, channelstr):
|
||||
channel = self.bot.channels[channelstr]
|
||||
return [user for nick, user in channel.users if channel.is_oper(nick, plugin.OPER)]
|
||||
return [user for nick, user in channel.users if channel.is_oper(nick, self.channel_privilege_dict["OPER"])]
|
||||
|
||||
def is_channel_oper(self, channelstr, user):
|
||||
if user in self.list_channel_users_oper(channelstr):
|
||||
@ -133,7 +133,7 @@ class Users():
|
||||
|
||||
def list_channel_users_owner(self, channelstr):
|
||||
channel = self.bot.channels[channelstr]
|
||||
return [user for nick, user in channel.users if channel.is_owner(nick, plugin.OWNER)]
|
||||
return [user for nick, user in channel.users if channel.is_owner(nick, self.channel_privilege_dict["OWNER"])]
|
||||
|
||||
def is_channel_owner(self, channelstr, user):
|
||||
if user in self.list_channel_users_owner(channelstr):
|
||||
@ -144,7 +144,7 @@ class Users():
|
||||
|
||||
def list_channel_users_admin(self, channelstr):
|
||||
channel = self.bot.channels[channelstr]
|
||||
return [user for nick, user in channel.users if channel.is_admin(nick, plugin.ADMIN)]
|
||||
return [user for nick, user in channel.users if channel.is_admin(nick, self.channel_privilege_dict["ADMIN"])]
|
||||
|
||||
def is_channel_admin(self, channelstr, user):
|
||||
if user in self.list_channel_users_admin(channelstr):
|
||||
@ -155,7 +155,7 @@ class Users():
|
||||
|
||||
def list_channel_users_op(self, channelstr):
|
||||
channel = self.bot.channels[channelstr]
|
||||
return [user for nick, user in channel.users if channel.is_op(nick, plugin.OP)]
|
||||
return [user for nick, user in channel.users if channel.is_op(nick, self.channel_privilege_dict["OP"])]
|
||||
|
||||
def is_channel_op(self, channelstr, user):
|
||||
if user in self.list_channel_users_op(channelstr):
|
||||
@ -166,7 +166,7 @@ class Users():
|
||||
|
||||
def list_channel_users_halfop(self, channelstr):
|
||||
channel = self.bot.channels[channelstr]
|
||||
return [user for nick, user in channel.users if channel.is_halfop(nick, plugin.HALFOP)]
|
||||
return [user for nick, user in channel.users if channel.is_halfop(nick, self.channel_privilege_dict["HALFOP"])]
|
||||
|
||||
def is_channel_halfop(self, channelstr, user):
|
||||
if user in self.list_channel_users_halfop(channelstr):
|
||||
@ -177,7 +177,7 @@ class Users():
|
||||
|
||||
def list_channel_users_voice(self, channelstr):
|
||||
channel = self.bot.channels[channelstr]
|
||||
return [user for nick, user in channel.users if channel.is_voice(nick, plugin.VOICE)]
|
||||
return [user for nick, user in channel.users if channel.is_voice(nick, self.channel_privilege_dict["VOICE"])]
|
||||
|
||||
def is_channel_voice(self, channelstr, user):
|
||||
if user in self.list_channel_users_voice(channelstr):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user