25 lines
769 B
Elixir
25 lines
769 B
Elixir
defmodule Mithridate.Application do
|
|
use Application
|
|
|
|
@discord_config Application.compile_env!(:mithridate, :discord)
|
|
@command_config Application.compile_env!(:mithridate, :command)
|
|
|
|
@impl true
|
|
def start(_type, _args) do
|
|
bot_options = %{
|
|
name: Mithridate,
|
|
consumer: Mithridate.Consumer,
|
|
intents: Keyword.fetch!(@discord_config, :intents),
|
|
wrapped_token: fn -> Keyword.fetch!(@discord_config, :token) end
|
|
}
|
|
|
|
children = [
|
|
Mithridate.CommandHandler,
|
|
{Mithridate.CommandStore.ChatInput, Keyword.get(@command_config, :chat_input)},
|
|
{Mithridate.CommandStore.User, Keyword.get(@command_config, :user)},
|
|
{Nostrum.Bot, bot_options}
|
|
]
|
|
|
|
Supervisor.start_link(children, strategy: :one_for_one)
|
|
end
|
|
end
|