2020-06-27 22:17:57 +00:00
|
|
|
const soundPlayer = require("../utils/soundplayer.js");
|
2020-07-06 21:39:56 +00:00
|
|
|
const urlRegex = /(?:\w+:)?\/\/(\S+)/;
|
|
|
|
const searchRegex = /^(sc|yt)search:/;
|
2019-09-13 20:02:41 +00:00
|
|
|
|
2020-06-27 22:17:57 +00:00
|
|
|
exports.run = async (message, args) => {
|
2020-07-06 20:19:30 +00:00
|
|
|
if (!args[0]) return `${message.author.mention}, you need to provide what you want to play!`;
|
2020-07-06 21:39:56 +00:00
|
|
|
const query = args.join(" ").trim();
|
|
|
|
const search = urlRegex.test(query) ? query : (searchRegex.test(query) ? query : `ytsearch:${query}`);
|
2020-12-11 19:52:02 +00:00
|
|
|
return await soundPlayer.play(encodeURIComponent(search), message, true);
|
2019-09-13 20:02:41 +00:00
|
|
|
};
|
2019-12-02 20:47:22 +00:00
|
|
|
|
2020-07-06 20:19:30 +00:00
|
|
|
exports.aliases = ["p"];
|
2019-12-02 20:47:22 +00:00
|
|
|
exports.category = 7;
|
2020-07-06 20:19:30 +00:00
|
|
|
exports.help = "Plays a song or adds it to the queue";
|
|
|
|
exports.requires = "sound";
|
|
|
|
exports.params = "[url]";
|