This commit is contained in:
parent
e2032942ca
commit
446ac616bf
4
.golangci.yml
Normal file
4
.golangci.yml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
linters:
|
||||
disable:
|
||||
- errcheck
|
@ -72,7 +72,9 @@ func (b *Bot) RegisterHandlers() {
|
||||
func Run() error {
|
||||
setupConfig()
|
||||
|
||||
lib.SeedMathRand()
|
||||
if err := lib.SeedMathRand(); err != nil {
|
||||
log.Warn(err)
|
||||
}
|
||||
|
||||
if C.DiscordToken == "" {
|
||||
log.Fatalf("Discord token is not set")
|
||||
@ -99,7 +101,7 @@ func Run() error {
|
||||
defer dg.Close()
|
||||
|
||||
sc := make(chan os.Signal, 1)
|
||||
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill)
|
||||
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM)
|
||||
<-sc
|
||||
|
||||
log.Info("Shutting down")
|
||||
|
@ -77,7 +77,9 @@ func (b *Bot) CommandHandler() func(*discordgo.Session, *discordgo.MessageCreate
|
||||
cmd.Config = b.Config
|
||||
|
||||
log.Debugf("command: %v, args: %v, nargs: %d", cmd.Name, args, len(args))
|
||||
cmd.Func(args, m)
|
||||
if err := cmd.Func(args, m); err != nil {
|
||||
log.Errorf("failed to execute command: %s", err)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -75,9 +75,7 @@ func (b *Bot) DealCommand() CommandFunc {
|
||||
}
|
||||
|
||||
func JoinCards(h []Card, sep string) string {
|
||||
var b []string
|
||||
|
||||
b = make([]string, len(h))
|
||||
b := make([]string, len(h))
|
||||
|
||||
for i, v := range h {
|
||||
b[i] = string(v)
|
||||
|
@ -36,7 +36,7 @@ func (g *Gun) Load(n int) {
|
||||
g.N = 0
|
||||
for i := 1; i <= n; {
|
||||
x := lib.RandInt(0, len(g.C)-1)
|
||||
if g.C[x] == false {
|
||||
if !g.C[x] {
|
||||
g.C[x] = true
|
||||
i++
|
||||
} else {
|
||||
@ -58,7 +58,7 @@ func (g *Gun) Fire() bool {
|
||||
|
||||
func (g *Gun) IsEmpty() bool {
|
||||
for _, v := range g.C {
|
||||
if v == true {
|
||||
if v {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
@ -17,9 +17,7 @@ func Contains[T comparable](s []T, v T) bool {
|
||||
}
|
||||
|
||||
func JoinInt(a []int, sep string) string {
|
||||
var b []string
|
||||
|
||||
b = make([]string, len(a))
|
||||
b := make([]string, len(a))
|
||||
|
||||
for i, v := range a {
|
||||
b[i] = strconv.Itoa(v)
|
||||
@ -37,11 +35,7 @@ func SumInt(a []int) int {
|
||||
}
|
||||
|
||||
func Itob(v int) bool {
|
||||
if v == 1 {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
return v == 1
|
||||
}
|
||||
|
||||
func BuildURI(rawuri, rawpath string) string {
|
||||
|
Loading…
Reference in New Issue
Block a user