Merge pull request #26 from MinazukiAmane/Development

minor change
This commit is contained in:
Amane Serenetia 2024-10-05 11:06:43 +07:00 committed by GitHub
commit dfdeafc063
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 14 additions and 11 deletions

View File

@ -54,7 +54,7 @@ module.exports = {
ENABLED: true, ENABLED: true,
IDLE_TIME: 120, // Time in seconds before the bot disconnects from an idle voice channel IDLE_TIME: 120, // Time in seconds before the bot disconnects from an idle voice channel
MAX_SEARCH_RESULTS: 100, MAX_SEARCH_RESULTS: 100,
DEFAULT_VOLUME: 50, // Default volume for the music player (0-100) DEFAULT_VOLUME: 100, // Default volume for the music player (0-100)
DEFAULT_SOURCE: "ytsearch", // ytsearch = Youtube, ytmsearch = Youtube Music, spsearch = Spotify, scsearch = SoundCloud DEFAULT_SOURCE: "ytsearch", // ytsearch = Youtube, ytmsearch = Youtube Music, spsearch = Spotify, scsearch = SoundCloud
// Lavalink Websocket configuration // Lavalink Websocket configuration
LAVALINK_WS: { LAVALINK_WS: {

View File

@ -1,4 +1,3 @@
//@ts-check
const { EmbedBuilder, ApplicationCommandOptionType } = require("discord.js"); const { EmbedBuilder, ApplicationCommandOptionType } = require("discord.js");
const { MESSAGES, EMBED_COLORS } = require("@root/config"); const { MESSAGES, EMBED_COLORS } = require("@root/config");
@ -94,7 +93,7 @@ function createLyricsEmbed(lyrics, member) {
.setColor(EMBED_COLORS.BOT_EMBED) .setColor(EMBED_COLORS.BOT_EMBED)
.setTitle(`${track.author} - ${track.title}`) .setTitle(`${track.author} - ${track.title}`)
.setThumbnail(track.albumArt[0].url) .setThumbnail(track.albumArt[0].url)
.setFooter({ text: `Requested by: ${member} | Source: ${lyrics.source || 'Unknown'}` }); .setFooter({ text: `Requested by: ${member.user.displayName} | Source: ${lyrics.source || 'Unknown'}` });
const ltext = lyrics.type === 'text' ? lyrics.text : lyrics.lines.map(v => v.line).join('\n') const ltext = lyrics.type === 'text' ? lyrics.text : lyrics.lines.map(v => v.line).join('\n')
embed.setDescription(ltext.length > 4096 ? ltext.slice(0, 4093) + "..." : ltext); embed.setDescription(ltext.length > 4096 ? ltext.slice(0, 4093) + "..." : ltext);

View File

@ -117,7 +117,7 @@ async function play({ member, guild, channel }, query) {
.setAuthor({ name: "Added Track to queue" }) .setAuthor({ name: "Added Track to queue" })
.setDescription(`[${track.info.title}](${track.info.uri})`) .setDescription(`[${track.info.title}](${track.info.uri})`)
.setThumbnail(track.info.artworkUrl) .setThumbnail(track.info.artworkUrl)
.setFooter({ text: `Requested By: ${member.user.username}` }); .setFooter({ text: `Requested By: ${member.user.displayName}` });
fields.push({ fields.push({
name: "Song Duration", name: "Song Duration",
@ -156,7 +156,7 @@ async function play({ member, guild, channel }, query) {
inline: true, inline: true,
} }
) )
.setFooter({ text: `Requested By: ${member.user.username}` }); .setFooter({ text: `Requested By: ${member.user.displayName}` });
} }
// create a player and/or join the member's vc // create a player and/or join the member's vc

View File

@ -95,7 +95,7 @@ async function search({ member, guild, channel }, query) {
embed embed
.setAuthor({ name: "Added Song to queue" }) .setAuthor({ name: "Added Song to queue" })
.setDescription(`[${track.info.title}](${track.info.uri})`) .setDescription(`[${track.info.title}](${track.info.uri})`)
.setFooter({ text: `Requested By: ${member.user.username}` }); .setFooter({ text: `Requested By: ${member.user.displayName}` });
fields.push({ fields.push({
name: "Song Duration", name: "Song Duration",
@ -136,7 +136,7 @@ async function search({ member, guild, channel }, query) {
inline: true, inline: true,
} }
) )
.setFooter({ text: `Requested By: ${member.user.username}` }); .setFooter({ text: `Requested By: ${member.user.displayName}` });
break; break;
case "search": { case "search": {
@ -189,7 +189,7 @@ async function search({ member, guild, channel }, query) {
tracks = toAdd; tracks = toAdd;
embed embed
.setDescription(`🎶 Added ${toAdd.length} songs to queue`) .setDescription(`🎶 Added ${toAdd.length} songs to queue`)
.setFooter({ text: `Requested By: ${member.user.username}` }); .setFooter({ text: `Requested By: ${member.user.displayName}` });
} }
} catch (err) { } catch (err) {
console.log(err); console.log(err);

View File

@ -70,10 +70,14 @@ async function fetchNodesAndTurnItToTable(nodes) {
}) })
} }
function fetchNodeStat(node, connTimeout = 5000) { async function fetchNodeStat(node, connTimeout = 5000) {
const baseUrl = (node.info.port !== 80 && node.info.secure)
? `https://${node.info.host}:${node.info.port}`
: `http://${node.info.host}:${node.info.port}`;
return HttpUtil.fetchWithConnTimeout( return HttpUtil.fetchWithConnTimeout(
`http://${node.info.host}/v4/stats`, `${baseUrl}/v4/stats`,
{ headers: { Authorization: node.info.auth } }, { headers: { Authorization: node.info.auth } },
connTimeout connTimeout
) );
} }