fixed CommandHandler
This commit is contained in:
parent
bd1b0b8a8e
commit
2531c6f446
@ -79,12 +79,13 @@ func handle_command(sender_data : SenderData, msg : String, whisper : bool = fal
|
||||
if(user_perm_flags & cmd_data.permission_level == 0):
|
||||
cmd_no_permission.emit(command, sender_data, cmd_data, arg_ary)
|
||||
return
|
||||
if(arg_ary.size() == 0):
|
||||
cmd_data.func_ref.call(CommandInfo.new(sender_data, command, whisper))
|
||||
else:
|
||||
cmd_data.func_ref.call(CommandInfo.new(sender_data, command, whisper), arg_ary)
|
||||
elif (cmd_data.min_args > 0):
|
||||
cmd_invalid_argcount.emit(command, sender_data, cmd_data, arg_ary)
|
||||
if(arg_ary.size() == 0):
|
||||
if (cmd_data.min_args > 0):
|
||||
cmd_invalid_argcount.emit(command, sender_data, cmd_data, arg_ary)
|
||||
return
|
||||
cmd_data.func_ref.call(CommandInfo.new(sender_data, command, whisper))
|
||||
else:
|
||||
cmd_data.func_ref.call(CommandInfo.new(sender_data, command, whisper), arg_ary)
|
||||
|
||||
func get_perm_flag_from_tags(tags : Dictionary) -> int:
|
||||
var flag = 0
|
||||
|
@ -61,14 +61,14 @@ func _ready() -> void:
|
||||
# Add a list command that accepts between 1 and infinite args.
|
||||
cmd_handler.add_command("list", list, -1, 1)
|
||||
|
||||
# For the cmd handler to receive the messages, we have to forward them.
|
||||
# For the chat example to work, we forward the messages received to the put_chat function.
|
||||
irc.chat_message.connect(put_chat)
|
||||
|
||||
# We also have to forward the messages to the command handler to handle them.
|
||||
irc.chat_message.connect(cmd_handler.handle_command)
|
||||
# If you also want to accept whispers, connect the signal and bind true as the last arg.
|
||||
irc.whisper_message.connect(cmd_handler.handle_command.bind(true))
|
||||
|
||||
# For the chat example to work, we forward the messages received to the put_chat function.
|
||||
irc.chat_message.connect(put_chat)
|
||||
|
||||
# When we press enter on the chat bar or press the send button, we want to execute the send_message
|
||||
# function.
|
||||
%LineEdit.text_submitted.connect(send_message.unbind(1))
|
||||
|
Loading…
x
Reference in New Issue
Block a user