From d8ba9c84c817ae4f7eccb12c98fc764cf8c966f8 Mon Sep 17 00:00:00 2001 From: Gleb Sinyavsky Date: Fri, 20 Nov 2015 15:01:05 +0300 Subject: [PATCH] Refactoring --- bot.go | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/bot.go b/bot.go index 17d18af..351dfbd 100644 --- a/bot.go +++ b/bot.go @@ -89,6 +89,9 @@ func (bot *BotAPI) MakeMessageRequest(endpoint string, params url.Values) (Messa var message Message json.Unmarshal(resp.Result, &message) + + bot.DebugLog(endpoint, params, message) + return message, nil } @@ -189,7 +192,6 @@ func (bot *BotAPI) Send(c Chattable) error { return nil } - func (bot *BotAPI) DebugLog(context string, v url.Values, message interface{}) { if bot.Debug { log.Printf("%s req : %+v\n", context, v) @@ -214,8 +216,6 @@ func (bot *BotAPI) SendMessage(config MessageConfig) (Message, error) { return Message{}, err } - bot.DebugLog("SendMessage", v, message) - return message, nil } @@ -230,8 +230,6 @@ func (bot *BotAPI) ForwardMessage(config ForwardConfig) (Message, error) { return Message{}, err } - bot.DebugLog("ForwardMessage", v, message) - return message, nil } @@ -253,8 +251,6 @@ func (bot *BotAPI) SendPhoto(config PhotoConfig) (Message, error) { return Message{}, err } - bot.DebugLog("SendPhoto", v, message) - return message, nil } @@ -324,9 +320,6 @@ func (bot *BotAPI) SendAudio(config AudioConfig) (Message, error) { return Message{}, err } - - bot.DebugLog("SendAudio", v, message) - return message, nil } @@ -397,8 +390,6 @@ func (bot *BotAPI) SendDocument(config DocumentConfig) (Message, error) { return Message{}, err } - bot.DebugLog("SendDocument", v, message) - return message, nil } @@ -462,8 +453,6 @@ func (bot *BotAPI) SendVoice(config VoiceConfig) (Message, error) { return Message{}, err } - bot.DebugLog("SendVoice", v, message) - return message, nil } @@ -528,8 +517,6 @@ func (bot *BotAPI) SendSticker(config StickerConfig) (Message, error) { return Message{}, err } - bot.DebugLog("SendSticker", v, message) - return message, nil } @@ -591,8 +578,6 @@ func (bot *BotAPI) SendVideo(config VideoConfig) (Message, error) { return Message{}, err } - bot.DebugLog("SendVideo", v, message) - return message, nil } @@ -652,8 +637,6 @@ func (bot *BotAPI) SendLocation(config LocationConfig) (Message, error) { return Message{}, err } - bot.DebugLog("SendLocation", v, message) - return message, nil }