Skip to content

Commit

Permalink
feat: Added search message
Browse files Browse the repository at this point in the history
  • Loading branch information
Zastinian committed Aug 19, 2024
1 parent ae9f1e3 commit b69c27b
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/commands/utils/play.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,17 @@ module.exports = {
{ quoted: message },
);
}

const client = new cloud();
const customRegex = /^.+\/.+$/;

bot.sendMessage(message.chat, { text: lang.music.play.download }, { quoted: message });
let track;
if (customRegex.test(text)) {
track = await client.tracks.getAlt(text);
} else {
track = await client.tracks.searchAlt(text);
}

if (!track || !track[0])
return bot.sendMessage(message.chat, { text: lang.music.play.not_found });

try {
await client.util.downloadTrack(`${track[0].user.permalink}/${track[0].permalink}`, "./tmp");
return bot.sendMessage(message.chat, {
Expand Down

0 comments on commit b69c27b

Please sign in to comment.