chore: minor cleanup (#2124)

This commit is contained in:
YuNing Chen 2023-08-11 22:34:08 +08:00 committed by GitHub
parent c835231d32
commit 409d686f7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 13 deletions

View file

@ -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"

View file

@ -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"
)

View file

@ -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

View file

@ -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

View file

@ -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"`

View file

@ -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 {

View file

@ -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 ")