Skip to content

Commit 10fbde9

Browse files
committed
boost: refactor
1 parent 1acc928 commit 10fbde9

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

boost.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ func (c *Boost) ExpirationDate() time.Time {
3636
type BoostSourceType = string
3737

3838
const (
39-
BoostPremium = "premium"
40-
BoostGiftCode = "gift_code"
41-
BoostGiveaway = "giveaway"
39+
BoostPremium BoostSourceType = "premium"
40+
BoostGiftCode BoostSourceType = "gift_code"
41+
BoostGiveaway BoostSourceType = "giveaway"
4242
)
4343

4444
// BoostSource describes the source of a chat boost.

context.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ type Context interface {
5555
// Topic returns the topic changes.
5656
Topic() *Topic
5757

58+
// Boost returns the boost instance.
59+
Boost() *BoostUpdated
60+
61+
// BoostRemoved returns the boost removed from a chat instance.
62+
BoostRemoved() *BoostRemoved
63+
5864
// Sender returns the current recipient, depending on the context type.
5965
// Returns nil if user is not presented.
6066
Sender() *User
@@ -158,12 +164,6 @@ type Context interface {
158164
// RespondAlert sends an alert response for the current callback query.
159165
RespondAlert(text string) error
160166

161-
// Boost returns the boost instance.
162-
Boost() *BoostUpdated
163-
164-
// BoostRemoved returns the boost removed from a chat instance.
165-
BoostRemoved() *BoostRemoved
166-
167167
// Get retrieves data from the context.
168168
Get(key string) interface{}
169169

@@ -184,14 +184,6 @@ func (c *nativeContext) Bot() *Bot {
184184
return c.b
185185
}
186186

187-
func (c *nativeContext) Boost() *BoostUpdated {
188-
return c.u.Boost
189-
}
190-
191-
func (c *nativeContext) BoostRemoved() *BoostRemoved {
192-
return c.u.BoostRemoved
193-
}
194-
195187
func (c *nativeContext) Update() Update {
196188
return c.u
197189
}
@@ -279,6 +271,14 @@ func (c *nativeContext) Topic() *Topic {
279271
return nil
280272
}
281273

274+
func (c *nativeContext) Boost() *BoostUpdated {
275+
return c.u.Boost
276+
}
277+
278+
func (c *nativeContext) BoostRemoved() *BoostRemoved {
279+
return c.u.BoostRemoved
280+
}
281+
282282
func (c *nativeContext) Sender() *User {
283283
switch {
284284
case c.u.Callback != nil:

0 commit comments

Comments
 (0)