gofmt all the things

This commit is contained in:
kageru 2019-01-10 00:16:39 +01:00
parent 6e7229d787
commit 4566ffc230
Signed by: kageru
GPG Key ID: 8282A2BEA4ADA3D2
7 changed files with 381 additions and 387 deletions

View File

@ -4,6 +4,7 @@ Updates are listed in reverse chronological order.
### 1.4 (dev)
- a copy of each deleted message is now send via DM to the author (suggested by CommanderLook)
- seasonal fluff
- finally use gofmt
### 1.3
- use global array of pointers to commands to allow easier modification and avoid unnecessary memcpy

View File

@ -4,10 +4,10 @@ import (
"fmt"
"github.com/bwmarrin/discordgo"
"github.com/deckarep/golang-set"
"strings"
"time"
"log"
"regexp"
"strings"
"time"
)
type CommandType int
@ -45,7 +45,6 @@ type Command struct {
UsersOnCooldown mapset.Set // don’t set this manually (it’s overwritten anyway)
}
// Performs basic input validation on a given command and adds it to the global command array
func registerCommand(command Command) {
if command.Trigger == "" {
@ -254,4 +253,3 @@ func getHelpEmbed() *discordgo.MessageEmbed {
}
return embed
}

View File

@ -1,8 +1,8 @@
package main
import (
"os"
"encoding/json"
"os"
)
type Embed struct {
@ -29,7 +29,6 @@ type Config struct {
RoleCommands map[string]string
}
func readConfig() Config {
file, _ := os.Open("config.json")
conf := Config{}
@ -37,4 +36,3 @@ func readConfig() Config {
file.Close()
return conf
}

View File

@ -52,4 +52,3 @@ func onDM(s *discordgo.Session, m *discordgo.MessageCreate) {
}
}
}

View File

@ -1,9 +1,9 @@
package main
import (
"fmt"
"github.com/bwmarrin/discordgo"
"log"
"fmt"
)
func unlockUser(s *discordgo.Session, id string) {

12
main.go
View File

@ -2,11 +2,11 @@ package main
import (
"fmt"
"os/signal"
"os"
"syscall"
"log"
"github.com/bwmarrin/discordgo"
"log"
"os"
"os/signal"
"syscall"
)
var config = readConfig()
@ -68,8 +68,7 @@ func addCommands() {
registerCommand(Command{Trigger: "/o\\", Output: "\\o/", Type: CommandTypeFullMatch, Cooldown: 10})
registerCommand(Command{Trigger: "!heil", Output: "(ノ・ェ・)ノ Selphy (ノ・ェ・)ノ", Type: CommandTypeFullMatch, Cooldown: 30})
registerCommand(Command{Trigger: "ayy", Output: "lmao", Type: CommandTypeFullMatch, Cooldown: 0})
registerCommand(Command{Trigger: "<:selphyPadoru:525766188240732180>", Output: "<:selphypadoru:526644596558659594> Padoru <:selphypadoru:526644596558659594> Padoru <:selphypadoru:526644596558659594> Pado Padoru <:selphypadoru:526644596558659594>", Type: CommandTypeFullMatch, Cooldown: 10800})
registerCommand(Command{Trigger: "<:selphyDango:507979223244341267>", Output: "<:dango:430669469799677953> :notes: Dango Daikazoku :notes: <:dango:430669469799677953>", Type: CommandTypeFullMatch, Cooldown: 10800})
registerCommand(Command{Trigger: "<:selphyDango:531594585424527370>", Output: "<:dango:430669469799677953> :notes: Dango Daikazoku :notes: <:dango:430669469799677953>", Type: CommandTypeFullMatch, Cooldown: 10800})
registerCommand(Command{Trigger: "praise the sun", Output: "If only I could be so grossly incandescent \\\\[T]/", Type: CommandTypeContains, IgnoreCase: true, Cooldown: 85600})
// Information
@ -86,4 +85,3 @@ func addCommands() {
fmt.Printf("Successfully initialized %d commands\n", len(commands))
log.Printf("Successfully initialized %d commands", len(commands))
}

View File

@ -1,8 +1,8 @@
package main
import (
"github.com/bwmarrin/discordgo"
"fmt"
"github.com/bwmarrin/discordgo"
)
func getWelcomeEmbed() *discordgo.MessageEmbed {