Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { Client } = require ('discord.js');
- const bot = new Client();
- const TOKEN = "";
- var dispatcher;
- bot.login(TOKEN);
- bot.on('ready', () => {
- console.info(`Logged in as ${bot.user.tag}!`);
- });
- bot.on('message', msg => {
- if (msg.content === 'ping') {
- msg.reply('pong');
- msg.channel.send('pong');
- } else if (msg.content.startsWith('play')) {
- if(msg.member.voiceChannel) {
- msg.member.voiceChannel.join()
- .then(connection => {
- msg.reply("I'm here");
- if (msg.content.endsWith("song")) {
- let music = "C:/scripts/JandaBot/discord-bot-sitepoint/song.mp3"
- dispatcher = connection.playFile(music);
- dispatcher.resume();
- }
- })
- }
- } else if (msg.content.startsWith('stop')) {
- dispatcher.end()
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement