mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
feat: implement telegram bot plugin (#1740)
This commit is contained in:
24
plugin/telegram/message.go
Normal file
24
plugin/telegram/message.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package telegram
|
||||
|
||||
type Message struct {
|
||||
MessageID int `json:"message_id"`
|
||||
From User `json:"from"`
|
||||
Date int `json:"date"`
|
||||
Text *string `json:"text"`
|
||||
Chat *Chat `json:"chat"`
|
||||
MediaGroupID *string `json:"media_group_id"`
|
||||
Photo []PhotoSize `json:"photo"`
|
||||
Caption *string `json:"caption"`
|
||||
}
|
||||
|
||||
func (m Message) GetMaxPhotoFileID() string {
|
||||
var fileSize int64
|
||||
var photoSize PhotoSize
|
||||
for _, p := range m.Photo {
|
||||
if p.FileSize > fileSize {
|
||||
photoSize = p
|
||||
}
|
||||
}
|
||||
|
||||
return photoSize.FileID
|
||||
}
|
Reference in New Issue
Block a user