bot.on('end')

This commit is contained in:
ChomeNS 2022-08-29 17:31:43 +07:00
parent 57a91fd3c9
commit e8e1321791

View file

@ -28,7 +28,7 @@ function inject(bot) {
time = 0; time = 0;
startTime = 0; startTime = 0;
noteIndex = 0; noteIndex = 0;
setInterval(() => { const interval = setInterval(() => {
try { try {
if (!bot.music.song) return; if (!bot.music.song) return;
time = Date.now() - startTime; time = Date.now() - startTime;
@ -52,6 +52,10 @@ function inject(bot) {
} }
}, 20); }, 20);
bot.on('end', () => {
clearInterval(interval);
});
bot.music.load = function(buffer, fallbackName = '[unknown]') { bot.music.load = function(buffer, fallbackName = '[unknown]') {
// TODO: NBS Support // TODO: NBS Support
const midi = new Midi(buffer); const midi = new Midi(buffer);