nullsoepic / liveunderflow

https://discord.gg/F9qCKC8TCk ~ Discord bot for a LiveOverflow community
Creative Commons Attribution Share Alike 4.0 International
5 stars 4 forks source link

Ignore :petN00bBot: #6

Open ATXLtheAxolotl opened 1 year ago

ATXLtheAxolotl commented 1 year ago

So I realize if someone were to spam this, it could very easily rate limit the webhook we have. The solution to this is to ignore "I like it!" from all noob bots or to collect the "I like it!" all in an array and wait one second then send an embed saying X N00b bots enjoyed petting or something like that.

112batman commented 1 year ago

Or just collect all messages over a 2 second period constantly then send them in 1 go as webhooks can send up to 10 embeds per message. It doesn't have to be instant anyways

ATXLtheAxolotl commented 1 year ago

That is a good idea, however it might clutter the channel up with multiple embeds, and sometimes there are more than 10 N00bBots. I think maybe we should have it as a configuration option, where it can either be fancy (Your idea) or compact (with my idea where one embed says x n00b bots liked being petted!)

ATXLtheAxolotl commented 1 year ago

Maybe as a little Easter egg for the discord server we can add a /petN00b that allows them to pet the noob bots through discord. (With a rate limit of course)

veronoicc commented 1 year ago

The :petN00bBot: command can already be used from discord, so no need for a slash command

XeynQ4 commented 1 year ago

This is pseudo code but if we did something like this it would bunch duplicate messages into one (technically it would send the first one and all the following ones would be bunched up):

let lastMessage
let lastMessageCount = 0

event onRecieveMCMessage() {
if (currentMessage == lastMessage)
  lastMessageCount++
  return
if (lastMessageCount >= 1)
  sendToDiscord(lastMessageCount + lastMessage)
  lastMessageCount = 0

lastMessage = currentMessage
sendToDiscord(currentMessage)
}
ATXLtheAxolotl commented 1 year ago

The :petN00bBot: command can already be used from discord, so no need for a slash command

The current way the chat relay outputs messages into chat is ${user.tag} > :petN00bBot: does it not care if it has stuff before it or does it use some rust equivalent of .include() ?

XeynQ4 commented 1 year ago

This is pseudo code but if we did something like this it would bunch duplicate messages into one (technically it would send the first one and all the following ones would be bunched up):

let lastMessage
let lastMessageCount = 0

event onRecieveMCMessage() {
if (currentMessage == lastMessage)
  lastMessageCount++
  return
if (lastMessageCount >= 1)
  sendToDiscord(lastMessageCount + lastMessage)
  lastMessageCount = 0

lastMessage = currentMessage
sendToDiscord(currentMessage)
}

I implemented this in my latest pull request to @ATXLtheAxolotl repo. I haven't tested it but it should work