diff --git a/addons/discord_gd/discord.gd b/addons/discord_gd/discord.gd index cc90a22..aab7a71 100644 --- a/addons/discord_gd/discord.gd +++ b/addons/discord_gd/discord.gd @@ -622,6 +622,7 @@ func _generate_timer_nodes() -> void: func _connection_closed(code: int, reason: String) -> void: if VERBOSE: print('WSS connection closed with code=%s, reason=%s' % [code, reason]) + get_tree().quit() #force reset func _data_received(msg: String) -> void: @@ -679,8 +680,9 @@ func _send_heartbeat() -> void: # Send heartbeat OP code 1 if _client.get_ready_state() == WebSocketPeer.State.STATE_OPEN: _send_dict_wss(response_payload) else: - print("Websocket not open, skipping send") - login() + print("Websocket not open, resseting self") + get_tree().quit() + #login() _heartbeat_ack_received = false if VERBOSE: print('Heartbeat sent!') diff --git a/application_cmds/force-crash.gd b/application_cmds/force-crash.gd new file mode 100644 index 0000000..aeb021b --- /dev/null +++ b/application_cmds/force-crash.gd @@ -0,0 +1,24 @@ +extends RefCounted + +#func on_ready(main, bot: DiscordBot) -> void: +# pass +# +#func on_autocomplete(main, bot: DiscordBot, interaction: DiscordInteraction, options: Array) -> void: +# pass + +func execute(main, bot: DiscordBot, interaction: DiscordInteraction, options: Array) -> void: + if not Tools.check_perms(interaction): + return + + print("uhoh?") + interaction.reply( + { + "content" : "mrowww..." + } + ) + print("ohhuh") + bot.get_tree().quit() + + pass + +var data = ApplicationCommand.new().set_name("force_crash").set_description("cause the program to quit for test purposes") diff --git a/application_cmds/force-crash.gd.uid b/application_cmds/force-crash.gd.uid new file mode 100644 index 0000000..bfcca90 --- /dev/null +++ b/application_cmds/force-crash.gd.uid @@ -0,0 +1 @@ +uid://hnxkary6qbar diff --git a/application_cmds/printer-unload.gd b/application_cmds/printer-unload.gd index ab5c067..a2f770c 100644 --- a/application_cmds/printer-unload.gd +++ b/application_cmds/printer-unload.gd @@ -43,7 +43,7 @@ func execute(main, bot: DiscordBot, interaction: DiscordInteraction, options: Ar Library.save_data() var response : String = "returned `" + spool_name + "` to the library, would you like to keep it there or delete it" #var response : String = "Loaded `"+ spool_editing.name + "` into `" + printer_editing.name + "` and unloaded `" + endangered_spool.name + "` would you like to keep or delete the old spool: `" + endangered_spool.name + "` ?" - #var embed = Embed.new().set_description(Library.list_printers()) + var embed = Embed.new().set_description(Library.list_printers()) var row = MessageActionRow.new() var delete_button = MessageButton.new().set_style(MessageButton.STYLES.DANGER) delete_button.set_custom_id('delete-unloadspool') @@ -56,7 +56,7 @@ func execute(main, bot: DiscordBot, interaction: DiscordInteraction, options: Ar interaction.reply({ "content": response, - #"embeds":[embed], + "embeds":[embed], "components":[row], }) @@ -68,9 +68,10 @@ func execute(main, bot: DiscordBot, interaction: DiscordInteraction, options: Ar for spool : Spool in printer.spools: menu.add_option(spool.name, spool.name) var row = MessageActionRow.new().add_component(menu) + var embed = Embed.new().set_description(Library.list_printers()) interaction.reply({ "content": response, - #"embeds":[embed], + "embeds":[embed], "components":[row], }) diff --git a/main.gd b/main.gd index ecc09b9..1e54d3a 100644 --- a/main.gd +++ b/main.gd @@ -55,11 +55,11 @@ func _on_bot_ready(bot: DiscordBot): # -----Single server (updates instantly) #_register_application_commands(bot, "guild_id_here") - #_register_application_commands(bot, "679917161195765822") # personal server + _register_application_commands(bot, "679917161195765822") # personal server #_register_application_commands(bot, "1038007666032787476") # fabsoc # -----Global (may take upto 1hr to update) - _register_application_commands(bot) + #_register_application_commands(bot) #func _on_message_create(bot: DiscordBot, message: Message, channel: Dictionary) -> void: