mirror of
https://github.com/TheRealOwenRees/plantid-discord-bot.git
synced 2026-07-22 20:16:57 +00:00
02372f2076a1c2df68eab8b1ac63cd8eb2039e25
* added list of tasks to achieve * update deps * update elixir version in CI/CD pipeline * update todo with branch push checks * underscores separation of large numbers * update elixir version and deps * add basic module docs * remove IO.inspect call * check if list is empty rather than traversing list for length * revert empty list code * duration tests * add mime type tests * use logger instread of inspect, remove todos * replace list length check with Enum.empty * replace list length check with !Enum.empty? * numbers readability fix by using underscores on large numbers * iucn parser replaced case with multiclause function and added test * replace map and join with map_join * fix multiple spec issues where map() must be inside a list
Plant ID Discord Bot
A plant identification bot for your Discord server.
Plant ID Bot identifies plants from photos of their organs, passing to the Plantnet API for identification. This bot was written for Sustainable Living Hub
If you wish to invite this bot to your server, use this link. However, your server will be limited to a maximum of 10 identifications every 24h. It is strongly preferred that you host a version of this bot yourself and register for your own PlantNet API key. Details for this are later in this readme file.
Features
- Takes the message picture attachments and attempts to identify them
- Returns a suggested plant name and up to 2 alternatives, with a percentage confidence rating
- Plant names are given in latin with a list of possible common names
- Provides links to GBIF, PFAF, and POWO for the identified plant
Dependencies
This application has been built and tested with Elixir 1.18 / OTP 28.
# mix.exs
defp deps do
[
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
{:nostrum, "~> 0.10"},
{:httpoison, "~> 2.2"},
{:image, "~> 0.55"},
{:jason, "~> 1.4"},
{:logger_webhook_backend, "~> 0.0.4"},
{:plug, "~> 1.12"},
{:plug_cowboy, "~> 2.7"},
{:quantum, "~> 3.5"}
]
end
Environment Variables
Below are the environment variables that you need to set for the program to function:
# needed in development and production
PLANTID_DISCORD_BOT_TOKEN= client secret from the bot's application
PLANTID_LOGS_DISCORD_WEBHOOK_URL= webhook url for the log channel
PLANTNET_API_KEY= API key for the PlantNet service
# needed in production
PLANTID_FILESERVER_URL URL and port(if needed) for the http file server
Installation
Prerequisites
- Have a VPS ready to host this application on
- Visit PlantNet Api and create your own API key
- Visit Discord Developer Portal and create a new application as a bot. Give it permissions to read and send messages, use application commands, and to create embeds. Enable
Message Content Intent. Keep note of theBot Token.
then...
- Clone this GitHub repository locally
- Add the above environment variables to you GitHub actions secrets, as well as SSH keys for your VPS, username, host, and port
- Change the target OS version if required.
- Force the GitHub action to run, allowing it to deploy on your server
- Start the application on your VPS with
your_folder_name/current_release/bin/plantid_discord_bot daemon
Development
Want to contribute? Simply fork, edit and then create a pull request. Details of how to do this can be found here.
License
MIT
Description
PlantID Bot identifies plants from photos of their organs, passing to the PlantNet API for identification.
Readme
880 KiB
Languages
Elixir
100%