mirror of
https://github.com/JonnyBro/JaBa.git
synced 2025-04-02 20:20:46 +05:00
pull from main (#7)
This commit is contained in:
parent
371ed5b34a
commit
9c18e1a85d
3 changed files with 48 additions and 7 deletions
|
@ -91,7 +91,7 @@ class Userinfo extends BaseCommand {
|
|||
text: client.config.embed.footer
|
||||
});
|
||||
|
||||
if (member.presence.activities[0].name === "Custom Status") {
|
||||
if (member.presence.activities[0]?.name === "Custom Status") {
|
||||
embed.addFields([
|
||||
{
|
||||
name: client.customEmojis.games + " " + interaction.translate("common:ACTIVITY"),
|
||||
|
@ -103,7 +103,7 @@ class Userinfo extends BaseCommand {
|
|||
embed.addFields([
|
||||
{
|
||||
name: client.customEmojis.games + " " + interaction.translate("common:ACTIVITY"),
|
||||
value: member.presence.activities[0] ? `${member.presence.activities[0].name}\n${member.presence.activities[0].details}\n${member.presence.activities[0].state}` : interaction.translate("general/userinfo:NO_GAME"),
|
||||
value: member.presence.activities[0] ? `${member.presence.activities[0].name}\n${member.presence.activities[0].details}\n${member.presence.activities[0].state}` : interaction.translate("general/userinfo:NO_ACTIVITY"),
|
||||
inline: true
|
||||
}
|
||||
]);
|
||||
|
|
|
@ -43,9 +43,34 @@ class Play extends BaseCommand {
|
|||
if (!perms.has(PermissionsBitField.Flags.Connect) || !perms.has(PermissionsBitField.Flags.Speak)) return interaction.editReply({ content: interaction.translate("music/play:VOICE_CHANNEL_CONNECT") });
|
||||
|
||||
try {
|
||||
var searchResult = await client.player.search(query, {
|
||||
requestedBy: interaction.user
|
||||
});
|
||||
var searchResult;
|
||||
if (!query.includes("http")) {
|
||||
const search = await playdl.search(query, { limit: 10 });
|
||||
|
||||
if (search) {
|
||||
const found = search.map(track => new Track(client.player, {
|
||||
title: track.title,
|
||||
duration: Util.buildTimeCode(Util.parseMS(track.durationInSec * 1000)),
|
||||
thumbnail: track.thumbnails[0].url || "https://cdn.discordapp.com/attachments/708642702602010684/1012418217660121089/noimage.png",
|
||||
views: track.views,
|
||||
author: track.channel.name,
|
||||
description: "search",
|
||||
url: track.url,
|
||||
requestedBy: interaction.user,
|
||||
playlist: null,
|
||||
source: "youtube"
|
||||
}));
|
||||
|
||||
searchResult = { playlist: null, tracks: found, searched: true };
|
||||
}
|
||||
} else {
|
||||
searchResult = await client.player.search(query, {
|
||||
requestedBy: interaction.user
|
||||
});
|
||||
|
||||
if (!searchResult.tracks[0] || !searchResult)
|
||||
return interaction.editReply({ content: interaction.translate("music/play:NO_RESULT", { query, error: "Unknown Error" }) });
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return interaction.editReply({
|
||||
|
@ -60,7 +85,19 @@ class Play extends BaseCommand {
|
|||
metadata: { channel: interaction.channel },
|
||||
leaveOnEnd: true,
|
||||
leaveOnStop: true,
|
||||
bufferingTimeout: 1000
|
||||
bufferingTimeout: 1000,
|
||||
disableVolume: false,
|
||||
spotifyBridge: false,
|
||||
/**
|
||||
*
|
||||
* @param {import("discord-player").Track} track
|
||||
* @param {import("discord-player").TrackSource} source
|
||||
* @param {import("discord-player").Queue} queue
|
||||
*/
|
||||
async onBeforeCreateStream(track, source) {
|
||||
if (source === "youtube" || source === "soundcloud")
|
||||
return (await playdl.stream(track.url, { discordPlayerCompatibility: true })).stream;
|
||||
}
|
||||
});
|
||||
|
||||
if (searchResult.tracks.searched) {
|
||||
|
@ -182,9 +219,12 @@ class Play extends BaseCommand {
|
|||
});
|
||||
});
|
||||
|
||||
return interaction.editReply({
|
||||
interaction.editReply({
|
||||
components: [row1, row2, row3]
|
||||
});
|
||||
|
||||
collector.end();
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
1
getcookie.js
Normal file
1
getcookie.js
Normal file
|
@ -0,0 +1 @@
|
|||
require("play-dl").authorization();
|
Loading…
Add table
Reference in a new issue