Telegram Webhookによるボット操作機能を追加(課題の追加・完了・一覧・スヌーズ対応)

This commit is contained in:
2026-06-07 12:04:47 +09:00
parent c7f4c40964
commit bd600c24c9
10 changed files with 812 additions and 20 deletions

View File

@@ -18,7 +18,8 @@ type DatabaseConfig struct {
}
type NotificationConfig struct {
TelegramBotToken string
TelegramBotToken string
TelegramWebhookSecret string
}
type CaptchaConfig struct {
@@ -146,6 +147,9 @@ func Load(configPath string) *Config {
if section.HasKey("telegram_bot_token") {
cfg.Notification.TelegramBotToken = section.Key("telegram_bot_token").String()
}
if section.HasKey("telegram_webhook_secret") {
cfg.Notification.TelegramWebhookSecret = section.Key("telegram_webhook_secret").String()
}
// Captcha section
section = iniFile.Section("captcha")
@@ -210,6 +214,9 @@ func Load(configPath string) *Config {
if telegramToken := os.Getenv("TELEGRAM_BOT_TOKEN"); telegramToken != "" {
cfg.Notification.TelegramBotToken = telegramToken
}
if webhookSecret := os.Getenv("TELEGRAM_WEBHOOK_SECRET"); webhookSecret != "" {
cfg.Notification.TelegramWebhookSecret = webhookSecret
}
if captchaEnabled := os.Getenv("CAPTCHA_ENABLED"); captchaEnabled != "" {
cfg.Captcha.Enabled = captchaEnabled == "true" || captchaEnabled == "1"
}