Refactorings

This commit is contained in:
Gleb Sinyavsky 2015-11-20 13:42:26 +03:00
parent a1207f6391
commit 13a8bd025c
8 changed files with 1189 additions and 1199 deletions

View file

@ -10,8 +10,8 @@ import (
// chatID is where to send it, text is the message text.
func NewMessage(chatID int, text string) MessageConfig {
return MessageConfig{
ChatID: chatID,
Text: text,
Chattable: Chattable{ChatID: chatID},
Text: text,
DisableWebPagePreview: false,
ReplyToMessageID: 0,
}
@ -23,7 +23,7 @@ func NewMessage(chatID int, text string) MessageConfig {
// and messageID is the ID of the original message.
func NewForward(chatID int, fromChatID int, messageID int) ForwardConfig {
return ForwardConfig{
ChatID: chatID,
Chattable: Chattable{ChatID: chatID},
FromChatID: fromChatID,
MessageID: messageID,
}
@ -36,7 +36,7 @@ func NewForward(chatID int, fromChatID int, messageID int) ForwardConfig {
// chatID is where to send it, file is a string path to the file, or FileReader or FileBytes.
func NewPhotoUpload(chatID int, file interface{}) PhotoConfig {
return PhotoConfig{
ChatID: chatID,
Chattable: Chattable{ChatID: chatID},
UseExistingPhoto: false,
File: file,
}
@ -48,7 +48,7 @@ func NewPhotoUpload(chatID int, file interface{}) PhotoConfig {
// chatID is where to send it, fileID is the ID of the file already uploaded.
func NewPhotoShare(chatID int, fileID string) PhotoConfig {
return PhotoConfig{
ChatID: chatID,
Chattable: Chattable{ChatID: chatID},
UseExistingPhoto: true,
FileID: fileID,
}
@ -61,7 +61,7 @@ func NewPhotoShare(chatID int, fileID string) PhotoConfig {
// chatID is where to send it, file is a string path to the file, or FileReader or FileBytes.
func NewAudioUpload(chatID int, file interface{}) AudioConfig {
return AudioConfig{
ChatID: chatID,
Chattable: Chattable{ChatID: chatID},
UseExistingAudio: false,
File: file,
}
@ -73,7 +73,7 @@ func NewAudioUpload(chatID int, file interface{}) AudioConfig {
// chatID is where to send it, fileID is the ID of the audio already uploaded.
func NewAudioShare(chatID int, fileID string) AudioConfig {
return AudioConfig{
ChatID: chatID,
Chattable: Chattable{ChatID: chatID},
UseExistingAudio: true,
FileID: fileID,
}
@ -86,7 +86,7 @@ func NewAudioShare(chatID int, fileID string) AudioConfig {
// chatID is where to send it, file is a string path to the file, or FileReader or FileBytes.
func NewDocumentUpload(chatID int, file interface{}) DocumentConfig {
return DocumentConfig{
ChatID: chatID,
Chattable: Chattable{ChatID: chatID},
UseExistingDocument: false,
File: file,
}
@ -98,7 +98,7 @@ func NewDocumentUpload(chatID int, file interface{}) DocumentConfig {
// chatID is where to send it, fileID is the ID of the document already uploaded.
func NewDocumentShare(chatID int, fileID string) DocumentConfig {
return DocumentConfig{
ChatID: chatID,
Chattable: Chattable{ChatID: chatID},
UseExistingDocument: true,
FileID: fileID,
}
@ -110,7 +110,7 @@ func NewDocumentShare(chatID int, fileID string) DocumentConfig {
// chatID is where to send it, file is a string path to the file, or FileReader or FileBytes.
func NewStickerUpload(chatID int, file interface{}) StickerConfig {
return StickerConfig{
ChatID: chatID,
Chattable: Chattable{ChatID: chatID},
UseExistingSticker: false,
File: file,
}
@ -122,7 +122,7 @@ func NewStickerUpload(chatID int, file interface{}) StickerConfig {
// chatID is where to send it, fileID is the ID of the sticker already uploaded.
func NewStickerShare(chatID int, fileID string) StickerConfig {
return StickerConfig{
ChatID: chatID,
Chattable: Chattable{ChatID: chatID},
UseExistingSticker: true,
FileID: fileID,
}
@ -135,7 +135,7 @@ func NewStickerShare(chatID int, fileID string) StickerConfig {
// chatID is where to send it, file is a string path to the file, or FileReader or FileBytes.
func NewVideoUpload(chatID int, file interface{}) VideoConfig {
return VideoConfig{
ChatID: chatID,
Chattable: Chattable{ChatID: chatID},
UseExistingVideo: false,
File: file,
}
@ -147,7 +147,7 @@ func NewVideoUpload(chatID int, file interface{}) VideoConfig {
// chatID is where to send it, fileID is the ID of the video already uploaded.
func NewVideoShare(chatID int, fileID string) VideoConfig {
return VideoConfig{
ChatID: chatID,
Chattable: Chattable{ChatID: chatID},
UseExistingVideo: true,
FileID: fileID,
}
@ -160,7 +160,7 @@ func NewVideoShare(chatID int, fileID string) VideoConfig {
// chatID is where to send it, file is a string path to the file, or FileReader or FileBytes.
func NewVoiceUpload(chatID int, file interface{}) VoiceConfig {
return VoiceConfig{
ChatID: chatID,
Chattable: Chattable{ChatID: chatID},
UseExistingVoice: false,
File: file,
}
@ -172,7 +172,7 @@ func NewVoiceUpload(chatID int, file interface{}) VoiceConfig {
// chatID is where to send it, fileID is the ID of the video already uploaded.
func NewVoiceShare(chatID int, fileID string) VoiceConfig {
return VoiceConfig{
ChatID: chatID,
Chattable: Chattable{ChatID: chatID},
UseExistingVoice: true,
FileID: fileID,
}
@ -184,7 +184,7 @@ func NewVoiceShare(chatID int, fileID string) VoiceConfig {
// chatID is where to send it, latitude and longitude are coordinates.
func NewLocation(chatID int, latitude float64, longitude float64) LocationConfig {
return LocationConfig{
ChatID: chatID,
Chattable: Chattable{ChatID: chatID},
Latitude: latitude,
Longitude: longitude,
ReplyToMessageID: 0,
@ -198,8 +198,8 @@ func NewLocation(chatID int, latitude float64, longitude float64) LocationConfig
// chatID is where to send it, action should be set via CHAT constants.
func NewChatAction(chatID int, action string) ChatActionConfig {
return ChatActionConfig{
ChatID: chatID,
Action: action,
Chattable: Chattable{ChatID: chatID},
Action: action,
}
}