Skip to content

Commit

Permalink
Merge branch 'master' into 2.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
3eif authored Nov 12, 2022
2 parents 4350a96 + 2495e4b commit c2e18f4
Show file tree
Hide file tree
Showing 27 changed files with 52 additions and 58 deletions.
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"prefix": "ear ",
"version": "2.4.0",
"version": "2.4.1",
"website": "https://eartensifier.net/",
"server": "https://discord.gg/xKgKMAP",
"patreon": "https://www.patreon.com/eartensifier",
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "eartensifier",
"version": "2.4.0",
"version": "2.4.1",
"description": "",
"main": "./src/index.js",
"scripts": {
"test": "node ./tests/index.js",
"start": "node .",
"production": "export NODE_ENV=production&&npm start",
"development": "export NODE_ENV=development&&npm start",
"production-inspect": "export ENV=production && npm --node-options --inspect=0.0.0.0:6844 run production",
"ear2": "export NODE_ENV=ear2&&npm start",
"ear3": "export NODE_ENV=ear3&&npm start",
"ear4": "export NODE_ENV=ear4&&npm start",
Expand All @@ -30,7 +31,7 @@
"@discordjs/rest": "^1.1.0",
"@sentry/node": "^7.12.1",
"axios": "^0.27.2",
"blapi": "^2.2.1",
"blapi": "^3.0.0",
"cors": "^2.8.5",
"cpu-stat": "^2.0.1",
"discord-api-types": "^0.37.6",
Expand All @@ -44,7 +45,7 @@
"humanize-duration": "^3.27.0",
"mongoose": "^6.0.12",
"signale": "^1.4.0",
"statcord.js": "^3.4.1",
"statcord.js": "^3.4.3",
"topgg-autoposter": "^2.0.0",
"yasha": "github:ilikdoge/yasha"
},
Expand Down
2 changes: 1 addition & 1 deletion src/commands/bot/Help.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = class Help extends Command {
const commandsFile = fs.readdirSync(`./src/commands/${category}`).filter(file => file.endsWith('.js'));
for (let i = 0; i < commandsFile.length; i++) {
const command = commands.get(commandsFile[i].split('.')[0].toLowerCase());
if (command && !command.hide) helpCommands.push(command.name);
if (command && !command.hide && command.enabled) helpCommands.push(command.name);
}
});
const filtered = helpCommands.filter(choice => choice.startsWith(focusedValue));
Expand Down
3 changes: 1 addition & 2 deletions src/commands/music/NowPlaying.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ module.exports = class NowPlaying extends Command {

const embed = new EmbedBuilder()
.setColor(client.config.colors.default)
.setAuthor({ name: author, iconURL: player.playing ? 'https://eartensifier.net/images/cd.gif' : 'https://eartensifier.net/images/cd.png', url: url })
.setAuthor({ name: author, iconURL: player.playing ? 'https://eartensifier.net/images/cd.gif' : 'https://eartensifier.net/images/cd.png' })
.setThumbnail(thumbnail)
.setTitle(title)
.setURL(url)
.setDescription(`${parsedCurrentDuration} ${percentage < 0.05 ? client.config.emojis.progress7 : client.config.emojis.progress1}${client.config.emojis.progress2.repeat(part)}${percentage < 0.05 ? '' : client.config.emojis.progress3}${client.config.emojis.progress5.repeat(12 - part)}${client.config.emojis.progress6} ${parsedDuration}`)
.setFooter({ text: requester.username })
.setTimestamp();
Expand Down
11 changes: 2 additions & 9 deletions src/commands/music/Play.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@ module.exports = class Play extends Command {
super(client, {
name: 'play',
description: {
content: 'Plays a song or playlist (defaults to YouTube).',
content: 'Plays a song or playlist (defaults to Soundcloud).',
usage: '<search query>',
examples: [
'resonance',
'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
'https://open.spotify.com/track/5hVghJ4KaYES3BFUATCYn0?si=44452e03da534c75',
'sc resonance',
],
},
aliases: ['p', 'tocar'],
Expand Down Expand Up @@ -62,10 +59,6 @@ module.exports = class Play extends Command {
query = args.slice(1).join(' ');
source = 'spotify';
}
else if (args[0].toLowerCase() === 'youtube' || args[0].toLowerCase() === 'yt') {
query = args.slice(1).join(' ');
source = 'youtube';
}
else if (args[0].toLowerCase() === 'applemusic' || args[0].toLowerCase() === 'apple') {
query = args.slice(1).join(' ');
source = 'apple';
Expand All @@ -89,7 +82,7 @@ module.exports = class Play extends Command {
}
catch (error) {
if (query.includes('cdn') || query.includes('media') || query.includes('discord.com') || query.includes('.mp4') || query.includes('.mp3') || query.includes('.mp3')) return ctx.editMessage('No results found. Use the file command if you want to play a file track.');
else return ctx.editMessage('No results found.');
else return ctx.editMessage('No results found.\n\n:flag_us: **Why did the bot return no search results?**\nDiscord has forced Ear Tensifier to no longer search or play from Youtube so search results might not be as accurate.\n\n:flag_ru: **Почему бот не выдал никаких результатов поиска?**\nDiscord заставил Ear Tensifier не искать и не играть видео с YouTube, и из-за этого результаты могут быть не такими точными\n\n:flag_kr: **봇이 검색 결과를 반환하지 않는 이유는 무엇입니까?**\nDiscord는 Ear Tensifier가 더 이상 Youtube에서 검색하거나 재생하지 못하도록 하여 검색 결과가 정확하지 않을 수 있습니다.');
}

if (result instanceof TrackPlaylist) {
Expand Down
4 changes: 0 additions & 4 deletions src/commands/music/PlaySkip.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ module.exports = class PlaySkip extends Command {
query = args.slice(1).join(' ');
source = 'spotify';
}
else if (args[0].toLowerCase() === 'youtube' || args[0].toLowerCase() === 'yt') {
query = args.slice(1).join(' ');
source = 'youtube';
}
else if (args[0].toLowerCase() === 'applemusic' || args[0].toLowerCase() === 'apple') {
query = args.slice(1).join(' ');
source = 'apple';
Expand Down
17 changes: 8 additions & 9 deletions src/commands/music/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,11 @@ module.exports = class Search extends Command {
}
async run(client, ctx, args) {
let query;
let source;
let source = 'soundcloud';
if (args[0]) {
const platform = args[0].toLowerCase();
query = args.slice(1).join(' ');
switch (platform) {
case 'yt' || 'youtube':
source = 'youtube';
break;
case 'sc' || 'soundcloud':
source = 'soundcloud';
break;
Expand All @@ -61,6 +58,7 @@ module.exports = class Search extends Command {
query = args.slice(0).join(' ');
break;
}
source = 'soundcloud';
}
else {
query = ctx.attachments.first().url;
Expand All @@ -85,9 +83,6 @@ module.exports = class Search extends Command {
case 'spotify':
results = await Source.Spotify.search(query);
break;
case 'youtube':
results = await Source.Youtube.search(query);
break;
case 'apple':
results = await Source.AppleMusic.search(query);
break;
Expand All @@ -97,10 +92,14 @@ module.exports = class Search extends Command {
}

if (!results) {
results = await Source.Youtube.search(query);
source = 'youtube';
results = await Source.Soundcloud.search(query);
source = 'soundcloud';
}

if (!track || track.source == 'youtube') {
track = (await Source.Soundcloud.search(query))[0];
source = 'soundcloud';
}
if (!results) return ctx.editMessage('No results found.');

if (results instanceof Track) {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/playlist/Add.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ module.exports = class Create extends Command {
description: 'The song to add.',
},
],
slashCommand: true,
});
slashCommand: false,
enabled: false, });
}

async run(client, ctx, args) {
Expand Down
3 changes: 2 additions & 1 deletion src/commands/playlist/Create.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ module.exports = class Create extends Command {
description: 'The song to add.',
},
],
slashCommand: true,
slashCommand: false,
enabled: false,
});
}

Expand Down
4 changes: 2 additions & 2 deletions src/commands/playlist/Delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ module.exports = class Delete extends Command {
autocomplete: true,
},
],
slashCommand: true,
});
slashCommand: false,
enabled: false, });
}
async run(client, ctx, args) {
await ctx.sendDeferMessage(`${client.config.emojis.typing} Deleting playlist...`);
Expand Down
5 changes: 3 additions & 2 deletions src/commands/playlist/Load.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ module.exports = class Load extends Command {
autocomplete: true,
},
],
slashCommand: true,
slashCommand: false,
enabled: false,
});
}

Expand Down Expand Up @@ -69,7 +70,7 @@ module.exports = class Load extends Command {
duration: track.duration > 10000 ? track.duration / 1000 : track.duration,
thumbnail: track.thumbnail,
author: track.author,
platform: track.platform || 'youtube',
platform: 'soundcloud',
requester: ctx.author,
});
});
Expand Down
3 changes: 2 additions & 1 deletion src/commands/playlist/PlaylistRemove.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ module.exports = class PlaylistRemove extends Command {
description: 'The song to add.',
},
],
slashCommand: true,
slashCommand: false,
enabled: false,
});
}

Expand Down
4 changes: 2 additions & 2 deletions src/commands/playlist/Playlists.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ module.exports = class Playlists extends Command {
content: 'View all your playlists.',
},
args: false,
slashCommand: true,
autocomplete: true,
slashCommand: false,
enabled: false, autocomplete: true,
});
}
async run(client, ctx) {
Expand Down
3 changes: 2 additions & 1 deletion src/commands/playlist/Rename.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ module.exports = class Rename extends Command {
max_length: 100,
},
],
slashCommand: true,
slashCommand: false,
enabled: false,
});
}
async run(client, ctx, args) {
Expand Down
3 changes: 2 additions & 1 deletion src/commands/playlist/Save.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ module.exports = class Save extends Command {
autocomplete: true,
},
],
slashCommand: true,
slashCommand: false,
enabled: false,
});
}
async run(client, ctx, args) {
Expand Down
3 changes: 2 additions & 1 deletion src/commands/playlist/View.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ module.exports = class View extends Command {
autocomplete: true,
},
],
slashCommand: true,
slashCommand: false,
enabled: false,
});
}
async run(client, ctx, args) {
Expand Down
3 changes: 2 additions & 1 deletion src/commands/sources/Apple.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ module.exports = class Spotify extends Command {
permissions: {
botPermissions: [PermissionsBitField.Flags.Connect, PermissionsBitField.Flags.Speak],
},
slashCommand: true,
slashCommand: false,
enabled: false,
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/sources/Soundcloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = class Soundcloud extends Command {
permissions: {
botPermissions: [PermissionsBitField.Flags.Connect, PermissionsBitField.Flags.Speak],
},
slashCommand: true,
slashCommand: false,
});
}

Expand Down
3 changes: 2 additions & 1 deletion src/commands/sources/Spotify.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ module.exports = class Spotify extends Command {
permissions: {
botPermissions: [PermissionsBitField.Flags.Connect, PermissionsBitField.Flags.Speak],
},
slashCommand: true,
slashCommand: false,
enabled: false,
});
}

Expand Down
3 changes: 2 additions & 1 deletion src/commands/sources/Youtube.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ module.exports = class Youtube extends Command {
permissions: {
botPermissions: [PermissionsBitField.Flags.Connect, PermissionsBitField.Flags.Speak],
},
slashCommand: true,
slashCommand: false,
enabled: false,
});
}

Expand Down
1 change: 0 additions & 1 deletion src/components/buttons/AddToQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@ module.exports = class AddToQueue extends Button {

modal.addComponents(new ActionRowBuilder().addComponents(textInput));
await interaction.showModal(modal);

}
};
Empty file added src/helpers/PatreonHelper.js
Empty file.
2 changes: 1 addition & 1 deletion src/helpers/QueueHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = class QueueHelper {
static queuedEmbed(trackName, trackLink, trackDuration, tracks, trackRequester, color) {
let embedString = 'Queued ';
if (trackName && !trackLink) embedString += `**${trackName}**`;
if (trackName && trackLink) embedString += `**[${trackName}](${trackLink})**`;
if (trackName && trackLink) embedString += `**${trackName}**`;
if (trackDuration && trackDuration != -1) embedString += ` [${formatDuration(trackDuration)}]`;
if (tracks) embedString += ` (${tracks} tracks)`;
if (trackRequester) {
Expand Down
5 changes: 3 additions & 2 deletions src/listeners/client/InteractionCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ TLDR: Usa \`/\` invece di \`ear\` prima di ogni comando. E.g: </play:91689795844

this.client.logger.command('%s used by %s from %s', commandName, ctx.author.id, ctx.guild.id);

if (cmd.voiceRequirements.isInVoiceChannel && !interaction.member.voice.channel) return messageHelper.sendResponse('noVoiceChannel');

if (cmd.permissions.botPermissions.includes(Discord.PermissionsBitField.Flags.Connect) && !interaction.member.voice.channel.permissionsFor(this.client.user).has(Discord.PermissionsBitField.Flags.Connect)) return messageHelper.sendResponse('noPermissionConnect');
if (cmd.permissions.botPermissions.includes(Discord.PermissionsBitField.Flags.Speak) && !interaction.member.voice.channel.permissionsFor(this.client.user).has(Discord.PermissionsBitField.Flags.Speak)) return messageHelper.sendResponse('noPermissionSpeak');

Expand All @@ -347,8 +349,7 @@ TLDR: Usa \`/\` invece di \`ear\` prima di ogni comando. E.g: </play:91689795844
}
}

if (cmd.voiceRequirements.isInVoiceChannel && !interaction.member.voice.channel) return messageHelper.sendResponse('noVoiceChannel');
else if (cmd.voiceRequirements.isInSameVoiceChannel && interaction.guild.members.me.voice.channel && !interaction.guild.members.me.voice.channel.equals(interaction.member.voice.channel)) return messageHelper.sendResponse('sameVoiceChannel');
if (cmd.voiceRequirements.isInSameVoiceChannel && interaction.guild.members.me.voice.channel && !interaction.guild.members.me.voice.channel.equals(interaction.member.voice.channel)) return messageHelper.sendResponse('sameVoiceChannel');
else if (cmd.voiceRequirements.isPlaying && !this.client.music.players.get(interaction.guild.id)) return messageHelper.sendResponse('noSongsPlaying');

if (!this.client.config.devs.includes(interaction.user.id)) {
Expand Down
3 changes: 1 addition & 2 deletions src/listeners/player/TrackStart.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,9 @@ module.exports = class TrackStart extends Event {
if (missingPerms.length > 0) return;
const embed = new EmbedBuilder()
.setColor(this.client.config.colors.default)
.setAuthor({ name: author, iconURL: player.playing ? 'https://eartensifier.net/images/cd.gif' : 'https://eartensifier.net/images/cd.png', url: url })
.setAuthor({ name: author, iconURL: player.playing ? 'https://eartensifier.net/images/cd.gif' : 'https://eartensifier.net/images/cd.png' })
.setThumbnail(thumbnail)
.setTitle(title)
.setURL(url)
.setFooter({ text: requester.username })
.setTimestamp();
if (duration != -1) embed.setDescription(`${parsedCurrentDuration} ${percentage < 0.05 ? this.client.config.emojis.progress7 : this.client.config.emojis.progress1}${this.client.config.emojis.progress2.repeat(part)}${percentage < 0.05 ? '' : this.client.config.emojis.progress3}${this.client.config.emojis.progress5.repeat(12 - part)}${this.client.config.emojis.progress6} ${parsedDuration}`);
Expand Down
1 change: 1 addition & 0 deletions src/structures/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = class Client extends Discord.Client {
lifetime: 1800,
getComparisonTimestamp: e => e.editedTimestamp || e.createdTimestamp,
}),
maxSize: 5,
},
}),
partials: [
Expand Down
9 changes: 3 additions & 6 deletions src/structures/Manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@ module.exports = class Manager extends EventEmitter {
case 'spotify':
track = (await Source.Spotify.search(query))[0];
break;
case 'youtube':
track = (await Source.Youtube.search(query))[0];
break;
case 'apple':
track = (await Source.AppleMusic.search(query))[0];
break;
Expand All @@ -130,9 +127,9 @@ module.exports = class Manager extends EventEmitter {
break;
}

if (!track) {
track = (await Source.Youtube.search(query))[0];
source = 'youtube';
if (!track || track.source == 'youtube') {
track = (await Source.Soundcloud.search(query))[0];
source = 'soundcloud';
}

if (!track) throw new Error('No track found');
Expand Down

0 comments on commit c2e18f4

Please sign in to comment.