Ver Fonte

Linting.

Bruce Marriner há 8 anos atrás
pai
commit
9e777a083b
6 ficheiros alterados com 23 adições e 22 exclusões
  1. 3 3
      discord.go
  2. 4 4
      restapi.go
  3. 11 11
      state.go
  4. 1 0
      structs.go
  5. 3 3
      voice.go
  6. 1 1
      wsapi.go

+ 3 - 3
discord.go

@@ -60,7 +60,7 @@ func New(args ...interface{}) (s *Session, err error) {
 
 		case []string:
 			if len(v) > 3 {
-				err = fmt.Errorf("Too many string parameters provided.")
+				err = fmt.Errorf("too many string parameters provided")
 				return
 			}
 
@@ -91,7 +91,7 @@ func New(args ...interface{}) (s *Session, err error) {
 			} else if s.Token == "" {
 				s.Token = v
 			} else {
-				err = fmt.Errorf("Too many string parameters provided.")
+				err = fmt.Errorf("too many string parameters provided")
 				return
 			}
 
@@ -99,7 +99,7 @@ func New(args ...interface{}) (s *Session, err error) {
 			// TODO: Parse configuration struct
 
 		default:
-			err = fmt.Errorf("Unsupported parameter type provided.")
+			err = fmt.Errorf("unsupported parameter type provided")
 			return
 		}
 	}

+ 4 - 4
restapi.go

@@ -960,7 +960,7 @@ func (s *Session) GuildPruneCount(guildID string, days uint32) (count uint32, er
 	count = 0
 
 	if days <= 0 {
-		err = errors.New("The number of days should be more than or equal to 1.")
+		err = errors.New("the number of days should be more than or equal to 1")
 		return
 	}
 
@@ -990,7 +990,7 @@ func (s *Session) GuildPrune(guildID string, days uint32) (count uint32, err err
 	count = 0
 
 	if days <= 0 {
-		err = errors.New("The number of days should be more than or equal to 1.")
+		err = errors.New("the number of days should be more than or equal to 1")
 		return
 	}
 
@@ -1092,7 +1092,7 @@ func (s *Session) GuildIcon(guildID string) (img image.Image, err error) {
 	}
 
 	if g.Icon == "" {
-		err = errors.New("Guild does not have an icon set.")
+		err = errors.New("guild does not have an icon set")
 		return
 	}
 
@@ -1114,7 +1114,7 @@ func (s *Session) GuildSplash(guildID string) (img image.Image, err error) {
 	}
 
 	if g.Splash == "" {
-		err = errors.New("Guild does not have a splash set.")
+		err = errors.New("guild does not have a splash set")
 		return
 	}
 

+ 11 - 11
state.go

@@ -19,7 +19,7 @@ import (
 )
 
 // ErrNilState is returned when the state is nil.
-var ErrNilState = errors.New("State not instantiated, please use discordgo.New() or assign Session.State.")
+var ErrNilState = errors.New("state not instantiated, please use discordgo.New() or assign Session.State")
 
 // A State contains the current known state.
 // As discord sends this in a READY blob, it seems reasonable to simply
@@ -144,7 +144,7 @@ func (s *State) Guild(guildID string) (*Guild, error) {
 		return g, nil
 	}
 
-	return nil, errors.New("Guild not found.")
+	return nil, errors.New("guild not found")
 }
 
 // TODO: Consider moving Guild state update methods onto *Guild.
@@ -196,7 +196,7 @@ func (s *State) MemberRemove(member *Member) error {
 		}
 	}
 
-	return errors.New("Member not found.")
+	return errors.New("member not found")
 }
 
 // Member gets a member by ID from a guild.
@@ -219,7 +219,7 @@ func (s *State) Member(guildID, userID string) (*Member, error) {
 		}
 	}
 
-	return nil, errors.New("Member not found.")
+	return nil, errors.New("member not found")
 }
 
 // RoleAdd adds a role to the current world state, or
@@ -269,7 +269,7 @@ func (s *State) RoleRemove(guildID, roleID string) error {
 		}
 	}
 
-	return errors.New("Role not found.")
+	return errors.New("role not found")
 }
 
 // Role gets a role by ID from a guild.
@@ -292,7 +292,7 @@ func (s *State) Role(guildID, roleID string) (*Role, error) {
 		}
 	}
 
-	return nil, errors.New("Role not found.")
+	return nil, errors.New("role not found")
 }
 
 // ChannelAdd adds a guild to the current world state, or
@@ -325,7 +325,7 @@ func (s *State) ChannelAdd(channel *Channel) error {
 	} else {
 		guild, ok := s.guildMap[channel.GuildID]
 		if !ok {
-			return errors.New("Guild for channel not found.")
+			return errors.New("guild for channel not found")
 		}
 
 		guild.Channels = append(guild.Channels, channel)
@@ -404,7 +404,7 @@ func (s *State) Channel(channelID string) (*Channel, error) {
 		return c, nil
 	}
 
-	return nil, errors.New("Channel not found.")
+	return nil, errors.New("channel not found")
 }
 
 // Emoji returns an emoji for a guild and emoji id.
@@ -427,7 +427,7 @@ func (s *State) Emoji(guildID, emojiID string) (*Emoji, error) {
 		}
 	}
 
-	return nil, errors.New("Emoji not found.")
+	return nil, errors.New("emoji not found")
 }
 
 // EmojiAdd adds an emoji to the current world state.
@@ -539,7 +539,7 @@ func (s *State) MessageRemove(message *Message) error {
 		}
 	}
 
-	return errors.New("Message not found.")
+	return errors.New("message not found")
 }
 
 func (s *State) voiceStateUpdate(update *VoiceStateUpdate) error {
@@ -593,7 +593,7 @@ func (s *State) Message(channelID, messageID string) (*Message, error) {
 		}
 	}
 
-	return nil, errors.New("Message not found.")
+	return nil, errors.New("message not found")
 }
 
 // OnReady takes a Ready event and updates all internal state.

+ 1 - 0
structs.go

@@ -246,6 +246,7 @@ type Role struct {
 	Permissions int    `json:"permissions"`
 }
 
+// Roles are a collection of Role
 type Roles []*Role
 
 func (r Roles) Len() int {

+ 3 - 3
voice.go

@@ -93,7 +93,7 @@ func (v *VoiceConnection) Speaking(b bool) (err error) {
 	}
 
 	if v.wsConn == nil {
-		return fmt.Errorf("No VoiceConnection websocket.")
+		return fmt.Errorf("no VoiceConnection websocket")
 	}
 
 	data := voiceSpeakingOp{5, voiceSpeakingData{b, 0}}
@@ -251,7 +251,7 @@ func (v *VoiceConnection) waitUntilConnected() error {
 		}
 
 		if i > 10 {
-			return fmt.Errorf("Timeout waiting for voice.")
+			return fmt.Errorf("timeout waiting for voice")
 		}
 
 		time.Sleep(1 * time.Second)
@@ -282,7 +282,7 @@ func (v *VoiceConnection) open() (err error) {
 			break
 		}
 		if i > 20 { // only loop for up to 1 second total
-			return fmt.Errorf("Did not receive voice Session ID in time.")
+			return fmt.Errorf("did not receive voice Session ID in time")
 		}
 		time.Sleep(50 * time.Millisecond)
 		i++

+ 1 - 1
wsapi.go

@@ -57,7 +57,7 @@ func (s *Session) Open() (err error) {
 	}
 
 	if s.wsConn != nil {
-		err = errors.New("Web socket already opened.")
+		err = errors.New("web socket already opened")
 		return
 	}