Auto grab Unverified people, and remove verifications after the user leaves
This commit is contained in:
19
main.go
19
main.go
@ -51,7 +51,7 @@ func main() {
|
|||||||
defer log.PanicSafe()
|
defer log.PanicSafe()
|
||||||
startupTime = time.Now()
|
startupTime = time.Now()
|
||||||
lastActiveTime = time.Now()
|
lastActiveTime = time.Now()
|
||||||
lastActiveChan = "627620309754839070"
|
lastActiveChan = config.AdminChannel
|
||||||
if token == "" {
|
if token == "" {
|
||||||
log.LogPanic("No token provided. Please run: disgord-thanos -t <bot token>")
|
log.LogPanic("No token provided. Please run: disgord-thanos -t <bot token>")
|
||||||
}
|
}
|
||||||
@ -154,12 +154,20 @@ func runPurge(s *discordgo.Session) {
|
|||||||
s.ChannelMessageDelete(config.MonitorChann, message.ID)
|
s.ChannelMessageDelete(config.MonitorChann, message.ID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
saveConfig()
|
saveConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
func ready(s *discordgo.Session, event *discordgo.Ready) {
|
func ready(s *discordgo.Session, event *discordgo.Ready) {
|
||||||
// Set the playing status.
|
// Set the playing status.
|
||||||
s.UpdateStatus(0, "DreamDaddy v0.8")
|
s.UpdateStatus(0, "DreamDaddy v0.9")
|
||||||
|
}
|
||||||
|
|
||||||
|
func guildMemberRoleAdd(s *discordgo.Session, m *discordgo.GuildMemberRoleAdd) {
|
||||||
|
defer log.PanicSafe()
|
||||||
|
config.Unverified[m.User.ID] = time.Now()
|
||||||
|
config.Probations[m.User.ID] = time.Now()
|
||||||
|
saveConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
func guildMemberAdd(s *discordgo.Session, m *discordgo.GuildMemberAdd) {
|
func guildMemberAdd(s *discordgo.Session, m *discordgo.GuildMemberAdd) {
|
||||||
@ -168,6 +176,7 @@ func guildMemberAdd(s *discordgo.Session, m *discordgo.GuildMemberAdd) {
|
|||||||
config.Probations[m.User.ID] = time.Now()
|
config.Probations[m.User.ID] = time.Now()
|
||||||
s.GuildMemberRoleAdd(config.GuildID, m.User.ID, config.MonitorRole)
|
s.GuildMemberRoleAdd(config.GuildID, m.User.ID, config.MonitorRole)
|
||||||
s.ChannelMessageSend(config.MonitorChann, fmt.Sprintf("Welcome %+v, you may PM me your verification, or I will ban you in an hour!\nSay \"!rules\" in this channel, without quotes for the rules. You may private/direct message me for verification instructions.\n\nYou will not be able to read/see other channels or users until you verify.", m.User.Mention()))
|
s.ChannelMessageSend(config.MonitorChann, fmt.Sprintf("Welcome %+v, you may PM me your verification, or I will ban you in an hour!\nSay \"!rules\" in this channel, without quotes for the rules. You may private/direct message me for verification instructions.\n\nYou will not be able to read/see other channels or users until you verify.", m.User.Mention()))
|
||||||
|
saveConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
func guildMemberBanned(s *discordgo.Session, m *discordgo.GuildBanAdd) {
|
func guildMemberBanned(s *discordgo.Session, m *discordgo.GuildBanAdd) {
|
||||||
@ -177,6 +186,7 @@ func guildMemberBanned(s *discordgo.Session, m *discordgo.GuildBanAdd) {
|
|||||||
delete(config.Probations, uid)
|
delete(config.Probations, uid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
saveConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
func guildMemberRemove(s *discordgo.Session, m *discordgo.GuildMemberRemove) {
|
func guildMemberRemove(s *discordgo.Session, m *discordgo.GuildMemberRemove) {
|
||||||
@ -194,7 +204,10 @@ func guildMemberRemove(s *discordgo.Session, m *discordgo.GuildMemberRemove) {
|
|||||||
delete(config.Probations, uid)
|
delete(config.Probations, uid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
delete(config.Unverified, m.User.ID)
|
||||||
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))
|
||||||
|
saveConfig()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func verifyMember(s *discordgo.Session, u discordgo.User) {
|
func verifyMember(s *discordgo.Session, u discordgo.User) {
|
||||||
@ -203,7 +216,7 @@ 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!")
|
||||||
s.ChannelMessageSend("627620309754839070", 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()))
|
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()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func rejectVerification(s *discordgo.Session, u discordgo.User) {
|
func rejectVerification(s *discordgo.Session, u discordgo.User) {
|
||||||
|
|||||||
1
types.go
1
types.go
@ -8,6 +8,7 @@ type Config struct {
|
|||||||
AdminChannel string
|
AdminChannel string
|
||||||
AdminRole string
|
AdminRole string
|
||||||
MonitorRole string
|
MonitorRole string
|
||||||
|
IntroChann string
|
||||||
MonitorChann string
|
MonitorChann string
|
||||||
VerifiedRole string
|
VerifiedRole string
|
||||||
BumpTime time.Time
|
BumpTime time.Time
|
||||||
|
|||||||
Reference in New Issue
Block a user