small fixes, go.{mod,sum}

pull/216/head
Ian Byrd 5 years ago
parent 85ee746b3c
commit 42933c1912

3
.gitignore vendored

@ -23,4 +23,5 @@ _testmain.go
*.test
*.prof
/.idea
.idea
.DS_Store

@ -668,7 +668,6 @@ func (b *Bot) Forward(to Recipient, what *Message, options ...interface{}) (*Mes
//
func (b *Bot) Edit(message Editable, what interface{}, options ...interface{}) (*Message, error) {
messageID, chatID := message.MessageSig()
// TODO: add support for inline messages (chatID = 0)
params := map[string]string{}

@ -34,9 +34,6 @@ type Chat struct {
// Recipient returns chat ID (see Recipient interface).
func (c *Chat) Recipient() string {
if c.Type == ChatChannel {
return "@" + c.Username
}
return strconv.FormatInt(c.ID, 10)
}

@ -0,0 +1,5 @@
module github.com/tucnak/telebot
go 1.12
require github.com/pkg/errors v0.8.1

@ -0,0 +1 @@
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=

@ -3,17 +3,26 @@ package telebot
import (
"encoding/json"
"strconv"
"log"
"github.com/pkg/errors"
)
func (b *Bot) debug(err error) {
err = errors.WithStack(err)
if b.reporter != nil {
b.reporter(errors.WithStack(err))
b.reporter(err)
} else {
log.Printf("%+v\n", err)
}
}
func (b *Bot) deferDebug() {
if b.reporter == nil {
return
}
if r := recover(); r != nil {
if err, ok := r.(error); ok {
b.debug(err)

Loading…
Cancel
Save