mirror of
https://github.com/TheRealOwenRees/plantid-discord-bot.git
synced 2026-07-23 04:26:57 +00:00
change applciation commands structure
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@ import Config
|
||||
|
||||
config :plantid_discord_bot,
|
||||
start_time: DateTime.utc_now(),
|
||||
guild_ids: [1_002_507_312_159_797_318],
|
||||
guild_ids: [],
|
||||
api: Nostrum.Api,
|
||||
max_results: 5,
|
||||
score_threshold: 0.3,
|
||||
|
||||
+43
-11
@@ -1,16 +1,47 @@
|
||||
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",
|
||||
def global_application_commands do
|
||||
[
|
||||
%{
|
||||
name: "source",
|
||||
description: "Link to the source code for this bot",
|
||||
options: []
|
||||
},
|
||||
%{
|
||||
name: "invite",
|
||||
description: "Invite link for this bot",
|
||||
options: []
|
||||
},
|
||||
%{
|
||||
name: "help",
|
||||
description: "Help information for this bot",
|
||||
options: []
|
||||
},
|
||||
%{
|
||||
name: "info",
|
||||
description: "Information about this bot",
|
||||
options: []
|
||||
},
|
||||
%{
|
||||
name: "stats",
|
||||
description: "Statistics about this bot",
|
||||
options: []
|
||||
},
|
||||
%{
|
||||
name: "status",
|
||||
description: "API Status",
|
||||
options: []
|
||||
},
|
||||
%{
|
||||
name: "servers",
|
||||
description: "All servers that this bot belongs to",
|
||||
options: []
|
||||
},
|
||||
%{
|
||||
name: "id",
|
||||
description: "ID a plant from up to 5 images",
|
||||
options: [
|
||||
%{
|
||||
# Attachment type
|
||||
type: 11,
|
||||
name: "image1",
|
||||
description: "The image to identify",
|
||||
@@ -40,7 +71,8 @@ defmodule PlantIdDiscordBot.Consumer.Commands do
|
||||
description: "The image to identify",
|
||||
required: false
|
||||
}
|
||||
]}
|
||||
]
|
||||
}
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,13 +9,10 @@ defmodule PlantIdDiscordBot.Consumer do
|
||||
|
||||
@global_application_commands Commands.global_application_commands()
|
||||
|
||||
def handle_event({:READY}) do
|
||||
# mock function depending on the environment
|
||||
# Api.create_global_application_command(@global_application_commands)
|
||||
def handle_event({:READY, _data, _ws_state}) do
|
||||
Api.create_global_application_command(@global_application_commands)
|
||||
# TODO fix, not working
|
||||
Api.update_status(:online, "Guess the Plant|/help")
|
||||
# TODO remove in prod
|
||||
Api.create_guild_application_command(1_002_507_312_159_797_318, @global_application_commands)
|
||||
Api.update_status(:online, %{name: "Guess the Plant | /help", type: 0})
|
||||
end
|
||||
|
||||
def handle_event({:INTERACTION_CREATE, %{data: %{name: command}} = interaction, _ws_state}) do
|
||||
|
||||
Reference in New Issue
Block a user