You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
discordbot.js/testscripts/musicTest.js

39 lines
1.2 KiB
JavaScript

const music = require('../lib/music.js'),
mockclasses = require('./mockobjects.js');
function main() {
let dj = new music.DJ(mockclasses.mockVoicechannel)
music.setLogger({
error: (msg) => console.error('error: ', msg),
warn: (msg) => console.error('warn: ', msg),
info: (msg) => console.log('info: ', msg),
verbose: (msg) => console.log('verbose: ', msg),
debug: (msg) => console.log('debug: ', msg)
});
dj.connect().then(() => {
console.log('connected', dj.connected);
dj.playFile('test');
dj.playYouTube('https://www.youtube.com/watch?v=TEST');
dj.setVolume(1);
dj.pause();
dj.resume();
dj.skip();
dj.stop();
dj.shuffle();
console.log('dj.playlist: ', dj.playlist);
console.log('dj.song: ', dj.song);
dj.clear();
process.exit(0);
});
}
// Executing the main function
if (typeof require !== 'undefined' && require.main === module) {
process.on('unhandledRejection', (reason, p) => {
console.error('Unhandled Rejection at: Promise', p, 'reason:', reason);
throw Error('Promise rejection');
});
setTimeout(() => process.exit(1), 60000);
main();
}