diff --git a/new_bot.go b/new_bot.go new file mode 100644 index 0000000..a71a0d0 --- /dev/null +++ b/new_bot.go @@ -0,0 +1,13 @@ +package telegram + +type Bot struct { + AccessToken string + Self *User +} + +func NewBot(accessToken string) (*Bot, error) { + var err error + bot := &Bot{AccessToken: accessToken} + bot.Self, err = bot.GetMe() + return bot, err +} diff --git a/telegram.go b/telegram.go index e7c0fdb..fc2ab95 100644 --- a/telegram.go +++ b/telegram.go @@ -14,22 +14,8 @@ const ( StyleMarkdown = "markdown" StyleHTML = "html" - - errorInt64OrString = "use only int64 or string" ) -type Bot struct { - AccessToken string - Self *User -} - -func NewBot(accessToken string) (*Bot, error) { - var err error - bot := &Bot{AccessToken: accessToken} - bot.Self, err = bot.GetMe() - return bot, err -} - func (bot *Bot) request(dst []byte, method string, args *http.Args) (*Response, error) { method = fmt.Sprintf(APIEndpoint, bot.AccessToken, method) _, body, err := http.Post(dst, method, args)