Skip to content
This repository has been archived by the owner on Apr 6, 2024. It is now read-only.

Commit

Permalink
Fix outdated config and setup update [NEAR FINAL UPDATE]
Browse files Browse the repository at this point in the history
  • Loading branch information
RainyXeon committed Nov 28, 2023
1 parent 19f989e commit a5de732
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 36 deletions.
16 changes: 9 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"kazagumo": "^2.3.1",
"kazagumo-deezer": "^1.2.2",
"kazagumo-nico": "^1.1.5",
"kazagumo-spotify": "^1.1.5",
"kazagumo-spotify": "^1.2.1",
"lodash": "^4.17.21",
"lodash.where": "^3.1.0",
"lyrics-finder": "^21.7.0",
Expand Down
6 changes: 3 additions & 3 deletions src/boot/original/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ class Manager extends Client {
const guild = this.guilds.cache.get(guildId);
if (guild) guild.shard.send(payload);
},
plugins: this.config.lavalink.ENABLE_SPOTIFY
plugins: this.config.lavalink.SPOTIFY.enable
? [
new Spotify({
clientId: this.config.SPOTIFY_ID,
clientSecret: this.config.SPOTIFY_SECRET,
clientId: this.config.lavalink.SPOTIFY.id,
clientSecret: this.config.lavalink.SPOTIFY.secret,
playlistPageLimit: 1, // optional ( 100 tracks per page )
albumPageLimit: 1, // optional ( 50 tracks per page )
searchLimit: 10, // optional ( track search limit. Max 50 )
Expand Down
6 changes: 3 additions & 3 deletions src/boot/shard/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ class Manager extends Client {
const guild = this.guilds.cache.get(guildId);
if (guild) guild.shard.send(payload);
},
plugins: this.config.lavalink.ENABLE_SPOTIFY
plugins: this.config.lavalink.SPOTIFY.enable
? [
new Spotify({
clientId: this.config.SPOTIFY_ID,
clientSecret: this.config.SPOTIFY_SECRET,
clientId: this.config.lavalink.SPOTIFY.id,
clientSecret: this.config.lavalink.SPOTIFY.secret,
playlistPageLimit: 1, // optional ( 100 tracks per page )
albumPageLimit: 1, // optional ( 50 tracks per page )
searchLimit: 10, // optional ( track search limit. Max 50 )
Expand Down
44 changes: 28 additions & 16 deletions src/events/guild/interactionCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ const REGEX = [

module.exports = async (client, interaction) => {
if (
interaction.isCommand() ||
interaction.isContextMenuCommand() ||
interaction.isModalSubmit() ||
interaction.isChatInputCommand() ||
interaction.isAutocomplete()
interaction.isCommand() ||
interaction.isContextMenuCommand() ||
interaction.isModalSubmit() ||
interaction.isChatInputCommand() ||
interaction.isAutocomplete()
) {
if (!interaction.guild || interaction.user.bot) return;
if (!client.is_db_connected)
Expand Down Expand Up @@ -177,7 +177,9 @@ module.exports = async (client, interaction) => {
)
)
return interaction.user.dmChannel.send(
`${client.i18n.get(language, "interaction", "no_perms")}`,
`${client.i18n.get(language, "interaction", "no_perms", {
perm: "SendMessages",
})}`,
);
if (
!interaction.guild.members.me.permissions.has(
Expand All @@ -190,41 +192,51 @@ module.exports = async (client, interaction) => {
PermissionsBitField.Flags.EmbedLinks,
)
)
return interaction.reply(
`${client.i18n.get(language, "interaction", "no_perms")}`,
return interaction.user.dmChannel.send(
`${client.i18n.get(language, "interaction", "no_perms", {
perm: "EmbedLinks",
})}`,
);
if (!interaction.commandName == "help") {
if (
!interaction.guild.members.me.permissions.has(
PermissionsBitField.Flags.Speak,
)
)
return interaction.reply(
`${client.i18n.get(language, "interaction", "no_perms")}`,
return interaction.user.dmChannel.send(
`${client.i18n.get(language, "interaction", "no_perms", {
perm: "Speak",
})}`,
);
if (
!interaction.guild.members.me.permissions.has(
PermissionsBitField.Flags.Connect,
)
)
return interaction.reply(
`${client.i18n.get(language, "interaction", "no_perms")}`,
return interaction.user.dmChannel.send(
`${client.i18n.get(language, "interaction", "no_perms", {
perm: "Connect",
})}`,
);
if (
!interaction.guild.members.me.permissions.has(
PermissionsBitField.Flags.ManageMessages,
)
)
return interaction.reply(
`${client.i18n.get(language, "interaction", "no_perms")}`,
return interaction.user.dmChannel.send(
`${client.i18n.get(language, "interaction", "no_perms", {
perm: "ManageMessages",
})}`,
);
if (
!interaction.guild.members.me.permissions.has(
PermissionsBitField.Flags.ManageChannels,
)
)
return await interaction.reply(
`${client.i18n.get(language, "interaction", "no_perms")}`,
return await interaction.user.dmChannel.send(
`${client.i18n.get(language, "interaction", "no_perms", {
perm: "ManageChannels",
})}`,
);
}

Expand Down
10 changes: 5 additions & 5 deletions src/handlers/Player/loadContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,11 @@ module.exports = async (client) => {

if (!result.tracks.length)
return msg.edit({
content: `${client.i18n.get(language, "setup", "setup_content")}\n${
Str == ""
? `${client.i18n.get(language, "setup", "setup_content_empty")}`
: "\n" + Str
}`,
content: `${client.i18n.get(
language,
"setup",
"setup_content",
)}\n${`${client.i18n.get(language, "setup", "setup_content_empty")}`}`,
});
if (result.type === "PLAYLIST")
for (let track of tracks) player.queue.add(track);
Expand Down
14 changes: 14 additions & 0 deletions src/handlers/Player/loadUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,22 @@ module.exports = async (client) => {
})}`,
);

const current_song = `${client.i18n.get(
language,
"setup",
"setup_content_queue",
{
index: `${1}`,
title: player.queue.current.title,
duration: formatDuration(player.queue.current.length),
request: `${player.queue.current.requester}`,
},
)}`;

await songStrings.push(...queuedSongs);

await songStrings.unshift(current_song);

const Str = songStrings.slice(0, 10).join("\n");

const TotalDuration = QueueDuration(player);
Expand Down
2 changes: 1 addition & 1 deletion src/languages/en/interaction.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
dev_only: The bot is under maintenance. (Please come back again later)

# No permission to use command (this for bot!)
no_perms: I don't have perms to execute command!
no_perms: "I don't have perms to execute command! [%{perm}]"

# Bot getting error something!
error: Something went wrong.
Expand Down

0 comments on commit a5de732

Please sign in to comment.