Set a timeout by guild in discord.js instead of by user?

You know there’s code where you can do:

const talkedRecently = new Set();
if (talkedRecently.has( {
      "**Wait 1 hour before using the coinflip command again, **" + "<@" + + ">");
        } else {
//Your code

        setTimeout(() => {
          // Removes the user from the set after an hour
        }, 3600000); 

This code basically makes it so a user can’t use the command for an hour. The problem here is that I want it so it’s per guild, not user. If someone uses the command in one server, they can’t use it in another server because the set is created by user not by guild. Is there a way I can make it by guild so its 1 hour per user per guild?

You could add a validation layer like

if( === whatever && ) {
//do something
1 Like

omg, I tried doing what you did but it was the complete opposite, thanks.

1 Like