Skip to content

Commit

Permalink
Remove redundancy from join status output
Browse files Browse the repository at this point in the history
  • Loading branch information
dshoreman committed Jun 13, 2020
1 parent 8597ba8 commit 5986b52
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions actions/newguild.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func onGuildJoin(s *dg.Session, m *dg.GuildCreate) {
g := m.Guild
needsConfig, current := !hasConfig(g.ID), savedNameCount(g)

printGuildInfo(g, needsConfig, current)
printGuildInfo(g, current)
if needsConfig || current < g.MemberCount {
fmt.Printf("Running setup for %s:\n", g.Name)
}
Expand All @@ -24,20 +24,14 @@ func onGuildJoin(s *dg.Session, m *dg.GuildCreate) {
}
}

func printGuildInfo(g *dg.Guild, needsConfig bool, nameCount int) {
func printGuildInfo(g *dg.Guild, nameCount int) {
joinDate, _ := g.JoinedAt.Parse()
f, output := "15:04:05 on January 2, 2006", `Smegbot has joined %s! %s
f, output := "15:04:05 on January 2, 2006", `Smegbot has joined %s!
Smegbot first joined at %s. Of %d members, %d have had names saved.
Guild is owned by <@%s>. System messages are sent to <#%s>.
`
configured := "Seems it's missing its config too!"
if !needsConfig {
configured = "It appears to have config already."
}
fmt.Printf(output, g.Name, configured,
joinDate.Format(f), g.MemberCount, nameCount,
g.OwnerID, g.SystemChannelID)
fmt.Printf(output, g.Name, joinDate.Format(f), g.MemberCount, nameCount, g.OwnerID, g.SystemChannelID)
}

func writeConfig(g *dg.Guild) {
Expand Down

0 comments on commit 5986b52

Please sign in to comment.