go fmt
parent
5859ba3970
commit
d638757359
12
bot.go
12
bot.go
|
@ -13,16 +13,16 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// BotAPI has methods for interacting with all of Telegram's Bot API endpoints.
|
// BotAPI has methods for interacting with all of Telegram's Bot API endpoints.
|
||||||
type BotAPI struct {
|
type BotAPI struct {
|
||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
Debug bool `json:"debug"`
|
Debug bool `json:"debug"`
|
||||||
Self User `json:"-"`
|
Self User `json:"-"`
|
||||||
Client *http.Client `json:"-"`
|
Client *http.Client `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewBotAPI creates a new BotAPI instance.
|
// NewBotAPI creates a new BotAPI instance.
|
||||||
|
@ -198,7 +198,7 @@ func (bot *BotAPI) GetMe() (User, error) {
|
||||||
return user, nil
|
return user, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bot *BotAPI) IsMessageToMe(message Message) (bool) {
|
func (bot *BotAPI) IsMessageToMe(message Message) bool {
|
||||||
return strings.Contains(message.Text, "@"+bot.Self.UserName)
|
return strings.Contains(message.Text, "@"+bot.Self.UserName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
types.go
2
types.go
|
@ -3,8 +3,8 @@ package tgbotapi
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// APIResponse is a response from the Telegram API with the result stored raw.
|
// APIResponse is a response from the Telegram API with the result stored raw.
|
||||||
|
|
Loading…
Reference in New Issue