Voice connection shitfest edition
No działa tylko na papierze syf że szkoda gadać
This commit is contained in:
1412
package-lock.json
generated
1412
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@@ -4,7 +4,7 @@
|
||||
"description": "gractwo-bot is a Discord bot written in JavaScript, using node.js and discord.js.\r It has been created for and only serves the Gractwo Discord server. It is hosted using Heroku.",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"start": "nodemon"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -21,8 +21,16 @@
|
||||
"npm": ">=7.24.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@discordjs/opus": "^0.5.3",
|
||||
"@discordjs/voice": "^0.7.5",
|
||||
"daemon": "^1.1.0",
|
||||
"discord.js": "^13.1.0",
|
||||
"dotenv": "^10.0.0",
|
||||
"nodemon": "^2.0.13"
|
||||
"ffmpeg": "^0.0.4",
|
||||
"ffmpeg-static": "^4.4.0",
|
||||
"libsodium-wrappers": "^0.7.9",
|
||||
"nodemon": "^2.0.13",
|
||||
"ytdl-core": "^4.9.2",
|
||||
"ytsr": "^3.5.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,11 +13,6 @@ module.exports = {
|
||||
// not intended outside of specific scenarios
|
||||
let embed = {
|
||||
color: cl.cfg.hexBlue,
|
||||
// timestamp: new Date(),
|
||||
// footer: {
|
||||
// text: `Komenda wywołana przez ${msg.author.tag}`,
|
||||
// icon_url: cl.cfg.iconurl,
|
||||
// },
|
||||
};
|
||||
|
||||
let readyMsg;
|
||||
|
||||
46
src/cmds/play.js
Normal file
46
src/cmds/play.js
Normal file
@@ -0,0 +1,46 @@
|
||||
module.exports = {
|
||||
name: 'play',
|
||||
execute(cl, msg, args) {
|
||||
const ytdl = require('ytdl-core');
|
||||
const ytsr = require('ytsr');
|
||||
const path = require('path');
|
||||
const discord = require('discord.js');
|
||||
const { joinVoiceChannel, createAudioPlayer, createAudioResource } = require('@discordjs/voice');
|
||||
let connection;
|
||||
let aplay;
|
||||
let queue;
|
||||
|
||||
function link(msg) {
|
||||
let request = msg.content.slice(path.basename(__filename).length + cl.cfg.prefix.length - 3);
|
||||
if (request.trim() == "") {
|
||||
msg.reply("Dej link albo tagi albo weź i spierdalaj");
|
||||
} else if (request.trim().startsWith("https")) {
|
||||
request = request.trim()
|
||||
if (ytdl.validateURL(request)) {
|
||||
msg.reply("Poprawny link");
|
||||
return request;
|
||||
} else {
|
||||
msg.reply("Kurwo wenecka daj prawdziwy link a nie jaja sobie robisz");
|
||||
}
|
||||
} else {
|
||||
msg.reply("Szukasz:" + request);
|
||||
|
||||
}
|
||||
}
|
||||
if (!connection) {
|
||||
let vChannel = msg.member.voice.channel;
|
||||
connection = joinVoiceChannel({
|
||||
channelId: vChannel.id,
|
||||
guildId: vChannel.guild.id,
|
||||
adapterCreator: vChannel.guild.voiceAdapterCreator,
|
||||
})
|
||||
}
|
||||
aplay = createAudioPlayer();
|
||||
let song = createAudioResource('C:/Users/Stachu/Documents/GitHub/bot/src/sound/afro.mp3')
|
||||
aplay.play(song);
|
||||
connection.subscribe(aplay);
|
||||
aplay.on('error', error => {
|
||||
console.error(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ const cl = new discordjs.Client({
|
||||
intents: [
|
||||
discordjs.Intents.FLAGS.GUILDS,
|
||||
discordjs.Intents.FLAGS.GUILD_MESSAGES,
|
||||
discordjs.Intents.FLAGS.GUILD_VOICE_STATES,
|
||||
],
|
||||
});
|
||||
cl.cfg = require('./cfg.json');
|
||||
|
||||
BIN
src/sound/afro.mp3
Normal file
BIN
src/sound/afro.mp3
Normal file
Binary file not shown.
BIN
src/sound/gospel.mp3
Normal file
BIN
src/sound/gospel.mp3
Normal file
Binary file not shown.
Reference in New Issue
Block a user