This repository has been archived by the owner on Sep 27, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Update List - [x] Fixed voiceStateUpdate.js - [x] Add Setup.js - [x] Revamp Control.js - [x] Fixed rename all `PermissionsBitField` has change on v14 - [x] Fixed etc. (idk i can't remember)
- Loading branch information
Showing
27 changed files
with
763 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
const { EmbedBuilder, AttachmentBuilder, PermissionsBitField } = require('discord.js'); | ||
const Setup = require("../../settings/models/Setup.js"); | ||
|
||
module.exports = { | ||
config: { | ||
name: "setup", | ||
description: "Setup song request channel!", | ||
accessableby: "Member", | ||
category: "Premium", | ||
}, | ||
run: async (client, message, args, user, language, prefix) => { | ||
if (!message.member.permissions.has(PermissionsBitField.Flags.ManageGuild)) return message.channel.send(`${client.i18n.get(language, "utilities", "lang_perm")}`); | ||
try { | ||
if (user && user.isPremium) { | ||
await message.guild.channels.create({ | ||
name: "song-request", | ||
type: 0, // 0 = text, 2 = voice | ||
topic: `${client.i18n.get(language, "setup", "setup_topic")}`, | ||
parent_id: message.channel.parentId, | ||
user_limit: 3, | ||
rate_limit_per_user: 3, | ||
}).then(async (channel) => { | ||
|
||
const attachment = new AttachmentBuilder("./settings/images/banner.png", { name: "setup.png" }); | ||
|
||
const queueMsg = `${client.i18n.get(language, "setup", "setup_queuemsg")}`; | ||
|
||
const playEmbed = new EmbedBuilder() | ||
.setColor(client.color) | ||
.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", { | ||
prefix: client.prefix | ||
})}` }); | ||
|
||
await channel.send({ files: [attachment] }); | ||
await channel.send({ content: `${queueMsg}`, embeds: [playEmbed], components: [client.diSwitch] }).then(async (playmsg) => { | ||
await Setup.findOneAndUpdate({ guild: message.guild.id }, { | ||
guild: message.guild.id, | ||
enable: true, | ||
channel: channel.id, | ||
playmsg: playmsg.id, | ||
}); | ||
const embed = new EmbedBuilder() | ||
.setDescription(`${client.i18n.get(language, "setup", "setup_msg", { | ||
channel: channel, | ||
})}`) | ||
.setColor(client.color); | ||
|
||
return message.channel.send({ embeds: [embed] }); | ||
}) | ||
}); | ||
} else { | ||
const embed = new EmbedBuilder() | ||
.setAuthor({ name: `${client.i18n.get(language, "nopremium", "premium_author")}`, iconURL: client.user.displayAvatarURL() }) | ||
.setDescription(`${client.i18n.get(language, "nopremium", "premium_desc")}`) | ||
.setColor(client.color) | ||
.setTimestamp() | ||
|
||
return message.channel.send({ content: " ", embeds: [embed] }); | ||
} | ||
} catch (err) { | ||
console.log(err) | ||
message.channel.send({ content: `${client.i18n.get(language, "nopremium", "premium_error")}` }) | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
const { white, red } = require('chalk'); | ||
|
||
module.exports = async (client) => { | ||
console.log(white('[') + red('WARN') + white('] ') + red('Errored ') + white(`${client.user.tag} (${client.user.id})`) + red(' ')); | ||
module.exports = async (client, error) => { | ||
console.log(white('[') + red('WARN') + white('] ') + red('Errored ') + white(`${client.user.tag} (${client.user.id}) | ${error}`) + red(' ')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const Setup = require("../../settings/models/Setup.js"); | ||
|
||
module.exports = async (client, channel) => { | ||
if (channel.type == 2) { | ||
if (channel.members.has(client.user.id)) { | ||
const player = client.manager.players.get(channel.guild.id); | ||
if (!player) return; | ||
if (channel.id === player.voiceChannel) { | ||
player.destroy(); | ||
} | ||
} | ||
} | ||
|
||
if (channel.type == 0) { | ||
const db = await Setup.findOne({ guild: channel.guild.id }); | ||
if (db.channel == channel.id) { | ||
db.enable = false; | ||
await db.save(); | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
const { EmbedBuilder } = require("discord.js"); | ||
const GLang = require("../../settings/models/Language.js"); | ||
const Setup = require("../../settings/models/Setup.js"); | ||
|
||
module.exports = async (client, interaction) => { | ||
if (!interaction.guild || interaction.user.bot) return; | ||
if (interaction.isButton()) { | ||
const { customId, member } = interaction; | ||
let voiceMember = interaction.guild.members.cache.get(member.id); | ||
let channel = voiceMember.voice.channel; | ||
|
||
let player = await client.manager.get(interaction.guild.id); | ||
if (!player) return; | ||
|
||
const playChannel = client.channels.cache.get(player.textChannel); | ||
if (!playChannel) return; | ||
|
||
let guildModel = await GLang.findOne({ guild: playChannel.guild.id }); | ||
if (!guildModel) { guildModel = await GLang.create({ | ||
guild: playChannel.guild.id, | ||
language: "en", | ||
}); | ||
} | ||
|
||
const { language } = guildModel; | ||
|
||
const db = await Setup.findOne({ guild: playChannel.guild.id }); | ||
if (db.enable === false) return; | ||
|
||
// Here delete interaction.reply! | ||
setTimeout(() => interaction.deleteReply(), 4000); | ||
|
||
switch (customId) { | ||
case "sprevious": | ||
{ | ||
if (!channel) { | ||
return interaction.reply(`${client.i18n.get(language, "noplayer", "no_voice")}`); | ||
} else if (interaction.guild.members.me.voice.channel && !interaction.guild.members.me.voice.channel.equals(channel)) { | ||
return interaction.reply(`${client.i18n.get(language, "noplayer", "no_voice")}`); | ||
} else if (!player || !player.queue.previous) { | ||
return interaction.reply(`${client.i18n.get(language, "music", "previous_notfound")}`); | ||
} else { | ||
await player.queue.unshift(player.queue.previous); | ||
await player.stop(); | ||
|
||
const embed = new EmbedBuilder() | ||
.setDescription(`${client.i18n.get(language, "music", "previous_msg")}`) | ||
.setColor(client.color); | ||
|
||
interaction.reply({ embeds: [embed] }); | ||
} | ||
} | ||
break; | ||
|
||
case "sskip": | ||
{ | ||
if (!channel) { | ||
return interaction.reply(`${client.i18n.get(language, "noplayer", "no_voice")}`); | ||
} else if (interaction.guild.members.me.voice.channel && !interaction.guild.members.me.voice.channel.equals(channel)) { | ||
return interaction.reply(`${client.i18n.get(language, "noplayer", "no_voice")}`); | ||
} else if (!player) { | ||
return interaction.reply(`${client.i18n.get(language, "noplayer", "no_player")}`); | ||
} else {} | ||
if (player.queue.size == 0) { | ||
await player.destroy(); | ||
await client.UpdateMusic(player); | ||
|
||
const embed = new EmbedBuilder() | ||
.setDescription(`${client.i18n.get(language, "music", "skip_msg")}`) | ||
.setColor(client.color); | ||
|
||
interaction.reply({ embeds: [embed] }); | ||
} else { | ||
await player.stop(); | ||
|
||
const embed = new EmbedBuilder() | ||
.setDescription(`${client.i18n.get(language, "music", "skip_msg")}`) | ||
.setColor(client.color); | ||
|
||
interaction.reply({ embeds: [embed] }); | ||
} | ||
} | ||
break; | ||
|
||
case "sstop": | ||
{ | ||
if (!channel) { | ||
return interaction.reply(`${client.i18n.get(language, "noplayer", "no_voice")}`); | ||
} else if (interaction.guild.members.me.voice.channel && !interaction.guild.members.me.voice.channel.equals(channel)) { | ||
return interaction.reply(`${client.i18n.get(language, "noplayer", "no_voice")}`); | ||
} else if (!player) { | ||
return interaction.reply(`${client.i18n.get(language, "noplayer", "no_player")}`); | ||
} else { | ||
await player.destroy(); | ||
await client.UpdateMusic(player); | ||
|
||
const embed = new EmbedBuilder() | ||
.setDescription(`${client.i18n.get(language, "player", "stop_msg")}`) | ||
.setColor(client.color); | ||
|
||
interaction.reply({ embeds: [embed] }); | ||
} | ||
} | ||
break; | ||
|
||
case "spause": | ||
{ | ||
if (!channel) { | ||
return interaction.reply(`${client.i18n.get(language, "noplayer", "no_voice")}`); | ||
} else if (interaction.guild.members.me.voice.channel && !interaction.guild.members.me.voice.channel.equals(channel)) { | ||
return interaction.reply(`${client.i18n.get(language, "noplayer", "no_voice")}`); | ||
} else if (!player) { | ||
return interaction.reply(`${client.i18n.get(language, "noplayer", "no_player")}`); | ||
} else { | ||
await player.pause(!player.paused); | ||
const uni = player.paused ? `${client.i18n.get(language, "player", "switch_pause")}` : `${client.i18n.get(language, "player", "switch_resume")}`; | ||
|
||
const embed = new EmbedBuilder() | ||
.setDescription(`${client.i18n.get(language, "player", "pause_msg", { | ||
pause: uni, | ||
})}`) | ||
.setColor(client.color); | ||
|
||
interaction.reply({ embeds: [embed] }); | ||
} | ||
} | ||
break; | ||
|
||
case "sloop": | ||
{ | ||
if (!channel) { | ||
return interaction.reply(`${client.i18n.get(language, "noplayer", "no_voice")}`); | ||
} else if (interaction.guild.members.me.voice.channel && !interaction.guild.members.me.voice.channel.equals(channel)) { | ||
return interaction.reply(`${client.i18n.get(language, "noplayer", "no_voice")}`); | ||
} else if (!player) { | ||
return interaction.reply(`${client.i18n.get(language, "noplayer", "no_player")}`); | ||
} else { | ||
await player.setQueueRepeat(!player.queueRepeat); | ||
const uni = player.queueRepeat ? `${client.i18n.get(language, "player", "switch_enable")}` : `${client.i18n.get(language, "player", "switch_disable")}`; | ||
|
||
const embed = new EmbedBuilder() | ||
.setDescription(`${client.i18n.get(language, "player", "repeat_msg", { | ||
loop: uni, | ||
})}`) | ||
.setColor(client.color); | ||
|
||
interaction.reply({ embeds: [embed] }); | ||
} | ||
} | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
} |
Oops, something went wrong.