Added option to disable YouTube support
This commit is contained in:
parent
006ce416aa
commit
ba46701589
3 changed files with 6 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue