move gotd fork into repo. (#111)
- update to latest telegram layer - remove some references to fields in tg.Entities that don't exist in the schema - originally added here: https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e - referenced here - https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3 - https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
package inline
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"go.mau.fi/mautrix-telegram/pkg/gotd/telegram/message/markup"
|
||||
"go.mau.fi/mautrix-telegram/pkg/gotd/tg"
|
||||
)
|
||||
|
||||
// MessageMediaGeoBuilder is a builder of inline result geo message.
|
||||
type MessageMediaGeoBuilder struct {
|
||||
message *tg.InputBotInlineMessageMediaGeo
|
||||
}
|
||||
|
||||
// nolint:unparam
|
||||
func (b *MessageMediaGeoBuilder) apply() (tg.InputBotInlineMessageClass, error) {
|
||||
r := *b.message
|
||||
return &r, nil
|
||||
}
|
||||
|
||||
// MessageGeo creates new message geo option builder.
|
||||
func MessageGeo(point tg.InputGeoPointClass) *MessageMediaGeoBuilder {
|
||||
return &MessageMediaGeoBuilder{
|
||||
message: &tg.InputBotInlineMessageMediaGeo{
|
||||
GeoPoint: point,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// Heading sets for live locations¹, a direction in which the location moves, in degrees; 1-360.
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/live-location
|
||||
func (b *MessageMediaGeoBuilder) Heading(heading int) *MessageMediaGeoBuilder {
|
||||
b.message.Heading = heading
|
||||
return b
|
||||
}
|
||||
|
||||
// Period sets validity period.
|
||||
func (b *MessageMediaGeoBuilder) Period(dur time.Duration) *MessageMediaGeoBuilder {
|
||||
return b.PeriodSeconds(int(dur.Seconds()))
|
||||
}
|
||||
|
||||
// PeriodSeconds sets validity period in seconds.
|
||||
func (b *MessageMediaGeoBuilder) PeriodSeconds(period int) *MessageMediaGeoBuilder {
|
||||
b.message.Period = period
|
||||
return b
|
||||
}
|
||||
|
||||
// ProximityNotificationRadius sets for live locations¹, a maximum distance to another chat member for proximity
|
||||
// alerts, in meters (0-100000)
|
||||
//
|
||||
// Links:
|
||||
// 1. https://core.telegram.org/api/live-location
|
||||
func (b *MessageMediaGeoBuilder) ProximityNotificationRadius(radius int) *MessageMediaGeoBuilder {
|
||||
b.message.ProximityNotificationRadius = radius
|
||||
return b
|
||||
}
|
||||
|
||||
// Markup sets reply markup for sending bot buttons.
|
||||
// NB: markup will not be used, if you send multiple media attachments.
|
||||
func (b *MessageMediaGeoBuilder) Markup(m tg.ReplyMarkupClass) *MessageMediaGeoBuilder {
|
||||
b.message.ReplyMarkup = m
|
||||
return b
|
||||
}
|
||||
|
||||
// Row sets single row keyboard markup for sending bot buttons.
|
||||
// NB: markup will not be used, if you send multiple media attachments.
|
||||
func (b *MessageMediaGeoBuilder) Row(buttons ...tg.KeyboardButtonClass) *MessageMediaGeoBuilder {
|
||||
return b.Markup(markup.InlineRow(buttons...))
|
||||
}
|
||||
Reference in New Issue
Block a user