mirror of
https://github.com/TheRealOwenRees/plantid-discord-bot.git
synced 2026-07-23 04:26:57 +00:00
/source application command with test
This commit is contained in:
@@ -1,18 +1,37 @@
|
||||
defmodule PlantIdDiscordBot do
|
||||
@moduledoc """
|
||||
Documentation for `PlantidDiscordBot`.
|
||||
A Discord bot that identifies plants from photos of their organs.
|
||||
"""
|
||||
|
||||
@doc """
|
||||
Hello world.
|
||||
use Nostrum.Consumer
|
||||
alias Nostrum.Api
|
||||
alias PlantIdDiscordBot.Cog
|
||||
|
||||
## Examples
|
||||
IO.inspect("Starting PlantIdDiscordBot")
|
||||
|
||||
iex> PlantidDiscordBot.hello()
|
||||
:world
|
||||
@global_application_commands [
|
||||
{"servers", "All servers that this bot belongs to, []"},
|
||||
{"invite", "Invite link for this bot, []"},
|
||||
{"source", "Link to the source code for this bot, []"},
|
||||
{"info", "Information about this bot, []"},
|
||||
{"stats", "Statistics about this bot, []"},
|
||||
{"help", "Help information for this bot, []"},
|
||||
{"status", "API Status, []"},
|
||||
{"id", "ID a plant from up to 5 images, []"}
|
||||
]
|
||||
|
||||
"""
|
||||
def hello do
|
||||
:world
|
||||
# Starts the bot
|
||||
def handle_event({:READY}) do
|
||||
# mock function depending on the environment
|
||||
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)
|
||||
end
|
||||
|
||||
# Handle /source command
|
||||
def handle_event({:INTERACTION_CREATE, %{data: %{name: "source"}} = interaction, _ws_state}) do
|
||||
Cog.Info.source(interaction)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user