Skip to content

Commit 8b69e47

Browse files
committed
telebot: refactor bot api 7.5
1 parent 6713166 commit 8b69e47

File tree

3 files changed

+33
-32
lines changed

3 files changed

+33
-32
lines changed

bot.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1255,7 +1255,7 @@ func (b *Bot) MyShortDescription(language string) (*BotInfo, error) {
12551255
return b.botInfo(language, "getMyShortDescription")
12561256
}
12571257

1258-
func (b *Bot) GetStarTransactions(offset, limit int) ([]StarTransaction, error) {
1258+
func (b *Bot) StarTransactions(offset, limit int) ([]StarTransaction, error) {
12591259
params := map[string]int{
12601260
"offset": offset,
12611261
"limit": limit,

media.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ type Location struct {
363363

364364
// (Optional) Unique identifier of the business connection
365365
// on behalf of which the message to be edited was sent
366-
BusinessConnectionID string `json:"business_connection_id"`
366+
BusinessConnectionID string `json:"business_connection_id,omitempty"`
367367
}
368368

369369
// Venue object represents a venue location with name, address and

stars.go

+31-30
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import "time"
55
type TransactionType = string
66

77
const (
8-
TransactionTypeFragment TransactionType = "fragment"
98
TransactionTypeUser TransactionType = "user"
10-
TransactionTypeOther TransactionType = "other"
9+
TransactionTypeFragment TransactionType = "fragment"
1110
TransactionPartnerTelegramAds TransactionType = "telegram_ads"
11+
TransactionTypeOther TransactionType = "other"
1212
)
1313

1414
type RevenueState = string
@@ -19,33 +19,8 @@ const (
1919
RevenueStateFailed RevenueState = "failed"
2020
)
2121

22-
type TransactionPartner struct {
23-
// Type of the state
24-
Type TransactionType `json:"type"`
25-
26-
// (Optional) State of the transaction if the transaction is outgoing$$
27-
WithdrawalState RevenueWithdrawalState `json:"withdrawal_state,omitempty"`
28-
29-
// Information about the user
30-
Partner *User `json:"user,omitempty"`
31-
32-
// (Optional) Bot-specified invoice payload
33-
InvoicePayload string `json:"invoice_payload"`
34-
}
35-
36-
type RevenueWithdrawalState struct {
37-
// Type of the state
38-
Type RevenueState `json:"type"`
39-
40-
// Date the withdrawal was completed in Unix time
41-
Date int `json:"date,omitempty"`
42-
43-
// An HTTPS URL that can be used to see transaction details
44-
URL string `json:"url,omitempty"`
45-
}
46-
4722
type StarTransaction struct {
48-
// Unique identifier of the transaction. Coincides with the identifer of the
23+
// Unique identifier of the transaction. Coincides with the identifier of the
4924
// original transaction for refund transactions. Coincides with
5025
// SuccessfulPayment.telegram_payment_charge_id for successful incoming
5126
// payments from users.
@@ -66,7 +41,33 @@ type StarTransaction struct {
6641
Receiver TransactionPartner `json:"receiver"`
6742
}
6843

69-
// Date returns the local datetime.
70-
func (c *StarTransaction) Date() time.Time {
44+
type TransactionPartner struct {
45+
// Type of the state
46+
Type TransactionType `json:"type"`
47+
User *User `json:"user,omitempty"`
48+
Payload string `json:"invoice_payload"`
49+
50+
// (Optional) State of the transaction if the transaction is outgoing$$
51+
Withdrawal RevenueWithdrawal `json:"withdrawal_state,omitempty"`
52+
}
53+
54+
type RevenueWithdrawal struct {
55+
// Type of the state
56+
Type RevenueState `json:"type"`
57+
58+
// Date the withdrawal was completed in Unix time
59+
Unixtime int `json:"date,omitempty"`
60+
61+
// An HTTPS URL that can be used to see transaction details
62+
URL string `json:"url,omitempty"`
63+
}
64+
65+
// Time returns the date of the transaction.
66+
func (c *StarTransaction) Time() time.Time {
7167
return time.Unix(c.Unixtime, 0)
7268
}
69+
70+
// Time returns the date of the withdrawal.
71+
func (s *RevenueWithdrawal) Time() time.Time {
72+
return time.Unix(int64(s.Unixtime), 0)
73+
}

0 commit comments

Comments
 (0)