master
Marc 2021-05-28 23:05:53 +01:00
parent 173c012d57
commit 49dbd84b0a
No known key found for this signature in database
GPG Key ID: 0657563F705ACAAE
1 changed files with 7 additions and 2 deletions

View File

@ -33,9 +33,14 @@ func (o *Overwatch) ProcessMessage(s *discordgo.Session, m interface{}) {
} }
func (o *Overwatch) handleUserStat(s *discordgo.Session, m *discordgo.MessageCreate) error { func (o *Overwatch) handleUserStat(s *discordgo.Session, m *discordgo.MessageCreate) error {
for _, user := range o.UserMessages {
log.Printf("User: %+v\n", user)
}
userID := m.Author.ID userID := m.Author.ID
user, ok := o.UserMessages[userID] user, ok := o.UserMessages[userID]
if !ok { if !ok {
log.Println("Couldn't find user, making a new one")
o.UserMessages[userID] = UserMessageStat{ o.UserMessages[userID] = UserMessageStat{
UserID: userID, UserID: userID,
Username: m.Author.Username, Username: m.Author.Username,
@ -55,8 +60,8 @@ func (o *Overwatch) handleUserStat(s *discordgo.Session, m *discordgo.MessageCre
func (o *Overwatch) Run() { func (o *Overwatch) Run() {
go func() { go func() {
for range time.Tick(30 * time.Second) { for range time.Tick(10 * time.Second) {
log.Println("Printing UserMessages (30 Seconds)...") log.Println("Printing UserMessages (10 Seconds)...")
for _, user := range o.UserMessages { for _, user := range o.UserMessages {
log.Printf("User: %+v\n", user) log.Printf("User: %+v\n", user)
} }