фикс устаревшей функции и ошибки если ничего не указано в play

This commit is contained in:
Jonny_Bro (Nikita) 2023-04-25 13:53:14 +05:00
parent 352bf476c5
commit fa6c3f2487
2 changed files with 9 additions and 3 deletions

View file

@ -34,7 +34,9 @@ class JaBa extends Client {
this.databaseCache.usersReminds = new Collection(); this.databaseCache.usersReminds = new Collection();
this.databaseCache.mutedUsers = new Collection(); this.databaseCache.mutedUsers = new Collection();
this.player = Player.singleton(this); this.player = Player.singleton(this, {
autoRegisterExtractor: false,
});
this.player.events.on("playerStart", async (queue, track) => { this.player.events.on("playerStart", async (queue, track) => {
const m = await queue.metadata.channel.send({ content: this.translate("music/play:NOW_PLAYING", { songName: track.title }, queue.metadata.channel.guild.data.language) }); const m = await queue.metadata.channel.send({ content: this.translate("music/play:NOW_PLAYING", { songName: track.title }, queue.metadata.channel.guild.data.language) });
@ -84,6 +86,8 @@ class JaBa extends Client {
this.logger.log(`Unable to connect to the Mongodb database. Error: ${err}`, "error"); this.logger.log(`Unable to connect to the Mongodb database. Error: ${err}`, "error");
}); });
await this.player.extractors.loadDefault();
const autoUpdateDocs = require("../helpers/autoUpdateDocs"); const autoUpdateDocs = require("../helpers/autoUpdateDocs");
autoUpdateDocs.update(this); autoUpdateDocs.update(this);
} }

View file

@ -82,8 +82,10 @@ class Play extends BaseCommand {
* @returns * @returns
*/ */
async autocompleteRun(client, interaction) { async autocompleteRun(client, interaction) {
const query = interaction.options.getString("query"), const query = interaction.options.getString("query");
results = await client.player.search(query); if (query.includes("http") || query === "") return;
const results = await client.player.search(query);
return interaction.respond( return interaction.respond(
results.tracks.slice(0, 10).map(track => ({ results.tracks.slice(0, 10).map(track => ({