1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-09-20 04:31:56 +00:00

nigthCore added

This commit is contained in:
MatteZ02 2020-04-08 20:48:57 +03:00
parent 0af2ca1d44
commit 1beb0fa86a
4 changed files with 290 additions and 184 deletions

26
src/commands/nigthcore.ts Normal file
View File

@ -0,0 +1,26 @@
module.exports = {
name: "nigthcore",
alias: "nc",
usage: "<true/false>",
description: "Change nigthcore on/off",
onlyDev: false,
permission: "MANAGE_MESSAGES",
category: "music",
async execute(msg, args, client, Discord, prefix, command) {
const queue = client.queue.get(msg.guild.id);
if (!args[1] && queue)
return msg.channel.send(
`${client.messages.currentNigthCore}**${queue.nigthCore}**`
);
if (client.funcs.check(client, msg, command)) {
if (args[1] === "true") {
queue.nigthCore = true;
} else if (args[1] === "false") {
queue.nigthCore = false;
}
let message;
message = client.messages.nigthCoreApplied.replace("%BOOLEAN%", args[1]);
return msg.channel.send(message);
}
},
};

View File

@ -1,17 +1,22 @@
const emojis = require('./emojis.ts'); const emojis = require("./emojis.ts");
module.exports = { module.exports = {
alreadyPaused: emojis.redx + "The music is already paused!", alreadyPaused: emojis.redx + "The music is already paused!",
alreadyVoted: emojis.redx + "You have already voted to skip!", alreadyVoted: emojis.redx + "You have already voted to skip!",
announceSongs: emojis.megaPhone + "Current setting:", announceSongs: emojis.megaPhone + "Current setting:",
announceSongsFalse: emojis.green_check_mark + "announcesongs now set to `false`!", announceSongsFalse:
announceSongsTrue: emojis.green_check_mark + "announcesongs now set to `true`!", emojis.green_check_mark + "announcesongs now set to `false`!",
bassApplied: emojis.volumeHigh + "The bass level **%BASS%** will be applied when the next song starts playing!", announceSongsTrue:
emojis.green_check_mark + "announcesongs now set to `true`!",
bassApplied:
emojis.volumeHigh +
"The bass level **%BASS%** will be applied when the next song starts playing!",
bassFalse: emojis.green_check_mark + "Bass is now false!", bassFalse: emojis.green_check_mark + "Bass is now false!",
bassLevel: emojis.green_check_mark + "Bass level is now", bassLevel: emojis.green_check_mark + "Bass level is now",
boolean: emojis.redx + "Please define a boolean! (true/false)", boolean: emojis.redx + "Please define a boolean! (true/false)",
cancellingVideoSelection: emojis.redx + "Cancelling video selection", cancellingVideoSelection: emojis.redx + "Cancelling video selection",
cantSkipToCurrent: emojis.redx + "You can't skip to the song currently playing!", cantSkipToCurrent:
emojis.redx + "You can't skip to the song currently playing!",
channelFull: emojis.redx + "Your voice channel is full!", channelFull: emojis.redx + "Your voice channel is full!",
cmdUsesFooter: "These statistics are from the current uptime.", cmdUsesFooter: "These statistics are from the current uptime.",
cmdUsesTitle: "Musix Command Usage During Current Uptime", cmdUsesTitle: "Musix Command Usage During Current Uptime",
@ -19,26 +24,41 @@ module.exports = {
currentBass: emojis.loudSound + "The current bass is: ", currentBass: emojis.loudSound + "The current bass is: ",
currentDefaultBass: emojis.speaker + "Currect default bass level: ", currentDefaultBass: emojis.speaker + "Currect default bass level: ",
currentDefaultVolume: emojis.speaker + "Current default volume is:", currentDefaultVolume: emojis.speaker + "Current default volume is:",
currentNigthCore: emojis.speaker + "Currect Nigthcore setting: ",
currentPrefix: "Current prefix:", currentPrefix: "Current prefix:",
currentVolume: emojis.loudSound + "The current volume is: ", currentVolume: emojis.loudSound + "The current volume is: ",
dbSaved: emojis.green_check_mark + "DB Saved!", dbSaved: emojis.green_check_mark + "DB Saved!",
defaultVolumeMax: emojis.redx + "The default volume must be below `100` for quality and safety resons.", defaultVolumeMax:
defaultVolumeNumber: emojis.redx + "I'm sorry, But the default volume needs to be a valid __number__.", emojis.redx +
"The default volume must be below `100` for quality and safety resons.",
defaultVolumeNumber:
emojis.redx +
"I'm sorry, But the default volume needs to be a valid __number__.",
defaultVolumeSet: emojis.green_check_mark + "Default volume set to:", defaultVolumeSet: emojis.green_check_mark + "Default volume set to:",
devMode: emojis.redx + "Dev mode has been turned on! Commands are only available to developer(s)!", devMode:
emojis.redx +
"Dev mode has been turned on! Commands are only available to developer(s)!",
dispatcherError: "Error with the dispatcher: ", dispatcherError: "Error with the dispatcher: ",
djFalse: emojis.green_check_mark + "`DJ` now set to `false`", djFalse: emojis.green_check_mark + "`DJ` now set to `false`",
djRoleCreated: emojis.green_check_mark + "I did not find a role `DJ` so i have created one for you!", djRoleCreated:
djRoleFound: emojis.green_check_mark + "I found a `DJ` role from this guild! This role is now the DJ role.", emojis.green_check_mark +
"I did not find a role `DJ` so i have created one for you!",
djRoleFound:
emojis.green_check_mark +
"I found a `DJ` role from this guild! This role is now the DJ role.",
error: emojis.redx + "An error occured!", error: emojis.redx + "An error occured!",
errorConnecting: "Error with connecting to voice channel: ", errorConnecting: "Error with connecting to voice channel: ",
errorDetected: "Error detected: ", errorDetected: "Error detected: ",
errorDispatcher: emojis.redx + "An error has occured while playing music! The queue has been deleted.", errorDispatcher:
emojis.redx +
"An error has occured while playing music! The queue has been deleted.",
errorExe: emojis.redx + "there was an error trying to execute that command!", errorExe: emojis.redx + "there was an error trying to execute that command!",
errorExeOpt: emojis.redx + "there was an error trying to execute that option!", errorExeOpt:
emojis.redx + "there was an error trying to execute that option!",
evalTitle: "Evaluation Command", evalTitle: "Evaluation Command",
helpCmdFooter: "Command Alias:", helpCmdFooter: "Command Alias:",
helpFooter: "\"%PREFIX%help <command>\" to see more information about a command.", helpFooter:
'"%PREFIX%help <command>" to see more information about a command.',
helpTitle: "help", helpTitle: "help",
inviteTitle: "Invite Musix to your Discord server!", inviteTitle: "Invite Musix to your Discord server!",
joined: emojis.green_check_mark + "Joined", joined: emojis.green_check_mark + "Joined",
@ -48,16 +68,31 @@ module.exports = {
loopingSong: emojis.repeatSong + "Looping **%TITLE%** now!", loopingSong: emojis.repeatSong + "Looping **%TITLE%** now!",
maxBass: emojis.redx + "The max bass is `100`!", maxBass: emojis.redx + "The max bass is `100`!",
maxVolume: emojis.redx + "The max volume is `100`!", maxVolume: emojis.redx + "The max volume is `100`!",
nigthCoreApplied:
emojis.green_check_mark +
"NigthCore is now **%BOOLEAN%** this will be applied when the next song starts playing!",
noDj: emojis.redx + "You need the `DJ` role to use this command!", noDj: emojis.redx + "You need the `DJ` role to use this command!",
noLooping: emojis.repeat + "No longer looping the queue!", noLooping: emojis.repeat + "No longer looping the queue!",
noLoopingSong: emojis.repeatSong + "No longer looping the song!", noLoopingSong: emojis.repeatSong + "No longer looping the song!",
noPerms: emojis.redx + `You need the %PERMS% permission to use this command!`, noPerms: emojis.redx + `You need the %PERMS% permission to use this command!`,
noPermsConnect: emojis.redx + "I cannot connect to your voice channel, make sure I have the proper permissions!", noPermsConnect:
noPermsEmbed: emojis.redx + "I cannot send embeds (Embed links), make sure I have the proper permissions!", emojis.redx +
noPermsManageRoles: emojis.redx + "I cannot create roles (Manage roles), make sure I have the proper permissions! I will need this permission to create a `DJ` role since i did not find one!", "I cannot connect to your voice channel, make sure I have the proper permissions!",
noPermsManageSettings: emojis.redx + "You need the `MANAGE_SERVER` permission to change the settings!", noPermsEmbed:
noPermsSpeak: emojis.redx + "I cannot speak in your voice channel, make sure I have the proper permissions!", emojis.redx +
noPermsUseExternalEmojis: emojis.redx + "I cannot use external emojis, make sure I have the proper permissions!", "I cannot send embeds (Embed links), make sure I have the proper permissions!",
noPermsManageRoles:
emojis.redx +
"I cannot create roles (Manage roles), make sure I have the proper permissions! I will need this permission to create a `DJ` role since i did not find one!",
noPermsManageSettings:
emojis.redx +
"You need the `MANAGE_SERVER` permission to change the settings!",
noPermsSpeak:
emojis.redx +
"I cannot speak in your voice channel, make sure I have the proper permissions!",
noPermsUseExternalEmojis:
emojis.redx +
"I cannot use external emojis, make sure I have the proper permissions!",
noQuery: emojis.redx + "you need to use a link or search for a song!", noQuery: emojis.redx + "you need to use a link or search for a song!",
noResults: emojis.redx + "I could not obtain any search results!", noResults: emojis.redx + "I could not obtain any search results!",
noServerQueue: emojis.redx + "There is nothing playing!", noServerQueue: emojis.redx + "There is nothing playing!",
@ -66,55 +101,77 @@ module.exports = {
notAllowed: emojis.redx + "You are not allowed to do that!", notAllowed: emojis.redx + "You are not allowed to do that!",
notEnoughVotes: emojis.redx + "Not enough votes!", notEnoughVotes: emojis.redx + "Not enough votes!",
notPaused: emojis.redx + "The music in not paused!", notPaused: emojis.redx + "The music in not paused!",
noVoiceChannel: emojis.redx + "I'm sorry but you need to be in a voice channel to play music!", noVoiceChannel:
emojis.redx +
"I'm sorry but you need to be in a voice channel to play music!",
nowPlaying: "__Now playing__", nowPlaying: "__Now playing__",
paused: emojis.pause + "Paused the music!", paused: emojis.pause + "Paused the music!",
permission: "🔒 Permission requirement:", permission: "🔒 Permission requirement:",
permissionsFalse: emojis.redx + "That value is already `false`!", permissionsFalse: emojis.redx + "That value is already `false`!",
permissionsSetFalse: emojis.green_check_mark + "Permissions requirement now set to: `false`", permissionsSetFalse:
permissionsSetTrue: emojis.green_check_mark + "Permissions requirement now set to: `true`", emojis.green_check_mark + "Permissions requirement now set to: `false`",
permissionsSetTrue:
emojis.green_check_mark + "Permissions requirement now set to: `true`",
permissionsTrue: emojis.redx + "That value is already `true`!", permissionsTrue: emojis.redx + "That value is already `true`!",
pinging: emojis.loading + "Pinging...", pinging: emojis.loading + "Pinging...",
playlistAdded: emojis.green_check_mark + "Playlist: **%TITLE%** has been added to the queue!", playlistAdded:
emojis.green_check_mark +
"Playlist: **%TITLE%** has been added to the queue!",
positiveBass: emojis.redx + "The bass needs to be a positive number!", positiveBass: emojis.redx + "The bass needs to be a positive number!",
positiveVolume: emojis.redx + "The volume needs to be a positive number!", positiveVolume: emojis.redx + "The volume needs to be a positive number!",
prefixHere: "My prefix here is: ", prefixHere: "My prefix here is: ",
prefixMaxLength: "The prefix must be shorter or equal to 5 letters!", prefixMaxLength: "The prefix must be shorter or equal to 5 letters!",
prefixSet: emojis.green_check_mark + "New prefix set to:", prefixSet: emojis.green_check_mark + "New prefix set to:",
provideANumber: "Please provide a number ranging from 1-10 to select one of the search results.", provideANumber:
provideASong: emojis.redx + "Please provide a song position in queue for me to remove!", "Please provide a number ranging from 1-10 to select one of the search results.",
provideASong:
emojis.redx + "Please provide a song position in queue for me to remove!",
queueDeleted: "Queue deleted!", queueDeleted: "Queue deleted!",
queueDesc: "**Now playing:** %SONG%<a:aNotes:674602408105476106>\n:arrow_down: Next in queue :arrow_down:", queueDesc:
"**Now playing:** %SONG%<a:aNotes:674602408105476106>\n:arrow_down: Next in queue :arrow_down:",
queueFooter: "songs in the queue!", queueFooter: "songs in the queue!",
queueLength: emojis.redx + "There are only %SONGS% amount of songs in the queue!", queueLength:
emojis.redx + "There are only %SONGS% amount of songs in the queue!",
queueTitle: "__Song queue__", queueTitle: "__Song queue__",
quotaReached: emojis.redx + "Quota reached please try again after midnight Pacific Time (PT)!", quotaReached:
emojis.redx +
"Quota reached please try again after midnight Pacific Time (PT)!",
reloaded: "All files reloaded!", reloaded: "All files reloaded!",
removed: emojis.garbage + "removed `%SONG%` from the queue!", removed: emojis.garbage + "removed `%SONG%` from the queue!",
reset: emojis.green_check_mark + "Reset __all__ guild settings!", reset: emojis.green_check_mark + "Reset __all__ guild settings!",
restart: "restarting all shards...", restart: "restarting all shards...",
resumed: emojis.resume + "Resumed the music!", resumed: emojis.resume + "Resumed the music!",
seekingPointPositive: emojis.redx + "The seeking point needs to be a positive number!", seekingPointPositive:
seekMax: emojis.redx + "The lenght of this song is %LENGTH% seconds! You can't seek further than that!", emojis.redx + "The seeking point needs to be a positive number!",
seekMax:
emojis.redx +
"The lenght of this song is %LENGTH% seconds! You can't seek further than that!",
settingsAnnounceSongs: "announcesongs", settingsAnnounceSongs: "announcesongs",
settingsAnnounceSongsDesc: "Whether to announce songs that start playing or not.", settingsAnnounceSongsDesc:
"Whether to announce songs that start playing or not.",
settingsBass: "bass", settingsBass: "bass",
settingsBassDesc: "Change the default bass level.", settingsBassDesc: "Change the default bass level.",
settingsFooter: "how to use: %PREFIX%settings <Setting name> <value>", settingsFooter: "how to use: %PREFIX%settings <Setting name> <value>",
settingsPermissions: "permissions", settingsPermissions: "permissions",
settingsPermissionsDesc: "Change whether to require permissions to use eg `skip, stop, pause, loop, etc...`", settingsPermissionsDesc:
"Change whether to require permissions to use eg `skip, stop, pause, loop, etc...`",
settingsPrefix: "prefix", settingsPrefix: "prefix",
settingsPrefixDesc: "Change the guild specific prefix. (string)", settingsPrefixDesc: "Change the guild specific prefix. (string)",
settingsSetDj: "setdj", settingsSetDj: "setdj",
settingsSetDjDesc: "Set a DJ role. This will allow chosen users to freely use all Musix commands. This will automatically set the `permissions` settings to true in order for the `DJ` role to have effect!", settingsSetDjDesc:
"Set a DJ role. This will allow chosen users to freely use all Musix commands. This will automatically set the `permissions` settings to true in order for the `DJ` role to have effect!",
settingsTitle: "Guild settings for Musix", settingsTitle: "Guild settings for Musix",
settingsVolume: "volume", settingsVolume: "volume",
settingsVolumeDesc: "Change the default volume that the bot will start playing at. (number)", settingsVolumeDesc:
"Change the default volume that the bot will start playing at. (number)",
setVolume: emojis.volumeHigh + "I set the volume to: ", setVolume: emojis.volumeHigh + "I set the volume to: ",
shuffled: emojis.shuffle + "Queue suffled!", shuffled: emojis.shuffle + "Queue suffled!",
skipped: emojis.skip + "Skipped the song!", skipped: emojis.skip + "Skipped the song!",
songAdded: emojis.green_check_mark + "**%TITLE%** has been added to the queue!", songAdded:
songBlockedWMG: emojis.redx + "This song had been blocked by WMG (Warner Music Groud).\n<:skip:674685614221688832> Skipped to next song.", emojis.green_check_mark + "**%TITLE%** has been added to the queue!",
songBlockedWMG:
emojis.redx +
"This song had been blocked by WMG (Warner Music Groud).\n<:skip:674685614221688832> Skipped to next song.",
songSelection: "__Song Selection__", songSelection: "__Song Selection__",
startPlaying: emojis.notes + "Start playing: ", startPlaying: emojis.notes + "Start playing: ",
statusField1: emojis.signal + "Ping", statusField1: emojis.signal + "Ping",
@ -123,6 +180,9 @@ module.exports = {
statusField4: "Shard: ", statusField4: "Shard: ",
statusTitle: "Status for Musix", statusTitle: "Status for Musix",
stop: emojis.stop + "Stopped the music!", stop: emojis.stop + "Stopped the music!",
validNumber: emojis.redx + "I'm sorry, But you need to enter a valid __number__.", validNumber:
wrongVoiceChannel: emojis.redx + "I'm sorry but you need to be in the same voice channel as Musix to use this command!", emojis.redx + "I'm sorry, But you need to enter a valid __number__.",
wrongVoiceChannel:
emojis.redx +
"I'm sorry but you need to be in the same voice channel as Musix to use this command!",
}; };

View File

@ -5,6 +5,7 @@ module.exports = {
songs: [], songs: [],
volume: null, volume: null,
bass: null, bass: null,
nigthCore: false,
playing: false, playing: false,
paused: false, paused: false,
looping: false, looping: false,
@ -14,4 +15,4 @@ module.exports = {
votesNeeded: null, votesNeeded: null,
time: 0, time: 0,
endReason: null, endReason: null,
} };

View File

@ -1,9 +1,9 @@
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.ts"); const streamConfig = require("../config/streamConfig.ts");
const getThumb = require('video-thumbnail-url'); const getThumb = require("video-thumbnail-url");
const prism = require('prism-media'); const prism = require("prism-media");
const queue = client.queue.get(guild.id); const queue = client.queue.get(guild.id);
if (!song) { if (!song) {
@ -15,21 +15,38 @@ module.exports = async function (guild, song, client, seek, play) {
streamConfig.ytdlOptions.begin = seek; streamConfig.ytdlOptions.begin = seek;
const ffmpegArgs = [ const ffmpegArgs = [
"-analyzeduration", "0", "-analyzeduration",
"-loglevel", "0", "0",
"-f", "s16le", "-loglevel",
"-ar", "48000", "0",
"-ac", "2", "-f",
"-af", `bass=g=${queue.bass}`, "s16le",
"-ar",
"48000",
"-ac",
"2",
"-af",
`bass=g=${queue.bass}`,
]; ];
if (queue.nigthCore) {
ffmpegArgs.push("-af");
ffmpegArgs.push("asetrate=52920");
}
const transcoder = new prism.FFmpeg({ args: ffmpegArgs }); const transcoder = new prism.FFmpeg({ args: ffmpegArgs });
const dispatcher = queue.connection const dispatcher = queue.connection
.play(await ytdl(song.url, streamConfig.ytdlOptions).pipe(transcoder), streamConfig.options).on("finish", () => { .play(
await ytdl(song.url, streamConfig.ytdlOptions).pipe(transcoder),
streamConfig.options
)
.on("finish", () => {
client.dispatcher.finish(client, queue.endReason, guild); client.dispatcher.finish(client, queue.endReason, guild);
}).on('start', () => { })
.on("start", () => {
dispatcher.player.streamingData.pausedTime = 0; dispatcher.player.streamingData.pausedTime = 0;
}).on('error', error => { })
.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);
@ -39,10 +56,12 @@ module.exports = async function (guild, song, client, seek, play) {
const thumbnail = getThumb(queue.songs[0].url); const thumbnail = getThumb(queue.songs[0].url);
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setTitle(`${client.messages.startPlaying}**${song.title}**`) .setTitle(`${client.messages.startPlaying}**${song.title}**`)
.setDescription(`Song duration: \`${client.funcs.msToTime(songtime, "hh:mm:ss")}\``) .setDescription(
`Song duration: \`${client.funcs.msToTime(songtime, "hh:mm:ss")}\``
)
.setThumbnail(thumbnail._rejectionHandler0) .setThumbnail(thumbnail._rejectionHandler0)
.setColor(client.config.embedColor) .setColor(client.config.embedColor);
queue.textChannel.send(embed); queue.textChannel.send(embed);
} }
queue.playing = true; queue.playing = true;
} };