I've been wanting to add a feature to my script, which can enable me to stop the setInterval function through a simple command, but the real problem is that I do not know how to do it.
client.on('message', async (message) => {
 if (message.author.username === 'username')
  if (message.content === '*shiba inu pupper') {
   const attachment = new Discord.MessageAttachment('shiba doggo');
   setInterval(() => {
    message.channel.send(attachment);
   }, 20000);
  }
});
 
     
     
    