check we have a channel_arg kwarg before parsing it as an int

(channel_access.py)
This commit is contained in:
jesopo 2019-01-30 19:20:11 +00:00
parent 0e66921d34
commit 8ac989fa96

View file

@ -21,8 +21,9 @@ class Module(ModuleManager.BaseModule):
else:
return "You do not have permission to do this"
else:
channel_arg_index = int(event["hook"].get_kwarg("channel_arg"))
channel_name = event["args_split"][channel_arg_index]
channel_arg_index = event["hook"].get_kwarg("channel_arg", None)
if not channel_arg_index == None:
channel_name = event["args_split"][int(channel_arg_index)]
if channel_name in event["server"].channels:
channel = event["server"].channels.get(channel_name)
if self._has_channel_access(channel, event["user"],