Helpers for working with bot tokens.
This module provides the fetch/1 function to retrieve bot tokens from various
sources: explicit options, the bot registry, or application configuration.
See ExGram.Bot for how tokens are registered during bot startup.
Summary
Functions
Main logic to extract the token of the bot.
Functions
Main logic to extract the token of the bot.
The options can have the following keys:
:token- Explicit token to be used (ignores everything else):bot- Bot name (atom) to retrieve token from registry:registry- Optional. Registry to extract the bot's token (default:Registry.ExGram)
Examples
ExGram.Token.fetch() # From config :ex_gram, :token
ExGram.Token.fetch(token: "MyToken") # Explicit token
ExGram.Token.fetch(bot: :my_bot) # From Registry.ExGram
ExGram.Token.fetch(bot: :my_bot, registry: OtherRegistry)