Skip to content

Commit

Permalink
Merge pull request tucnak#19 from superhacker777/master
Browse files Browse the repository at this point in the history
Code bloating fixes, typo away
  • Loading branch information
tucnak committed Oct 14, 2015
2 parents 1601444 + faeff79 commit 62ade91
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 28 deletions.
6 changes: 1 addition & 5 deletions file.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@ func NewFile(path string) (File, error) {

// Exists says whether the file presents on Telegram servers or not.
func (f File) Exists() bool {
if f.FileID != "" {
return true
}

return false
return f.FileID != ""
}

// Local returns location of file on local file system, if it's
Expand Down
20 changes: 4 additions & 16 deletions message.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ type Message struct {

// Origin returns an origin of message: group chat / personal.
func (m Message) Origin() User {
if (m.Chat != User{}) {
if m.IsPersonal() {
return m.Chat
}

Expand All @@ -110,30 +110,18 @@ func (m Message) Time() time.Time {
// IsForwarded says whether message is forwarded copy of another
// message or not.
func (m Message) IsForwarded() bool {
if (m.OriginalSender != User{}) {
return true
}

return false
return m.OriginalSender != User{}
}

// IsReply says whether message is reply to another message or not.
func (m Message) IsReply() bool {
if m.ReplyTo != nil {
return true
}

return false
return m.ReplyTo != nil
}

// IsPersonal returns true, if message is a personal message,
// returns false if sent to group chat.
func (m Message) IsPersonal() bool {
if (m.Chat != User{}) {
return true
}

return false
return m.Chat != User{}
}

// IsService returns true, if message is a service message,
Expand Down
4 changes: 2 additions & 2 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type ParseMode string

// Supported ParseMode
const (
ModeDefault ParseMode = ""
ModeDefault ParseMode = ""
ModeMarkdown ParseMode = "Markdown"
)

Expand Down Expand Up @@ -39,7 +39,7 @@ type ReplyMarkup struct {
// (e.g., make the keyboard smaller if there are just two rows of buttons).
// Defaults to false, in which case the custom keyboard is always of the
// same height as the app's standard keyboard.
ResizeKeyboard bool `json:"resize_keyboard,omitemptyd"`
ResizeKeyboard bool `json:"resize_keyboard,omitempty"`
// Requests clients to hide the keyboard as soon as it's been used. Defaults to false.
OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"`

Expand Down
6 changes: 1 addition & 5 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ type User struct {

// IsGroupChat returns true if user object represents a group chat.
func (u User) IsGroupChat() bool {
if u.Title != "" {
return true
}

return false
return u.Title != ""
}

// Update object represents an incoming update.
Expand Down

0 comments on commit 62ade91

Please sign in to comment.