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

Commit

Permalink
Update 2.2.0
Browse files Browse the repository at this point in the history
## Update List

- [x] More Languages
- [x] Fixed Setup Event
- [x] Moved /premium redeem to /redeem
  • Loading branch information
Adivise committed Oct 8, 2022
1 parent 1ed9de3 commit 92bfa8d
Show file tree
Hide file tree
Showing 37 changed files with 1,014 additions and 270 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,19 @@ After installation or finishes all you can use `node .` to start the bot. or `Ru
<a href="/~https://github.com/Adivise/NanoSpacePlus/graphs/contributors">
<img src="https://contributors-img.web.app/image?repo=Adivise/NanoSpacePlus" />
</a>

## 📃 Translate Team (Languages)

- [x] **en (English)**
- [@Adivise](/~https://github.com/Adivise) **Discord:** `*Stylish.#4078`
- [x] **th (Thailand)**
- [@Adivise](/~https://github.com/Adivise) **Discord:** `*Stylish.#4078`
- [x] **es-ES (Spanish)**
- [@NoBody-UU](/~https://github.com/NoBody-UU) **Discord:** `NoBody🥀#9666`
- [@VenQuiDev](/~https://github.com/venquidev) **Discord:** `VenQui#6625`
- [x] **vi (Vietnamese)**
- [@RainyXeon](/~https://github.com/RainyXeon) **Discord:** `RainyXeon </>#0017`

## ⁉ Become Translate Team?

- [Crowdin](https://crowdin.com/project/nanospace)
2 changes: 1 addition & 1 deletion commands/Premium/Redeem.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const Premium = require("../../settings/models/Premium.js");
const Redeem = require("../../settings/models/Redeem.js");

module.exports = {
name: ["premium", "redeem"],
name: ["redeem"],
description: "Redeem your premium!",
category: "Premium",
options: [
Expand Down
8 changes: 7 additions & 1 deletion commands/Premium/Setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ module.exports = {
await interaction.deferReply({ ephemeral: false });

if (!interaction.member.permissions.has(PermissionsBitField.Flags.ManageGuild)) return interaction.editReply(`${client.i18n.get(language, "utilities", "lang_perm")}`);

const player = client.manager.get(interaction.guild.id);
if (player) player.destroy();

try {
if (user && user.isPremium) {
await interaction.guild.channels.create({
Expand All @@ -29,7 +33,9 @@ module.exports = {
.setAuthor({ name: `${client.i18n.get(language, "setup", "setup_playembed_author")}` })
.setImage(`${client.i18n.get(language, "setup", "setup_playembed_image")}`)
.setDescription(`${client.i18n.get(language, "setup", "setup_playembed_desc")}`)
.setFooter({ text: `${client.i18n.get(language, "setup", "setup_playembed_footer")}` });
.setFooter({ text: `${client.i18n.get(language, "setup", "setup_playembed_footer", {
prefix: "/"
})}` });

await channel.send({ files: [attachment] });
await channel.send({ content: `${queueMsg}`, embeds: [playEmbed], components: [client.diSwitch] }).then(async (playmsg) => {
Expand Down
6 changes: 5 additions & 1 deletion events/guild/voiceStateUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ module.exports = async (client, oldState, newState) => {
const player = client.manager?.players.get(newState.guild.id);

if (!player) return;
if (!newState.guild.members.cache.get(client.user.id).voice.channelId) player.destroy();
if (!newState.guild.members.cache.get(client.user.id).voice.channelId) {
player.destroy();
client.UpdateMusic(player);
client.clearInterval(client.interval);
}

if (newState.channelId && newState.channel.type == 13 && newState.guild.members.me.voice.suppress) {
if (newState.guild.members.me.permissions.has(PermissionsBitField.Flags.Speak) || (newState.channel && newState.channel.permissionsFor(nS.guild.members.me).has(PermissionsBitField.Flags.Speak))) {
Expand Down
101 changes: 52 additions & 49 deletions handlers/Player/loadContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const delay = require("delay");
module.exports = async (client) => {
try {
client.on("interactionCreate", async (interaction) => {
if (!interaction.guild || interaction.user.bot) return;
if (interaction.isButton()) {
const { customId, member } = interaction;
let voiceMember = interaction.guild.members.cache.get(member.id);
Expand All @@ -20,8 +19,9 @@ try {

const guildModel = await GLang.findOne({ guild: playChannel.guild.id });
const { language } = guildModel;

setTimeout(() => interaction.deleteReply(), 3000);

const database = await Setup.findOne({ guild: interaction.guild.id });
if (database.enable === false) return;

switch (customId) {
case "sprevious":
Expand Down Expand Up @@ -152,7 +152,6 @@ try {
}

client.on("messageCreate", async (message) => {
if(message.author.bot || message.channel.type === 1) return;
if (!message.guild || !message.guild.available) return;

/// Create database when not have!
Expand All @@ -165,67 +164,71 @@ client.on("messageCreate", async (message) => {
const channel = await message.guild.channels.cache.get(database.channel);
if (!channel) return;

if (database.channel != message.channel.id) return;
if (database.channel != message.channel.id) return;

/// Get form here right? don't care about this, this error give affect bot!
const msg = await channel.messages.fetch(database.playmsg, { cache: true, force: true });
if (!msg) return;

const guildModel = await GLang.findOne({ guild: message.guild.id });
const { language } = guildModel;

if (message.author.id === client.user.id) {
await delay(3000);
message.delete()
message.delete();
}

if (message.author.bot) return;

const song = message.cleanContent;
await message.delete();

let voiceChannel = await message.member.voice.channel;
if (!voiceChannel) return message.channel.send(`${client.i18n.get(language, "noplayer", "no_voice")}`).then((msg) => {
setTimeout(() => {
msg.delete()
}, 4000);
});

const player = await client.manager.create({
guild: message.guild.id,
voiceChannel: message.member.voice.channel.id,
textChannel: message.channel.id,
selfDeafen: true,
});

const state = player.state;
if (state != "CONNECTED") await player.connect();
const res = await client.manager.search(song, message.author);
if(res.loadType != "NO_MATCHES") {
if(res.loadType == "TRACK_LOADED") {
player.queue.add(res.tracks[0]);
if(!player.playing) player.play();
} else if(res.loadType == "PLAYLIST_LOADED") {
player.queue.add(res.tracks)
if(!player.playing) player.play();
} else if(res.loadType == "SEARCH_RESULT") {
player.queue.add(res.tracks[0]);
if(!player.playing) player.play();
} else if(res.loadType == "LOAD_FAILED") {
message.channel.send(`${client.i18n.get(language, "music", "play_fail")}`).then((msg) => {
setTimeout(() => {
msg.delete()
}, 4000);
});
player.destroy();
}
} else {
message.channel.send(`${client.i18n.get(language, "music", "play_match")}`).then((msg) => {
const song = message.cleanContent;
await message.delete();

let voiceChannel = await message.member.voice.channel;
if (!voiceChannel) return message.channel.send(`${client.i18n.get(language, "noplayer", "no_voice")}`).then((msg) => {
setTimeout(() => {
msg.delete()
}, 4000);
});

const player = await client.manager.create({
guild: message.guild.id,
voiceChannel: message.member.voice.channel.id,
textChannel: message.channel.id,
selfDeafen: true,
});

const state = player.state;
if (state != "CONNECTED") await player.connect();
const res = await client.manager.search(song, message.author);
if(res.loadType != "NO_MATCHES") {
if(res.loadType == "TRACK_LOADED") {
player.queue.add(res.tracks[0]);
if(!player.playing) player.play();
} else if(res.loadType == "PLAYLIST_LOADED") {
player.queue.add(res.tracks)
if(!player.playing) player.play();
} else if(res.loadType == "SEARCH_RESULT") {
player.queue.add(res.tracks[0]);
if(!player.playing) player.play();
} else if(res.loadType == "LOAD_FAILED") {
message.channel.send(`${client.i18n.get(language, "music", "play_fail")}`).then((msg) => {
setTimeout(() => {
msg.delete()
}, 4000);
});
player.destroy();
}
} else {
message.channel.send(`${client.i18n.get(language, "music", "play_match")}`).then((msg) => {
setTimeout(() => {
msg.delete()
}, 4000);
});
player.destroy();
}

if (player) {
client.UpdateQueueMsg(player);
}
if (player) {
client.UpdateQueueMsg(player);
}
});
};
28 changes: 15 additions & 13 deletions handlers/Player/loadUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ const Setup = require("../../settings/models/Setup.js");
module.exports = async (client) => {

client.UpdateQueueMsg = async function (player) {
const data = await Setup.findOne({ guild: player.guild });
if (data.enable === false) return;
const database = await Setup.findOne({ guild: player.guild });
if (database.enable === false) return;

const channel = await client.channels.cache.get(data.channel);
const channel = await client.channels.cache.get(database.channel);
if (!channel) return;

const playMsg = await channel.messages.fetch(data.playmsg, { cache: false, force: true });
if (!playMsg) return;
const msg = await channel.messages.fetch(database.playmsg, { cache: false, force: true });
if (!msg) return;

const guildModel = await GLang.findOne({ guild: player.guild });
const { language } = guildModel;
Expand Down Expand Up @@ -51,22 +51,22 @@ module.exports = async (client) => {
duration: qDuration,
})}` }) //${player.queue.length} • Song's in Queue | Volume • ${player.volume}% | ${qDuration} • Total Duration

return playMsg.edit({
return msg.edit({
content: `${client.i18n.get(language, "setup", "setup_content")}\n${Str == '' ? `${client.i18n.get(language, "setup", "setup_content_empty")}` : '\n' + Str}`,
embeds: [embed],
components: [client.enSwitch]
}).catch((e) => {});
};

client.UpdateMusic = async function (player) {
const data = await Setup.findOne({ guild: player.guild });
if (data.enable === false) return;
const database = await Setup.findOne({ guild: player.guild });
if (database.enable === false) return;

const channel = await client.channels.cache.get(data.channel);
const channel = await client.channels.cache.get(database.channel);
if (!channel) return;

const playMsg = await channel.messages.fetch(data.playmsg, { cache: true, force: true });
if (!playMsg) return;
const msg = await channel.messages.fetch(database.playmsg, { cache: true, force: true });
if (!msg) return;

const guildModel = await GLang.findOne({ guild: player.guild });
const { language } = guildModel;
Expand All @@ -80,9 +80,11 @@ module.exports = async (client) => {
.setDescription(`${client.i18n.get(language, "setup", "setup_playembed_desc", {
clientId: client.user.id,
})}`)
.setFooter({ text: `${client.i18n.get(language, "setup", "setup_playembed_footer")}` });
.setFooter({ text: `${client.i18n.get(language, "setup", "setup_playembed_footer", {
prefix: "/"
})}` });

return playMsg.edit({
return msg.edit({
content: `${queueMsg}`,
embeds: [playEmbed],
components: [client.diSwitch]
Expand Down
15 changes: 15 additions & 0 deletions languages/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## 📃 Translate Contributors (Languages)

- [x] **en (English)**
- [@Adivise](/~https://github.com/Adivise) Discord: *Stylish.#4078
- [x] **th (Thailand)**
- [@Adivise](/~https://github.com/Adivise) Discord: *Stylish.#4078
- [x] **es-ES (Spanish)**
- [@NoBody-UU](/~https://github.com/NoBody-UU) Discord: NoBody🥀#9666
- [@VenQuiDev](/~https://github.com/venquidev) Discord: VenQui#6625
- [x] **vi (Vietnamese)**
- [@RainyXeon](/~https://github.com/RainyXeon) Discord: RainyXeon </>#0017

## ⁉ Need Translate Contributors?

- [Crowdin](https://crowdin.com/project/nanospace)
33 changes: 33 additions & 0 deletions languages/es-ES/filters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
##### All Filter command!
filter_loading: "Encendiendo **%{name}**. Esto puede tardar unos segundos..."
filter_on: "`🔩` | *Activado:* `%{name}`"
filter_number: "Por favor, introduzca un número."
filter_greater: "El número debe ser mayor que 0."
filter_less: "El número debe ser menor que 10."
#Bassboost commaand!
bassboost_loading: "Ajustando **Bassboost** a **%{amount}dB**. Esto puede tardar unos segundos..."
bassboost_set: "`🔩` | *Bassboost establecido en:* `%{amount}`"
bassboost_limit: "Por favor, introduzca un número entre -10 y 10."
#Equalizer command!
eq_author: "Equalizador Personalizado"
eq_icon: "https://cdn.discordapp.com/emojis/758423098885275748.gif"
eq_desc: "Hay 14 bandas que se pueden ajustar de -10 a 10. No todas las bandas tienen que ser llenadas."
eq_field_title: "Ejemplo:"
eq_field_value: "%{prefix}eq 2 3 0 8 0 5 0 -5 0 0"
eq_number: "La Banda #%{num} no es un número válido."
eq_than: "La Banda #%{num} debe ser menor que 10."
eq_footer: "Restablecer ecualizador: %{prefix}eq reset"
eq_loading: "Configurando **Equalizador** a... **`%{bands}`** Esto puede tardar unos segundos..."
eq_on: "`🔩` | *Equalizador establecido en:* `%{bands}`"
#Pitch command!
pitch_loading: "Ajustando **Pitch** a **%{amount}**. Esto puede tardar unos segundos..."
pitch_on: "`🔩` | *Tono establecido en:* `%{amount}`"
#Rate command!
rate_loading: "Ajustando **Tarifa** a **%{amount}x**. Esto puede tardar unos segundos..."
rate_on: "`🔩` | *Tarifa establecida en:* `%{amount}x`"
#Reset command!
reset_loading: "Desactivando **filtro** Esto puede tardar unos segundos..."
reset_on: "`🔩` | *Desactivado:* `filter`"
#Speed command!
speed_loading: "Ajustando **Velocidad** a **%{amount}x**. Esto puede tardar unos segundos..."
speed_on: "`🔩` | *Velocidad establecida en:* `%{amount}x`"
9 changes: 9 additions & 0 deletions languages/es-ES/interaction.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
##### InteractionCreate Event #####
#On settings/config.js in DEV_ID
dev_only: El bot está en mantenimiento. (Por favor, vuelve más tarde)
#No permission to use command (this for bot!)
no_perms: '¡No tengo permisos para ejecutar el comando!'
#Bot getting error something!
error: Algo salió mal.
#You are not the client owner of this bot!
owner_only: '¡No eres el dueño del cliente!'
Loading

0 comments on commit 92bfa8d

Please sign in to comment.