Add logging for messages erroring out
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -9,7 +9,7 @@ import (
|
||||
|
||||
func ready(s *discordgo.Session, event *discordgo.Ready) {
|
||||
// Set the playing status.
|
||||
s.UpdateGameStatus(0, fmt.Sprintf("DreamDaddy v%+v %+v", version, gitCommit))
|
||||
s.UpdateGameStatus(0, fmt.Sprintf("DreamDaddy rev %+v", gitCommit))
|
||||
}
|
||||
|
||||
func guildMemberUpdate(s *discordgo.Session, m *discordgo.GuildMemberUpdate) {
|
||||
|
||||
@ -54,7 +54,6 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
|
||||
}
|
||||
|
||||
if m.ChannelID != config.AdminChannel {
|
||||
lastActiveChan = m.ChannelID
|
||||
lastActiveTime = time.Now()
|
||||
if len(m.Attachments) > 0 {
|
||||
activeInteraction(s, m.Author.ID)
|
||||
|
||||
23
main.go
23
main.go
@ -20,7 +20,6 @@ var (
|
||||
bump = true
|
||||
config Config
|
||||
log = loggy.NewLogger(config.LogOpts)
|
||||
lastActiveChan string
|
||||
lastActiveTime time.Time
|
||||
token string
|
||||
configFile string
|
||||
@ -28,7 +27,6 @@ var (
|
||||
lastPM = make(map[string]time.Time)
|
||||
introMsg = make(map[string]string)
|
||||
quotes = []string{"The hardest choices require the strongest wills.", "You're strong, but I could snap my fingers and you'd all cease to exist.", "Fun isn't something one considers when balancing the universe. But this... does put a smile on my face.", "Perfectly balanced, as all things should be.", "I am inevitable."}
|
||||
version = "git"
|
||||
gitCommit string
|
||||
commands []Command
|
||||
)
|
||||
@ -50,7 +48,6 @@ func main() {
|
||||
log = loggy.NewLogger(config.LogOpts)
|
||||
startupTime = time.Now()
|
||||
lastActiveTime = time.Now()
|
||||
lastActiveChan = config.AdminChannel
|
||||
if token == "" {
|
||||
log.LogPanic("No token provided. Please run: disgord-thanos -t <bot token>")
|
||||
}
|
||||
@ -173,15 +170,24 @@ func verifyMember(s *discordgo.Session, u discordgo.User) {
|
||||
defer log.PanicSafe()
|
||||
s.GuildMemberRoleAdd(config.GuildID, u.ID, config.VerifiedRole)
|
||||
s.GuildMemberRoleRemove(config.GuildID, u.ID, config.MonitorRole)
|
||||
st, _ := s.UserChannelCreate(u.ID)
|
||||
st, err := s.UserChannelCreate(u.ID)
|
||||
if err != nil {
|
||||
log.LogErrorType(err)
|
||||
}
|
||||
s.ChannelMessageSend(st.ID, "Your verification has been accepted, welcome!")
|
||||
m, _ := s.ChannelMessageSend(config.IntroChann, fmt.Sprintf("Welcome %+v please introduce yourself! :) feel free to check out <#710557387937022034> to tag your roles. Also please mute any channels you are not interested in!", u.Mention()))
|
||||
m, err := s.ChannelMessageSend(config.IntroChann, fmt.Sprintf("Welcome %+v please introduce yourself! :) feel free to check out <#710557387937022034> to tag your roles. Also please mute any channels you are not interested in!", u.Mention()))
|
||||
if err != nil {
|
||||
log.LogErrorType(err)
|
||||
}
|
||||
introMsg[u.ID] = m.ID
|
||||
}
|
||||
|
||||
func rejectVerification(s *discordgo.Session, u discordgo.User) {
|
||||
defer log.PanicSafe()
|
||||
st, _ := s.UserChannelCreate(u.ID)
|
||||
st, err := s.UserChannelCreate(u.ID)
|
||||
if err != nil {
|
||||
log.LogErrorType(err)
|
||||
}
|
||||
if st != nil {
|
||||
s.ChannelMessageSend(st.ID, fmt.Sprintf("Your verification has been rejected. This means it did not clearly show your face, with your pinkie finger held to the corner of your mouth, or the photo looked edited/filtered. No filters will be accepted.\n\nPlease try again before <t:%+v:t>", time.Now().Add(1*time.Hour).Unix()))
|
||||
}
|
||||
@ -190,7 +196,10 @@ func rejectVerification(s *discordgo.Session, u discordgo.User) {
|
||||
|
||||
func requestAge(s *discordgo.Session, u discordgo.User) {
|
||||
defer log.PanicSafe()
|
||||
st, _ := s.UserChannelCreate(u.ID)
|
||||
st, err := s.UserChannelCreate(u.ID)
|
||||
if err != nil {
|
||||
log.LogErrorType(err)
|
||||
}
|
||||
s.ChannelMessageSend(st.ID, "What is your ASL? (Age/Sex/Language) Please note, this is NOT requesting your gender, but your biological sex. Gender is a social construct, sex is biology and in the context of pornographic images more important.")
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user