Refactoring

bot-api-6.1
Gleb Sinyavsky 2015-11-20 15:01:05 +03:00
parent 92ce2aad94
commit d8ba9c84c8
1 changed files with 3 additions and 20 deletions

23
bot.go
View File

@ -89,6 +89,9 @@ func (bot *BotAPI) MakeMessageRequest(endpoint string, params url.Values) (Messa
var message Message var message Message
json.Unmarshal(resp.Result, &message) json.Unmarshal(resp.Result, &message)
bot.DebugLog(endpoint, params, message)
return message, nil return message, nil
} }
@ -189,7 +192,6 @@ func (bot *BotAPI) Send(c Chattable) error {
return nil return nil
} }
func (bot *BotAPI) DebugLog(context string, v url.Values, message interface{}) { func (bot *BotAPI) DebugLog(context string, v url.Values, message interface{}) {
if bot.Debug { if bot.Debug {
log.Printf("%s req : %+v\n", context, v) log.Printf("%s req : %+v\n", context, v)
@ -214,8 +216,6 @@ func (bot *BotAPI) SendMessage(config MessageConfig) (Message, error) {
return Message{}, err return Message{}, err
} }
bot.DebugLog("SendMessage", v, message)
return message, nil return message, nil
} }
@ -230,8 +230,6 @@ func (bot *BotAPI) ForwardMessage(config ForwardConfig) (Message, error) {
return Message{}, err return Message{}, err
} }
bot.DebugLog("ForwardMessage", v, message)
return message, nil return message, nil
} }
@ -253,8 +251,6 @@ func (bot *BotAPI) SendPhoto(config PhotoConfig) (Message, error) {
return Message{}, err return Message{}, err
} }
bot.DebugLog("SendPhoto", v, message)
return message, nil return message, nil
} }
@ -324,9 +320,6 @@ func (bot *BotAPI) SendAudio(config AudioConfig) (Message, error) {
return Message{}, err return Message{}, err
} }
bot.DebugLog("SendAudio", v, message)
return message, nil return message, nil
} }
@ -397,8 +390,6 @@ func (bot *BotAPI) SendDocument(config DocumentConfig) (Message, error) {
return Message{}, err return Message{}, err
} }
bot.DebugLog("SendDocument", v, message)
return message, nil return message, nil
} }
@ -462,8 +453,6 @@ func (bot *BotAPI) SendVoice(config VoiceConfig) (Message, error) {
return Message{}, err return Message{}, err
} }
bot.DebugLog("SendVoice", v, message)
return message, nil return message, nil
} }
@ -528,8 +517,6 @@ func (bot *BotAPI) SendSticker(config StickerConfig) (Message, error) {
return Message{}, err return Message{}, err
} }
bot.DebugLog("SendSticker", v, message)
return message, nil return message, nil
} }
@ -591,8 +578,6 @@ func (bot *BotAPI) SendVideo(config VideoConfig) (Message, error) {
return Message{}, err return Message{}, err
} }
bot.DebugLog("SendVideo", v, message)
return message, nil return message, nil
} }
@ -652,8 +637,6 @@ func (bot *BotAPI) SendLocation(config LocationConfig) (Message, error) {
return Message{}, err return Message{}, err
} }
bot.DebugLog("SendLocation", v, message)
return message, nil return message, nil
} }