1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-11-10 08:10:18 +00:00
This commit is contained in:
MatteZ02 2020-03-15 21:52:36 +02:00
parent 7c182dee57
commit 4ebe625ce0
4 changed files with 15 additions and 17 deletions

View File

@ -59,17 +59,13 @@ module.exports = class extends Client {
this.on('ready', () => { this.on('ready', () => {
require(`${events}ready`).execute(this, Discord); require(`${events}ready`).execute(this, Discord);
}); }).on('message', (msg) => {
this.on('message', (msg) => {
require(`${events}msg`).execute(this, msg, Discord); require(`${events}msg`).execute(this, msg, Discord);
}); }).on('guildCreate', (guild) => {
this.on('guildCreate', (guild) => {
require(`${events}guildCreate`).execute(this, guild); require(`${events}guildCreate`).execute(this, guild);
}); }).on('voiceStateUpdate', (oldState, newState) => {
this.on('voiceStateUpdate', (oldState, newState) => {
require(`${events}voiceStateUpdate`).execute(this, oldState, newState); require(`${events}voiceStateUpdate`).execute(this, oldState, newState);
}); }).on('error', (error) => {
this.on('error', (error) => {
client.channels.fetch(client.config.debug_channel).send(`Error: ${error} on shard: ${this.shard}`); client.channels.fetch(client.config.debug_channel).send(`Error: ${error} on shard: ${this.shard}`);
}); });

View File

@ -11,7 +11,7 @@ module.exports = {
devId: "360363051792203779", devId: "360363051792203779",
embedColor: "#b50002", embedColor: "#b50002",
invite: "https://discordapp.com/api/oauth2/authorize?client_id=607266889537945605&permissions=3427328&redirect_uri=https%3A%2F%2Fdiscordapp.com%2Foauth2%2Fauthorize%3Fclient_id%3D607266889537945605%26%3Bscope%3Dbot%26%3Bpermissions%3D0&scope=bot", invite: "https://discordapp.com/api/oauth2/authorize?client_id=607266889537945605&permissions=3427328&redirect_uri=https%3A%2F%2Fdiscordapp.com%2Foauth2%2Fauthorize%3Fclient_id%3D607266889537945605%26%3Bscope%3Dbot%26%3Bpermissions%3D0&scope=bot",
devMode: false, devMode: true,
dblApi: false, dblApi: false,
saveDB: true, saveDB: true,
shards: 10, shards: 10,

View File

@ -0,0 +1,4 @@
module.exports = {
ytdlOptions: { filter: "audio", highWaterMark: 1 << 25, volume: false/*, begin: seek*/ },
options: { seek: 0, bitrate: 1024, passes: 10, volume: 1/*, bassboost: queue.bass*/ }
};

View File

@ -1,6 +1,7 @@
module.exports = async function (guild, song, client, seek, play) { module.exports = async function (guild, song, client, seek, play) {
const Discord = require('discord.js'); const Discord = require('discord.js');
const ytdl = require('ytdl-core'); const ytdl = require('ytdl-core');
const streamConfig = require("../config/streamConfig.js");
const getThumb = require('video-thumbnail-url'); const getThumb = require('video-thumbnail-url');
const queue = client.queue.get(guild.id); const queue = client.queue.get(guild.id);
@ -10,14 +11,11 @@ module.exports = async function (guild, song, client, seek, play) {
return; return;
} }
const dispatcher = queue.connection const dispatcher = queue.connection
.play(await ytdl(song.url, { filter: "audio", highWaterMark: 1 << 25, volume: false, begin: seek }), { seek: 0, bitrate: 1024, passes: 10, volume: 1, bassboost: queue.bass }) .play(await ytdl(song.url, streamConfig.ytdlOptions), streamConfig.options).on("finish", () => {
.on("finish", () => {
client.dispatcher.finish(client, queue.endReason, guild); client.dispatcher.finish(client, queue.endReason, guild);
}); }).on('start', () => {
dispatcher.on('start', () => {
dispatcher.player.streamingData.pausedTime = 0; dispatcher.player.streamingData.pausedTime = 0;
}); }).on('error', error => {
dispatcher.on('error', error => {
client.dispatcher.error(client, error, guild); client.dispatcher.error(client, error, guild);
}); });
dispatcher.setVolume(queue.volume / 10); dispatcher.setVolume(queue.volume / 10);