Struct telecord::Config [] [src]

pub struct Config { /* fields omitted */ }

The Config type contains four values, the Discord Bot's Token, the Telegram Bot's token, a HashMap for quickly getting a Telegram Chat ID from a Discord Channel ID, and a HashMap for quickly getting a Discord Channel ID from a Telegram Chat ID.

Methods

impl Config
[src]

[src]

The new function is what actually accesses the environment to read in the required values.

The CHAT_MAPPINGS environment variable is read as a comma-separated list of colon-separated tuples, where the first element of each tuple is a Telegram Chat ID and the second argument of each tuple is a Discord Channel ID.

For example, CHAT_MAPPINGS=1234:abcd,5678:efgh would map the Telegram Chat 1234 to the Discord Channel abcd and would also map the Telegram Chat 5678 to the Discord Channel efgh.

The DISCORD_BOT_TOKEN and TELEGRAM_BOT_TOKEN environment variables are self-explanatory.

If any of the required environment variables are not set, this function will panic. Since this is intended to be the first function an application runs, this should not cause issues. Either the config will be correct, or the application will not attempt to deal with missing configuration options.

[src]

Returns the Discord Bot Token

[src]

Returns the Telegram Bot Token

[src]

Retrieves the Telegram Chat ID that corresponds to the given Discord Channel ID.

[src]

Retrieves the Discord Channel ID that corresponds to the given Telegram Chat ID.

Trait Implementations

impl Debug for Config
[src]

[src]

Formats the value using the given formatter.

impl Clone for Config
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more