Browse Source

Updated for new loggy standards

hkremer/rebranding
Gregory Rudolph 4 years ago
parent
commit
cd946d9cc4
Signed by: rudi
GPG Key ID: EF64F3CBD1A1EBDD
  1. 2
      config.go
  2. 10
      main.go

2
config.go

@ -55,7 +55,7 @@ func status(s *discordgo.Session) {
} }
} }
statistics += "\n```" statistics += "\n```"
log.LogInfo(fmt.Sprintf("Private statistics: %+v", statistics)) log.LogInfo("Private statistics: %+v", statistics)
go runPurge(s) go runPurge(s)
return return
} }

10
main.go

@ -54,7 +54,7 @@ func main() {
log.LogPanic("No token provided. Please run: disgord-thanos -t <bot token>") log.LogPanic("No token provided. Please run: disgord-thanos -t <bot token>")
} }
log.LogCritical(fmt.Sprintf("SetupToken: %+v\nRebootToken: %+v", setupToken, rebootToken)) log.LogCritical("SetupToken: %+v\nRebootToken: %+v", setupToken, rebootToken)
dg, err := discordgo.New("Bot " + token) dg, err := discordgo.New("Bot " + token)
if err != nil { if err != nil {
log.LogErrorType(err) log.LogErrorType(err)
@ -295,7 +295,7 @@ func readReaction(s *discordgo.Session, m *discordgo.MessageReactionAdd) {
go storeVerification(verification) go storeVerification(verification)
} else if m.Emoji.Name == "👶" { } else if m.Emoji.Name == "👶" {
requestAge(s, user) requestAge(s, user)
log.LogInfo(fmt.Sprintf("%+v has requested ASL for user %+v.", admin.User.Username, user.Username)) log.LogInfo("%+v has requested ASL for user %+v.", admin.User.Username, user.Username)
return return
} else if m.Emoji.Name == "⛔" { } else if m.Emoji.Name == "⛔" {
s.GuildBanCreateWithReason(config.GuildID, user.ID, fmt.Sprintf("Underage or too many failed verifications. %+v", admin.User.Username), 5) s.GuildBanCreateWithReason(config.GuildID, user.ID, fmt.Sprintf("Underage or too many failed verifications. %+v", admin.User.Username), 5)
@ -303,7 +303,7 @@ func readReaction(s *discordgo.Session, m *discordgo.MessageReactionAdd) {
} else { } else {
return return
} }
log.LogInfo(fmt.Sprintf("%+v", verification.prettyPrint())) log.LogInfo("%+v", verification.prettyPrint())
delete(config.Verifications, m.MessageID) delete(config.Verifications, m.MessageID)
} }
func storeVerification(v Verification) { func storeVerification(v Verification) {
@ -322,13 +322,13 @@ func storeVerification(v Verification) {
} }
resp, err := client.Get(v.Photo) resp, err := client.Get(v.Photo)
if err != nil { if err != nil {
log.LogError(fmt.Sprintf("Unable to download verification %s-%s-%s", v.UserID, v.Username, fileName)) log.LogError("Unable to download verification %s-%s-%s", v.UserID, v.Username, fileName)
} }
defer resp.Body.Close() defer resp.Body.Close()
defer file.Close() defer file.Close()
_, err = io.Copy(file, resp.Body) _, err = io.Copy(file, resp.Body)
if err != nil { if err != nil {
log.LogError(fmt.Sprintf("Unable to store verification %s-%s-%s", v.UserID, v.Username, fileName)) log.LogError("Unable to store verification %s-%s-%s", v.UserID, v.Username, fileName)
} }
} }

Loading…
Cancel
Save