I'm making a discord bot, and I created a command where whenever someone executes the command "!ping @ example", then it would ping @example once every minute until @example stops it. I have created the loop successfully, however, I can't terminate the loop.
var interval = setInterval (function () {
const user = message.mentions.users.first();
message.channel.send('You have been pinged!' + '\n' + '<@' + user + '>')
}, 1 * 60000);