From 377bdde44b15c3ce011ff078a4a46c8dc66b67ad Mon Sep 17 00:00:00 2001 From: kageru Date: Sat, 2 Mar 2019 10:15:33 +0100 Subject: [PATCH] put all log statements behind the logged actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit make sure we don’t log them as successful if they failed --- command.go | 2 +- events.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/command.go b/command.go index 2e8b2b6..f513ed4 100644 --- a/command.go +++ b/command.go @@ -253,9 +253,9 @@ func giveAgeRole(s *discordgo.Session, m *discordgo.MessageCreate) { } } } - log.Printf("Giving Role %s to %s", roleName(s.State, role), userToString(m.Author)) s.GuildMemberRoleAdd(config.ServerID, m.Author.ID, role) s.ChannelMessageSend(dm.ID, "Haaai, Ryoukai desu~") + log.Printf("Giving Role %s to %s", roleName(s.State, role), userToString(m.Author)) } } } diff --git a/events.go b/events.go index 1642ce0..7ed2236 100644 --- a/events.go +++ b/events.go @@ -32,7 +32,6 @@ func onJoin(s *discordgo.Session, member *discordgo.GuildMemberAdd) { func onDM(s *discordgo.Session, m *discordgo.MessageCreate) { log.Printf("Received DM from %s with content: “%s”", userToString(m.Author), m.Content) - fmt.Sprintf("Received DM from %s with content: “%s”", userToString(m.Author), m.Content) Member, _ := s.GuildMember(config.ServerID, m.Author.ID) dm, _ := s.UserChannelCreate(Member.User.ID) for comm, role := range config.RoleCommands { @@ -46,9 +45,9 @@ func onDM(s *discordgo.Session, m *discordgo.MessageCreate) { } } } - log.Printf("Giving Role %s to %s", roleName(s.State, role), userToString(m.Author)) s.ChannelMessageSend(dm.ID, "Haaai, Ryoukai desu~") s.GuildMemberRoleAdd(config.ServerID, m.Author.ID, role) + log.Printf("Giving Role %s to %s", roleName(s.State, role), userToString(m.Author)) } } }