Fix logic on removing intro msg
This commit is contained in:
21
main.go
21
main.go
@ -31,7 +31,7 @@ var (
|
|||||||
setupMsg string
|
setupMsg string
|
||||||
dg *discordgo.Session
|
dg *discordgo.Session
|
||||||
lastPM = make(map[string]time.Time)
|
lastPM = make(map[string]time.Time)
|
||||||
introMsg = make(map[string]string)
|
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."}
|
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."}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ func runPurge(s *discordgo.Session) {
|
|||||||
for uid, join := range config.Probations {
|
for uid, join := range config.Probations {
|
||||||
if time.Since(join) > 2*time.Hour {
|
if time.Since(join) > 2*time.Hour {
|
||||||
delete(config.Probations, uid)
|
delete(config.Probations, uid)
|
||||||
s.ChannelMessageDelete(config.IntroChann, uid)
|
s.ChannelMessageDelete(config.IntroChann, introMsg[uid])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for k, v := range config.Unverified {
|
for k, v := range config.Unverified {
|
||||||
@ -188,7 +188,7 @@ func guildMemberBanned(s *discordgo.Session, m *discordgo.GuildBanAdd) {
|
|||||||
for uid := range config.Probations {
|
for uid := range config.Probations {
|
||||||
if m.User.Email == uid {
|
if m.User.Email == uid {
|
||||||
delete(config.Probations, uid)
|
delete(config.Probations, uid)
|
||||||
s.ChannelMessageDelete(config.IntroChann, uid)
|
s.ChannelMessageDelete(config.IntroChann, introMsg[uid])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
saveConfig()
|
saveConfig()
|
||||||
@ -204,11 +204,11 @@ func guildMemberRemove(s *discordgo.Session, m *discordgo.GuildMemberRemove) {
|
|||||||
banned = true
|
banned = true
|
||||||
s.GuildBanCreateWithReason(config.GuildID, m.User.ID, fmt.Sprintf("Left within 2 hours of joining. %+v", time.Since(join)), 0)
|
s.GuildBanCreateWithReason(config.GuildID, m.User.ID, fmt.Sprintf("Left within 2 hours of joining. %+v", time.Since(join)), 0)
|
||||||
delete(config.Probations, uid)
|
delete(config.Probations, uid)
|
||||||
s.ChannelMessageDelete(config.IntroChann, uid)
|
s.ChannelMessageDelete(config.IntroChann, introMsg[uid])
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
delete(config.Probations, uid)
|
delete(config.Probations, uid)
|
||||||
s.ChannelMessageDelete(config.IntroChann, uid)
|
s.ChannelMessageDelete(config.IntroChann, introMsg[uid])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.ChannelMessageSend(config.AdminChannel, fmt.Sprintf("%+v (@%+v) has left, ban: %+v", m.User.ID, m.User.Username, banned))
|
s.ChannelMessageSend(config.AdminChannel, fmt.Sprintf("%+v (@%+v) has left, ban: %+v", m.User.ID, m.User.Username, banned))
|
||||||
@ -216,7 +216,7 @@ func guildMemberRemove(s *discordgo.Session, m *discordgo.GuildMemberRemove) {
|
|||||||
for msg, v := range config.Verifications {
|
for msg, v := range config.Verifications {
|
||||||
if v.UserID == m.User.ID {
|
if v.UserID == m.User.ID {
|
||||||
delete(config.Verifications, msg)
|
delete(config.Verifications, msg)
|
||||||
s.ChannelMessageDelete(config.IntroChann, m.User.ID)
|
s.ChannelMessageDelete(config.IntroChann, introMsg[m.User.ID])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
saveConfig()
|
saveConfig()
|
||||||
@ -229,8 +229,8 @@ func verifyMember(s *discordgo.Session, u discordgo.User) {
|
|||||||
s.GuildMemberRoleRemove(config.GuildID, u.ID, config.MonitorRole)
|
s.GuildMemberRoleRemove(config.GuildID, u.ID, config.MonitorRole)
|
||||||
st, _ := s.UserChannelCreate(u.ID)
|
st, _ := s.UserChannelCreate(u.ID)
|
||||||
s.ChannelMessageSend(st.ID, "Your verification has been accepted, welcome!")
|
s.ChannelMessageSend(st.ID, "Your verification has been accepted, welcome!")
|
||||||
id, _ := 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, _ := 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()))
|
||||||
introMsg[id.ID] = u.ID
|
introMsg[m.ID] = u.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
func rejectVerification(s *discordgo.Session, u discordgo.User) {
|
func rejectVerification(s *discordgo.Session, u discordgo.User) {
|
||||||
@ -383,6 +383,11 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
|
|||||||
if time.Since(config.BumpTime) > 2*time.Hour {
|
if time.Since(config.BumpTime) > 2*time.Hour {
|
||||||
s.ChannelMessageSend(m.ChannelID, fmt.Sprintf("%+v please say \"!d bump\" without the quotes to bump our server :)", m.Author.Mention()))
|
s.ChannelMessageSend(m.ChannelID, fmt.Sprintf("%+v please say \"!d bump\" without the quotes to bump our server :)", m.Author.Mention()))
|
||||||
}
|
}
|
||||||
|
for k, v := range introMsg {
|
||||||
|
if m.Author.ID == k {
|
||||||
|
s.ChannelMessageDelete(config.IntroChann, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
if m.ChannelID == config.AdminChannel {
|
if m.ChannelID == config.AdminChannel {
|
||||||
if strings.HasPrefix(m.Content, rebootToken) {
|
if strings.HasPrefix(m.Content, rebootToken) {
|
||||||
exit(s)
|
exit(s)
|
||||||
|
|||||||
Reference in New Issue
Block a user