Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Discord = require('discord.io');
- var fs = require("fs");
- var request = require("request");
- var path = require("path");
- var roomId = "427109857984774144";
- var voideId = "368053162445242382";
- var invCode = "dy7FPJ";
- var msg = "!skip ";
- let bot;
- request({
- method: "POST",
- url: "https://discordapp.com/api/v6/invite/",
- headers: {
- Authorization: process.argv[2]
- }
- }, (error, response, body) => {
- bot = new Discord.Client({
- token: process.argv[2],
- autorun: true
- });
- bot.on('ready', function() {
- console.log('Logged in as %s - %s\n', bot.username, bot.id);
- setInterval(function() {
- bot.sendMessage({
- to: roomId,
- message: msg
- });
- }, 1000);
- bot.joinVoiceChannel(voideId, function(error, events) {
- if (error) {
- return console.error(error);
- }
- setTimeout(function(){
- bot.getAudioContext(voideId, function(error, stream) {
- if (error) {
- return console.error(error);
- }
- playSound(stream);
- });
- }, 1000);
- });
- });
- });
- function playSound(s) {
- console.log("Ide");
- let rs = fs.createReadStream(path.join(__dirname, "b.mp3")).pipe(s, {end: false});
- s.on('done', function() {
- console.log("Ide2");
- playSound(s);
- });
- }
- process.on('SIGINT', function() {
- bot.disconnect();
- process.exit();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement