1use serde::{Deserialize, Serialize};
4use std::fmt;
5
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
8#[serde(rename_all = "lowercase")]
9pub enum ChannelType {
10 Telegram,
12 Discord,
14}
15
16impl ChannelType {
17 pub const VARIANTS: &[Self] = &[Self::Telegram, Self::Discord];
19
20 pub fn token_hint(self) -> &'static str {
22 match self {
23 Self::Telegram => "https://core.telegram.org/bots#botfather",
24 Self::Discord => "https://discord.com/developers/applications",
25 }
26 }
27}
28
29impl fmt::Display for ChannelType {
30 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
31 match self {
32 Self::Telegram => f.write_str("Telegram"),
33 Self::Discord => f.write_str("Discord"),
34 }
35 }
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize)]
40pub struct TelegramConfig {
41 pub token: String,
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize)]
47pub struct DiscordConfig {
48 pub token: String,
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize, Default)]
56pub struct ChannelConfig {
57 pub telegram: Option<TelegramConfig>,
59 pub discord: Option<DiscordConfig>,
61}