Increase buffer siwe

This commit is contained in:
Joren 2024-06-18 17:53:19 +02:00
parent 8fb0838cc0
commit db09b0af99
Signed by: Joren
GPG Key ID: 280E33DFBC0F1B55

View File

@ -58,8 +58,7 @@ func init() {
} }
ChannelBlacklist[server.ServerID] = server.ChannelBlacklist.Channels ChannelBlacklist[server.ServerID] = server.ChannelBlacklist.Channels
// Initialize MessageHistory for each server MessageHistory[server.ServerID] = ringbuffer.NewRingBuffer(4096)
MessageHistory[server.ServerID] = ringbuffer.NewRingBuffer(100) // Adjust buffer size as needed
} }
if Token == "" { if Token == "" {
@ -126,7 +125,7 @@ func checkMessageContent(s *discordgo.Session, server ServerConfig, m *discordgo
message := formatMessage(server, coin, m.Author.Username, matchedAddress) message := formatMessage(server, coin, m.Author.Username, matchedAddress)
if !server.AllowDuplicates && MessageHistory[server.ServerID].ContainsItem(message) { if !server.AllowDuplicates && MessageHistory[server.ServerID].ContainsItem(message) {
return // Skip sending if duplicates are not allowed and message is in history return
} }
s.ChannelMessageSend(server.OutputChannelID, message) s.ChannelMessageSend(server.OutputChannelID, message)