Skip to content

Commit

Permalink
fix: (handleArchiveRequest) create just one ArchiveEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
tyzbit committed Jun 12, 2023
1 parent d6deb67 commit ec0721e
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions bot/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,21 +280,21 @@ func (bot *ArchiverBot) handleArchiveRequest(r *discordgo.MessageReactionAdd, ne
Components: components,
}
replies = append(replies, reply)
}

// Create a call to Archiver API event
tx := bot.DB.Create(&ArchiveEventEvent{
UUID: archiveEventUUID,
AuthorId: message.Author.ID,
AuthorUsername: message.Author.Username,
ChannelId: message.ChannelID,
MessageId: message.ID,
ServerID: guild.ID,
ArchiveEvents: archives,
})

if tx.RowsAffected != 1 {
errs = append(errs, fmt.Errorf("unexpected number of rows affected inserting archive event: %v", tx.RowsAffected))
}
// Create a call to Archiver API event
tx := bot.DB.Create(&ArchiveEventEvent{
UUID: archiveEventUUID,
AuthorId: message.Author.ID,
AuthorUsername: message.Author.Username,
ChannelId: message.ChannelID,
MessageId: message.ID,
ServerID: guild.ID,
ArchiveEvents: archives,
})

if tx.RowsAffected != 1 {
errs = append(errs, fmt.Errorf("unexpected number of rows affected inserting archive event: %v", tx.RowsAffected))
}

typingStop <- true
Expand Down

0 comments on commit ec0721e

Please sign in to comment.