diff --git a/api/v1/system_setting.go b/api/v1/system_setting.go index 4d2c5dcec..5c4527c6a 100644 --- a/api/v1/system_setting.go +++ b/api/v1/system_setting.go @@ -36,7 +36,7 @@ const ( SystemSettingStorageServiceIDName SystemSettingName = "storage-service-id" // SystemSettingLocalStoragePathName is the name of local storage path. SystemSettingLocalStoragePathName SystemSettingName = "local-storage-path" - // SystemSettingTelegramBotToken is the name of Telegram Bot Token. + // SystemSettingTelegramBotTokenName is the name of Telegram Bot Token. SystemSettingTelegramBotTokenName SystemSettingName = "telegram-bot-token" // SystemSettingMemoDisplayWithUpdatedTsName is the name of memo display with updated ts. SystemSettingMemoDisplayWithUpdatedTsName SystemSettingName = "memo-display-with-updated-ts" diff --git a/api/v1/user_setting.go b/api/v1/user_setting.go index 0ba1dd32a..15c3086ce 100644 --- a/api/v1/user_setting.go +++ b/api/v1/user_setting.go @@ -20,7 +20,7 @@ const ( UserSettingAppearanceKey UserSettingKey = "appearance" // UserSettingMemoVisibilityKey is the key type for user preference memo default visibility. UserSettingMemoVisibilityKey UserSettingKey = "memo-visibility" - // UserSettingTelegramUserID is the key type for telegram UserID of memos user. + // UserSettingTelegramUserIDKey is the key type for telegram UserID of memos user. UserSettingTelegramUserIDKey UserSettingKey = "telegram-user-id" ) diff --git a/docker-compose.dev.yaml b/docker-compose.dev.yaml index e3675cbb6..867e0f3fd 100644 --- a/docker-compose.dev.yaml +++ b/docker-compose.dev.yaml @@ -1,6 +1,6 @@ # 1.Prepare your workspace by: -# docker compose run api go install github.com/cosmtrek/air@latest -# docker compose run web npm install +# docker compose -f docker-compose.dev.yaml run api go install github.com/cosmtrek/air@latest +# docker compose -f docker-compose.dev.yaml run web npm install # # 2. Start you work by: # docker compose up -d diff --git a/plugin/telegram/bot.go b/plugin/telegram/bot.go index fb7d2f332..953c44a13 100644 --- a/plugin/telegram/bot.go +++ b/plugin/telegram/bot.go @@ -29,7 +29,7 @@ func NewBotWithHandler(h Handler) *Bot { const noTokenWait = 30 * time.Second const errRetryWait = 10 * time.Second -// Start start an infinity call of getUpdates from Telegram, call r.MessageHandle while get new message updates. +// Start start a long polling using getUpdates to get Update, call r.MessageHandle while get new message updates. func (b *Bot) Start(ctx context.Context) { var offset int diff --git a/plugin/telegram/callback_query.go b/plugin/telegram/callback_query.go index a25ec3f7a..9251fab4e 100644 --- a/plugin/telegram/callback_query.go +++ b/plugin/telegram/callback_query.go @@ -1,5 +1,7 @@ package telegram +// CallbackQuery represents an incoming callback query from a callback button in +// an inline keyboard (PUBLIC, PROTECTED, PRIVATE). type CallbackQuery struct { ID string `json:"id"` From User `json:"from"` diff --git a/plugin/telegram/message.go b/plugin/telegram/message.go index 70f3ba684..6ed0bb89b 100644 --- a/plugin/telegram/message.go +++ b/plugin/telegram/message.go @@ -14,13 +14,13 @@ type Message struct { Photo []PhotoSize `json:"photo"` // Photo message is a photo, available sizes of the photo; Caption *string `json:"caption"` // Caption for the animation, audio, document, photo, video or voice, 0-1024 characters; Entities []MessageEntity `json:"entities"` // Entities are for text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text; - CaptionEntities []MessageEntity `json:"caption_entities"` - Document *Document `json:"document"` // Document message is a general file, information about the file; - Video *Video `json:"video"` // Video message is a video, information about the video; - VideoNote *VideoNote `json:"video_note"` // VideoNote message is a video note, information about the video message; - Voice *Voice `json:"voice"` // Voice message is a voice message, information about the file; - Audio *Audio `json:"audio"` // Audio message is an audio file, information about the file; - Animation *Animation `json:"animation"` // Animation message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set; + CaptionEntities []MessageEntity `json:"caption_entities"` // CaptionEntities are for messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption; + Document *Document `json:"document"` // Document message is a general file, information about the file; + Video *Video `json:"video"` // Video message is a video, information about the video; + VideoNote *VideoNote `json:"video_note"` // VideoNote message is a video note, information about the video message; + Voice *Voice `json:"voice"` // Voice message is a voice message, information about the file; + Audio *Audio `json:"audio"` // Audio message is an audio file, information about the file; + Animation *Animation `json:"animation"` // Animation message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set; } func (m Message) GetMaxPhotoFileID() string { diff --git a/store/user_setting.go b/store/user_setting.go index bd6e38a68..f577918bc 100644 --- a/store/user_setting.go +++ b/store/user_setting.go @@ -48,7 +48,7 @@ func (s *Store) ListUserSettings(ctx context.Context, find *FindUserSetting) ([] query := ` SELECT user_id, - key, + key, value FROM user_setting WHERE ` + strings.Join(where, " AND ")