Browse Source

go vet

master
Gregory Rudolph 4 years ago
parent
commit
160625396c
Signed by: rudi
GPG Key ID: EF64F3CBD1A1EBDD
  1. 12
      commands.go
  2. 2
      config.go
  3. 4
      discordMessage.go

12
commands.go

@ -50,7 +50,7 @@ func setupCommands() {
snap := Command{ snap := Command{
Name: "Snap", Name: "Snap",
Help: "Trigger a purge!", Help: "Trigger a purge!",
RequiresAdmin: false, RequiresAdmin: false,
Keywords: []string{"snap", "purge", "sn"}, Keywords: []string{"snap", "purge", "sn"},
Exec: Snap, Exec: Snap,
@ -60,7 +60,7 @@ func setupCommands() {
status := Command{ status := Command{
Name: "Status", Name: "Status",
RequiresAdmin: true, RequiresAdmin: true,
Help: "Show the current status of Thanos/Verifications and probations", Help: "Show the current status of Thanos/Verifications and probations",
Keywords: []string{"st", "status", "stats"}, Keywords: []string{"st", "status", "stats"},
Exec: Status, Exec: Status,
} }
@ -75,11 +75,11 @@ func setupCommands() {
commands = append(commands, listCommands) commands = append(commands, listCommands)
debugLevel := Command{ debugLevel := Command{
Name: "Debug Level", Name: "Debug Level",
RequiresAdmin: true, RequiresAdmin: true,
Keywords: []string{"debug"}, Keywords: []string{"debug"},
Exec: Debug, Exec: Debug,
Help: "Set the log level for loggy", Help: "Set the log level for loggy",
} }
commands = append(commands, debugLevel) commands = append(commands, debugLevel)
} }

2
config.go

@ -82,7 +82,7 @@ func bumpTimer(s *discordgo.Session) {
bump = false bump = false
config.BumpTime = time.Now() config.BumpTime = time.Now()
time.Sleep(2 * time.Hour) time.Sleep(2 * time.Hour)
if time.Since(lastActiveTime) < (5*time.Minute) { if time.Since(lastActiveTime) < (5 * time.Minute) {
s.ChannelMessageSend(lastActiveChan, "!d bump is ready, please use it. (say \"!d bump\" without the quotes)") s.ChannelMessageSend(lastActiveChan, "!d bump is ready, please use it. (say \"!d bump\" without the quotes)")
} }
s.ChannelMessageSend(config.AdminChannel, "!d bump is ready.") s.ChannelMessageSend(config.AdminChannel, "!d bump is ready.")

4
discordMessage.go

@ -52,14 +52,14 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
log.LogDebug("%+v found!", keyword) log.LogDebug("%+v found!", keyword)
b.Command = keyword b.Command = keyword
if !cmd.RequiresAdmin { if !cmd.RequiresAdmin {
log.LogDebug("%+v does not require admin, running!") log.LogDebug("%+v does not require admin, running!", cmd.Name)
if !cmd.Exec(b) { if !cmd.Exec(b) {
s.ChannelMessageSend(config.AdminChannel, fmt.Sprintf("There was an error running %+v\n%+v", cmd.Name, cmd.Help)) s.ChannelMessageSend(config.AdminChannel, fmt.Sprintf("There was an error running %+v\n%+v", cmd.Name, cmd.Help))
} else { } else {
log.LogInfo("Ran command %+v for %+v", cmd.Name, m.Author.Username) log.LogInfo("Ran command %+v for %+v", cmd.Name, m.Author.Username)
} }
} else { } else {
log.LogDebug("%+v does require admin, checking!") log.LogDebug("%+v does require admin, checking!", cmd.Name)
if isAdmin(m.Member) { if isAdmin(m.Member) {
if !cmd.Exec(b) { if !cmd.Exec(b) {
s.ChannelMessageSend(config.AdminChannel, fmt.Sprintf("There was an error running %+v\n%+v", cmd.Name, cmd.Help)) s.ChannelMessageSend(config.AdminChannel, fmt.Sprintf("There was an error running %+v\n%+v", cmd.Name, cmd.Help))

Loading…
Cancel
Save