Fix owner permissions not doing properly

This commit is contained in:
Jeremy Zhang 2018-03-25 05:45:16 +00:00
parent e8424a63c8
commit 4859b5a379

View File

@ -213,7 +213,7 @@ def get_guild_channels(guild_id, force_everyone=False):
result_channels = [] result_channels = []
for channel in guild_channels: for channel in guild_channels:
if channel['type'] in ["text", "category"]: if channel['type'] in ["text", "category"]:
result = get_channel_permission(channel, guild_id, guild_owner, guild_roles, member_roles, session.get("user_id"), force_everyone) result = get_channel_permission(channel, guild_id, guild_owner, guild_roles, member_roles, str(session.get("user_id")), force_everyone)
bot_result = get_channel_permission(channel, guild_id, guild_owner, guild_roles, bot_member_roles, config["client-id"], False) bot_result = get_channel_permission(channel, guild_id, guild_owner, guild_roles, bot_member_roles, config["client-id"], False)
if not bot_result["read"]: if not bot_result["read"]:
result["read"] = False result["read"] = False
@ -227,7 +227,7 @@ def get_guild_channels(guild_id, force_everyone=False):
def get_channel_permission(channel, guild_id, guild_owner, guild_roles, member_roles, user_id=None, force_everyone=False): def get_channel_permission(channel, guild_id, guild_owner, guild_roles, member_roles, user_id=None, force_everyone=False):
result = {"channel": channel, "read": False, "write": False, "mention_everyone": False} result = {"channel": channel, "read": False, "write": False, "mention_everyone": False}
if not user_id: if not user_id:
user_id = session.get("user_id") user_id = str(session.get("user_id"))
if guild_owner == user_id: if guild_owner == user_id:
result["read"] = True result["read"] = True
result["write"] = True result["write"] = True