Added option to disable YouTube support

This commit is contained in:
Essem 2022-10-10 11:53:45 -05:00
parent 006ce416aa
commit ba46701589
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
3 changed files with 6 additions and 2 deletions

View file

@ -1,6 +1,7 @@
import { play } from "../../utils/soundplayer.js";
import MusicCommand from "../../classes/musicCommand.js";
const prefixes = ["ytsearch:", "ytmsearch:", "scsearch:", "spsearch:", "amsearch:"];
const prefixes = ["scsearch:", "spsearch:", "sprec:", "amsearch:", "dzsearch:", "dzisrc:"];
if (process.env.YT_DISABLED !== "true") prefixes.push("ytsearch:", "ytmsearch:");
class PlayCommand extends MusicCommand {
async run() {
@ -21,7 +22,7 @@ class PlayCommand extends MusicCommand {
const url = new URL(query);
return play(this.client, url, { channel: this.channel, member: this.member, type: this.type, interaction: this.interaction }, true);
} catch {
const search = prefixes.some(v => query.startsWith(v)) ? query : !query && attachment ? attachment.url : `ytsearch:${query}`;
const search = prefixes.some(v => query.startsWith(v)) ? query : !query && attachment ? attachment.url : (process.env.YT_DISABLED !== "true" ? `ytsearch:${query}` : `dzsearch:${query}`);
return play(this.client, search, { channel: this.channel, member: this.member, type: this.type, interaction: this.interaction }, true);
}
}