Skip to content

Commit

Permalink
Turdify accounts Created in the last 30 days
Browse files Browse the repository at this point in the history
  • Loading branch information
jyap808 committed Jul 7, 2023
1 parent 68e74ad commit d7c7dd2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const (
terminatorTimerSeconds = 60

tradingChannelID = "348036278673211392"
turdID = "1072302088232636436"
)

func checkTradingChannel(channelID string) *string {
Expand Down Expand Up @@ -807,6 +808,16 @@ func guildMemberAdd(s *discordgo.Session, m *discordgo.GuildMemberAdd) {
return
}

// Check new user Creation Time
memberCreationTime := convertIDtoCreationTime(m.User.ID)
t1 := time.Now()
diff := t1.Sub(memberCreationTime)
if diff.Hours() < 24*30 {
turdMessage := fmt.Sprintf("Smelly turd: <@%s>", m.User.ID)
s.GuildMemberRoleAdd(m.GuildID, m.User.ID, turdID)
s.ChannelMessageSend(floodAlertChannel, turdMessage)
}

if floodStack.Len() < floodMemberAddInterval {
floodStack.PushBack(floodCheck{m.User.ID, time.Now()})
}
Expand Down

0 comments on commit d7c7dd2

Please sign in to comment.