| 1 | package telegramscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/ |
| 2 | |
| 3 | import ( |
| 4 | "fmtscip-go gomod github.com/golang/go/src . fmt/" |
| 5 | "htmlscip-go gomod github.com/golang/go/src . html/" |
| 6 | "strconvscip-go gomod github.com/golang/go/src . strconv/" |
| 7 | "stringsscip-go gomod github.com/golang/go/src . strings/" |
| 8 | ) |
| 9 | |
| 10 | // SendMessagePayload is the notification payload for the telegram notification service. |
| 11 | type SendMessagePayloadscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/SendMessagePayload# struct { |
| 12 | Textscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/SendMessagePayload#Text. string `json:"text"` |
| 13 | IDscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/SendMessagePayload#ID. string `json:"chat_id"` |
| 14 | MessageThreadIDscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/SendMessagePayload#MessageThreadID. *int `json:"message_thread_id,omitempty"` |
| 15 | ParseModescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/SendMessagePayload#ParseMode. string `json:"parse_mode,omitempty"` |
| 16 | DisablePreviewscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/SendMessagePayload#DisablePreview. bool `json:"disable_web_page_preview"` |
| 17 | DisableNotificationscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/SendMessagePayload#DisableNotification. bool `json:"disable_notification"` |
| 18 | ReplyMarkupscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/SendMessagePayload#ReplyMarkup. *replyMarkupscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/replyMarkup# `json:"reply_markup,omitempty"` |
| 19 | Entitiesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/SendMessagePayload#Entities. []entityscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/entity# `json:"entities,omitempty"` |
| 20 | ReplyToscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/SendMessagePayload#ReplyTo. int64 `json:"reply_to_message_id"` |
| 21 | MessageIDscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/SendMessagePayload#MessageID. int64 `json:"message_id,omitempty"` |
| 22 | } |
| 23 | |
| 24 | // Message represents one chat message. |
| 25 | type Messagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Message# struct { |
| 26 | MessageIDscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Message#MessageID. int64 `json:"message_id"` |
| 27 | Textscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Message#Text. string `json:"text"` |
| 28 | Fromscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Message#From. *Userscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/User# `json:"from"` |
| 29 | Chatscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Message#Chat. *Chatscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Chat# `json:"chat"` |
| 30 | } |
| 31 | |
| 32 | type messageResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/messageResponse# struct { |
| 33 | OKscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/messageResponse#OK. bool `json:"ok"` |
| 34 | Resultscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/messageResponse#Result. *Messagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Message# `json:"result"` |
| 35 | } |
| 36 | |
| 37 | type responseErrorscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/responseError# struct { |
| 38 | OKscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/responseError#OK. bool `json:"ok"` |
| 39 | ErrorCodescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/responseError#ErrorCode. int `json:"error_code"` |
| 40 | Descriptionscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/responseError#Description. string `json:"description"` |
| 41 | } |
| 42 | |
| 43 | type userResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/userResponse# struct { |
| 44 | OKscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/userResponse#OK. bool `json:"ok"` |
| 45 | Resultscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/userResponse#Result. Userscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/User# `json:"result"` |
| 46 | } |
| 47 | |
| 48 | // User contains information about a telegram user or bot. |
| 49 | type Userscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/User# struct { |
| 50 | // Unique identifier for this User or bot |
| 51 | IDscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/User#ID. int64 `json:"id"` |
| 52 | // True, if this User is a bot |
| 53 | IsBotscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/User#IsBot. bool `json:"is_bot"` |
| 54 | // User's or bot's first name |
| 55 | FirstNamescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/User#FirstName. string `json:"first_name"` |
| 56 | // Optional. User's or bot's last name |
| 57 | LastNamescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/User#LastName. string `json:"last_name"` |
| 58 | // Optional. User's or bot's username |
| 59 | Usernamescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/User#Username. string `json:"username"` |
| 60 | // Optional. IETF language tag of the User's language |
| 61 | LanguageCodescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/User#LanguageCode. string `json:"language_code"` |
| 62 | // Optional. True, if the bot can be invited to groups. Returned only in getMe. |
| 63 | CanJoinGroupsscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/User#CanJoinGroups. bool `json:"can_join_groups"` |
| 64 | // Optional. True, if privacy mode is disabled for the bot. Returned only in getMe. |
| 65 | CanReadAllGroupMessagesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/User#CanReadAllGroupMessages. bool `json:"can_read_all_group_messages"` |
| 66 | // Optional. True, if the bot supports inline queries. Returned only in getMe. |
| 67 | SupportsInlineQueriesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/User#SupportsInlineQueries. bool `json:"supports_inline_queries"` |
| 68 | } |
| 69 | |
| 70 | type updatesRequestscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/updatesRequest# struct { |
| 71 | Offsetscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/updatesRequest#Offset. int `json:"offset"` |
| 72 | Limitscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/updatesRequest#Limit. int `json:"limit"` |
| 73 | Timeoutscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/updatesRequest#Timeout. int `json:"timeout"` |
| 74 | AllowedUpdatesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/updatesRequest#AllowedUpdates. []string `json:"allowed_updates"` |
| 75 | } |
| 76 | |
| 77 | type updatesResponsescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/updatesResponse# struct { |
| 78 | OKscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/updatesResponse#OK. bool `json:"ok"` |
| 79 | Resultscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/updatesResponse#Result. []Updatescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Update# `json:"result"` |
| 80 | } |
| 81 | |
| 82 | type inlineQueryscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/inlineQuery# struct { |
| 83 | // Unique identifier for this query |
| 84 | IDscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/inlineQuery#ID. string `json:"id"` |
| 85 | // Sender |
| 86 | Fromscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/inlineQuery#From. Userscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/User# `json:"from"` |
| 87 | // Text of the query (up to 256 characters) |
| 88 | Queryscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/inlineQuery#Query. string `json:"query"` |
| 89 | // Offset of the results to be returned, can be controlled by the bot |
| 90 | Offsetscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/inlineQuery#Offset. string `json:"offset"` |
| 91 | } |
| 92 | |
| 93 | type chosenInlineResultscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/chosenInlineResult# struct{} |
| 94 | |
| 95 | // Update contains state changes since the previous Update. |
| 96 | type Updatescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Update# struct { |
| 97 | // The Update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if you're using Webhooks, since it allows |
| 98 | // you to ignore repeated updates or to restore the correct Update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next Update will |
| 99 | // be chosen randomly instead of sequentially. |
| 100 | UpdateIDscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Update#UpdateID. int `json:"update_id"` |
| 101 | // Optional. New incoming Message of any kind — text, photo, sticker, etc. |
| 102 | Messagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Update#Message. *Messagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Message# `json:"Message"` |
| 103 | // Optional. New version of a Message that is known to the bot and was edited |
| 104 | EditedMessagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Update#EditedMessage. *Messagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Message# `json:"edited_message"` |
| 105 | // Optional. New incoming channel post of any kind — text, photo, sticker, etc. |
| 106 | ChannelPostscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Update#ChannelPost. *Messagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Message# `json:"channel_post"` |
| 107 | // Optional. New version of a channel post that is known to the bot and was edited |
| 108 | EditedChannelPostscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Update#EditedChannelPost. *Messagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Message# `json:"edited_channel_post"` |
| 109 | // Optional. New incoming inline query |
| 110 | InlineQueryscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Update#InlineQuery. *inlineQueryscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/inlineQuery# `json:"inline_query"` |
| 111 | // // Optional. The result of an inline query that was chosen by a User and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these |
| 112 | // updates for your bot. |
| 113 | ChosenInlineResultscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Update#ChosenInlineResult. *chosenInlineResultscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/chosenInlineResult# `json:"chosen_inline_result"` |
| 114 | //// Optional. New incoming callback query |
| 115 | CallbackQueryscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Update#CallbackQuery. *callbackQueryscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/callbackQuery# `json:"callback_query"` |
| 116 | |
| 117 | // API fields that are not used by the client has been commented out |
| 118 | |
| 119 | //// Optional. New incoming shipping query. Only for invoices with flexible price |
| 120 | // ShippingQuery `json:"shipping_query"` |
| 121 | //// Optional. New incoming pre-checkout query. Contains full information about checkout |
| 122 | // PreCheckoutQuery `json:"pre_checkout_query"` |
| 123 | //// Optional. New poll state. Bots receive only updates about stopped polls and polls, which are sent by the bot |
| 124 | // Poll `json:"poll"` |
| 125 | //// Optional. A User changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself. |
| 126 | // Poll_answer PollAnswer `json:"poll_answer"` |
| 127 | |
| 128 | ChatMemberUpdatescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Update#ChatMemberUpdate. *ChatMemberUpdatescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/ChatMemberUpdate# `json:"my_chat_member"` |
| 129 | } |
| 130 | |
| 131 | // Chat represents a telegram conversation. |
| 132 | type Chatscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Chat# struct { |
| 133 | IDscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Chat#ID. int64 `json:"id"` |
| 134 | Typescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Chat#Type. string `json:"type"` |
| 135 | Titlescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Chat#Title. string `json:"title"` |
| 136 | Usernamescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Chat#Username. string `json:"username"` |
| 137 | } |
| 138 | |
| 139 | type inlineKeyscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/inlineKey# struct { |
| 140 | Textscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/inlineKey#Text. string `json:"text"` |
| 141 | URLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/inlineKey#URL. string `json:"url"` |
| 142 | LoginURLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/inlineKey#LoginURL. string `json:"login_url"` |
| 143 | CallbackDatascip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/inlineKey#CallbackData. string `json:"callback_data"` |
| 144 | SwitchInlineQueryscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/inlineKey#SwitchInlineQuery. string `json:"switch_inline_query"` |
| 145 | SwitchInlineQueryCurrentscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/inlineKey#SwitchInlineQueryCurrent. string `json:"switch_inline_query_current_chat"` |
| 146 | } |
| 147 | |
| 148 | type replyMarkupscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/replyMarkup# struct { |
| 149 | InlineKeyboardscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/replyMarkup#InlineKeyboard. [][]inlineKeyscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/inlineKey# `json:"inline_keyboard,omitempty"` |
| 150 | } |
| 151 | |
| 152 | type entityscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/entity# struct { |
| 153 | Typescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/entity#Type. string `json:"type"` |
| 154 | Offsetscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/entity#Offset. int `json:"offset"` |
| 155 | Lengthscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/entity#Length. int `json:"length"` |
| 156 | } |
| 157 | |
| 158 | type callbackQueryscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/callbackQuery# struct { |
| 159 | IDscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/callbackQuery#ID. string `json:"id"` |
| 160 | Fromscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/callbackQuery#From. *Userscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/User# `json:"from"` |
| 161 | Messagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/callbackQuery#Message. *Messagescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Message# `json:"Message"` |
| 162 | Datascip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/callbackQuery#Data. string `json:"data"` |
| 163 | } |
| 164 | |
| 165 | // ChatMemberUpdate represents a member update in a telegram chat. |
| 166 | type ChatMemberUpdatescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/ChatMemberUpdate# struct { |
| 167 | // Chat the user belongs to |
| 168 | Chatscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/ChatMemberUpdate#Chat. *Chatscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Chat# `json:"chat"` |
| 169 | // Performer of the action, which resulted in the change |
| 170 | Fromscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/ChatMemberUpdate#From. *Userscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/User# `json:"from"` |
| 171 | // Date the change was done in Unix time |
| 172 | Datescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/ChatMemberUpdate#Date. int `json:"date"` |
| 173 | // Previous information about the chat member |
| 174 | OldChatMemberscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/ChatMemberUpdate#OldChatMember. *ChatMemberscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/ChatMember# `json:"old_chat_member"` |
| 175 | // New information about the chat member |
| 176 | NewChatMemberscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/ChatMemberUpdate#NewChatMember. *ChatMemberscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/ChatMember# `json:"new_chat_member"` |
| 177 | // Optional. Chat invite link, which was used by the user to join the chat; for joining by invite link events only. |
| 178 | // invite_link ChatInviteLink |
| 179 | } |
| 180 | |
| 181 | // ChatMember represents the membership state for a user in a telegram chat. |
| 182 | type ChatMemberscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/ChatMember# struct { |
| 183 | // The member's status in the chat |
| 184 | Statusscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/ChatMember#Status. string `json:"status"` |
| 185 | // Information about the user |
| 186 | Userscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/ChatMember#User. *Userscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/User# `json:"user"` |
| 187 | } |
| 188 | |
| 189 | func (e *responseErrorscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/responseError#) Errorscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/responseError#Error().() string { |
| 190 | return e.Descriptionscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/responseError#Description. |
| 191 | } |
| 192 | |
| 193 | // Name returns the name of the channel based on its type. |
| 194 | func (c *Chatscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Chat#) Namescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Chat#Name().() string { |
| 195 | if c.Typescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Chat#Type. == "private" || c.Typescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Chat#Type. == "channel" && c.Usernamescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Chat#Username. != "" { |
| 196 | return "@" + c.Usernamescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Chat#Username. |
| 197 | } |
| 198 | |
| 199 | return c.Titlescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Chat#Title. |
| 200 | } |
| 201 | |
| 202 | func createSendMessagePayloadscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/createSendMessagePayload().(message, channel string, config *Configscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Config#) SendMessagePayloadscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/SendMessagePayload# { |
| 203 | var threadID *int |
| 204 | |
| 205 | chatID, thread, ok := stringsscip-go gomod github.com/golang/go/src . strings/.Cutscip-go gomod github.com/golang/go/src . strings/Cut().(channel, ":") |
| 206 | if ok { |
| 207 | if parsed, err := strconvscip-go gomod github.com/golang/go/src . strconv/.Atoiscip-go gomod github.com/golang/go/src . strconv/Atoi().(thread); err == nil { |
| 208 | threadID = &parsed |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | payload := SendMessagePayloadscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/SendMessagePayload#{ |
| 213 | Textscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/SendMessagePayload#Text.: message, |
| 214 | IDscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/SendMessagePayload#ID.: chatID, |
| 215 | MessageThreadIDscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/SendMessagePayload#MessageThreadID.: threadID, |
| 216 | DisableNotificationscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/SendMessagePayload#DisableNotification.: !config.Notificationscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Config#Notification., |
| 217 | DisablePreviewscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/SendMessagePayload#DisablePreview.: !config.Previewscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Config#Preview., |
| 218 | } |
| 219 | |
| 220 | parseMode := config.ParseModescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Config#ParseMode. |
| 221 | if config.ParseModescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Config#ParseMode. == ParseModesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/ParseModes..Nonescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/parseModeVals#None. && config.Titlescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Config#Title. != "" { |
| 222 | parseMode = ParseModesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/ParseModes..HTMLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/parseModeVals#HTML. |
| 223 | // no parse mode has been provided, treat message as unescaped HTML |
| 224 | message = htmlscip-go gomod github.com/golang/go/src . html/.EscapeStringscip-go gomod github.com/golang/go/src . html/EscapeString().(message) |
| 225 | } |
| 226 | |
| 227 | if parseMode != ParseModesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/ParseModes..Nonescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/parseModeVals#None. { |
| 228 | payload.ParseModescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/SendMessagePayload#ParseMode. = parseMode.Stringscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/parseMode#String().() |
| 229 | } |
| 230 | |
| 231 | // only HTML parse mode is supported for titles |
| 232 | if parseMode == ParseModesscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/ParseModes..HTMLscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/parseModeVals#HTML. { |
| 233 | payload.Textscip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/SendMessagePayload#Text. = fmtscip-go gomod github.com/golang/go/src . fmt/.Sprintfscip-go gomod github.com/golang/go/src . fmt/Sprintf().("<b>%v</b>\n%v", htmlscip-go gomod github.com/golang/go/src . html/.EscapeStringscip-go gomod github.com/golang/go/src . html/EscapeString().(config.Titlescip-go gomod github.com/nicholas-fedor/shoutrrr . `github.com/nicholas-fedor/shoutrrr/pkg/services/chat/telegram`/Config#Title.), message) |
| 234 | } |
| 235 | |
| 236 | return payload |
| 237 | } |