groundwork for custom request limits, with 10 requests now standard

This commit is contained in:
Owen
2025-01-13 14:40:48 +01:00
committed by Owen Rees
parent 1e1e74a35d
commit 683c4c4de2
2 changed files with 7 additions and 1 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ import Config
config :plantid_discord_bot, config :plantid_discord_bot,
max_results: 5, max_results: 5,
score_threshold: 0.3, score_threshold: 0.3,
guild_request_limit_per_day: 20, guild_request_limit_per_day: 10,
image_path: "priv/static", image_path: "priv/static",
plantnet_api_base_url: "https://my-api.plantnet.org/v2", plantnet_api_base_url: "https://my-api.plantnet.org/v2",
source: "https://github.com/TheRealOwenRees/plantid-discord-bot", source: "https://github.com/TheRealOwenRees/plantid-discord-bot",
+6
View File
@@ -4,6 +4,12 @@ defmodule PlantIdDiscordBot.RateLimiter do
@request_limit Application.compile_env(:plantid_discord_bot, :guild_request_limit_per_day) @request_limit Application.compile_env(:plantid_discord_bot, :guild_request_limit_per_day)
@custom_limits %{
1_002_507_312_159_797_318 => 100,
689_135_063_849_500_726 => 50,
900_886_202_226_462_730 => 50
}
def start_link(_) do def start_link(_) do
GenServer.start_link(__MODULE__, nil, name: __MODULE__) GenServer.start_link(__MODULE__, nil, name: __MODULE__)
end end