From bb4ddf5243739a86ff46d245850c71621c9e5189 Mon Sep 17 00:00:00 2001 From: Owen Date: Sun, 22 Dec 2024 11:35:09 +0100 Subject: [PATCH] separation of commands --- lib/commands.ex | 46 ++++++++++++++++++++++++++++++++++++++ lib/plantid_discord_bot.ex | 13 +++-------- 2 files changed, 49 insertions(+), 10 deletions(-) create mode 100644 lib/commands.ex diff --git a/lib/commands.ex b/lib/commands.ex new file mode 100644 index 0000000..d10cfd3 --- /dev/null +++ b/lib/commands.ex @@ -0,0 +1,46 @@ +defmodule PlantIdDiscordBot.Consumer.Commands do + def global_application_commands() do + [ + {"source", "Link to the source code for this bot", []}, + {"invite", "Invite link for this bot", []}, + {"help", "Help information for this bot", []}, + {"info", "Information about this bot", []}, + {"stats", "Statistics about this bot", []}, + {"status", "API Status", []}, + {"servers", "All servers that this bot belongs to", []}, + {"id", "ID a plant from up to 5 images", + [ + %{ + type: 11, + name: "image1", + description: "The image to identify", + required: true + }, + %{ + type: 11, + name: "image2", + description: "The image to identify", + required: false + }, + %{ + type: 11, + name: "image3", + description: "The image to identify", + required: false + }, + %{ + type: 11, + name: "image4", + description: "The image to identify", + required: false + }, + %{ + type: 11, + name: "image5", + description: "The image to identify", + required: false + } + ]} + ] + end +end diff --git a/lib/plantid_discord_bot.ex b/lib/plantid_discord_bot.ex index dd7d336..fa72cd3 100644 --- a/lib/plantid_discord_bot.ex +++ b/lib/plantid_discord_bot.ex @@ -5,17 +5,10 @@ defmodule PlantIdDiscordBot.Consumer do use Nostrum.Consumer alias Nostrum.Api alias PlantIdDiscordBot.Cog + alias PlantIdDiscordBot.Consumer.Commands + + @global_application_commands Commands.global_application_commands() - @global_application_commands [ - {"source", "Link to the source code for this bot, []"}, - {"invite", "Invite link for this bot, []"}, - {"help", "Help information for this bot, []"}, - {"info", "Information about this bot, []"}, - {"stats", "Statistics about this bot, []"}, - {"status", "API Status, []"}, - {"servers", "All servers that this bot belongs to, []"}, - {"id", "ID a plant from up to 5 images, []"} - ] def handle_event({:READY}) do # mock function depending on the environment # Api.create_global_application_command(@global_application_commands)