WIP Telegram: modulo akode-telegram (API e impostazioni), in pausa

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-12 08:21:25 +01:00
parent 9636b74c7d
commit 28bddb1b0c
41 changed files with 4216 additions and 4 deletions

View File

@@ -555,6 +555,9 @@ pub struct ConfigToml {
/// Release source and startup check for `akode update`.
pub update: Option<UpdateConfigToml>,
/// Telegram control of running sessions.
pub telegram: Option<crate::types::TelegramConfigToml>,
/// Settings for app-specific controls.
#[serde(default)]
pub apps: Option<AppsConfigToml>,

View File

@@ -251,6 +251,34 @@ pub struct UpdateConfigToml {
pub check_on_startup: Option<bool>,
}
/// `[telegram]`: control of running sessions from the user's Telegram bot.
/// The bot token is never stored here: it lives in the key store under `telegram-bot`.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default, JsonSchema)]
#[schemars(deny_unknown_fields)]
pub struct TelegramConfigToml {
/// When `true`, the shared app-server serves the bot. Defaults to `false`: nothing
/// contacts Telegram while disabled.
pub enabled: Option<bool>,
/// Chats served by the bot (added by pairing in `/telegram`). Others are ignored.
pub allowed_chat_ids: Option<Vec<i64>>,
/// Which events are sent to Telegram. Every level defaults to `true`.
pub notify: Option<TelegramNotifyToml>,
}
/// `[telegram.notify]`: which events reach Telegram.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default, JsonSchema)]
#[schemars(deny_unknown_fields)]
pub struct TelegramNotifyToml {
/// Approval requests with inline buttons.
pub approvals: Option<bool>,
/// A short summary when a turn ends.
pub turn_end: Option<bool>,
/// Errors and rate-limit (429) notices.
pub errors: Option<bool>,
/// Stops of the repeated-failure guard.
pub loops: Option<bool>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default, JsonSchema)]
#[schemars(deny_unknown_fields)]
pub struct FeedbackConfigToml {