printer creation and deltion working
This commit is contained in:
parent
b53d33584c
commit
b7ce1a2162
7 changed files with 87 additions and 2 deletions
31
application_cmds/printer-create.gd
Normal file
31
application_cmds/printer-create.gd
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
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:
|
||||
print(options)
|
||||
var printer_name = options[0].value
|
||||
|
||||
var new_printer : Printer = Printer.new()
|
||||
new_printer.name = printer_name
|
||||
Library.save.printers.append(new_printer)
|
||||
Library.save_data()
|
||||
|
||||
var response : String = "Created new printer: `" + printer_name + "`\n"
|
||||
var embed = Embed.new().set_description(Library.list_printers())
|
||||
|
||||
interaction.reply({
|
||||
"content": response,
|
||||
"embeds":[embed]
|
||||
})
|
||||
pass
|
||||
|
||||
var data = ApplicationCommand.new()\
|
||||
.set_name("printer-create")\
|
||||
.set_description("create a new printer")\
|
||||
.add_option(ApplicationCommand.string_option("name", "the printers name",{"required":true}))\
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue