remove unused things due to copyright

This commit is contained in:
NK 2023-01-31 14:06:38 +00:00
parent eabc27286b
commit 5015b7a9dc
82 changed files with 10 additions and 5788 deletions

View file

@ -32,12 +32,12 @@ class NYX extends Client {
],
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildMessageTyping,
// GatewayIntentBits.GuildMembers,
// GatewayIntentBits.MessageContent,
// GatewayIntentBits.GuildPresences,
// GatewayIntentBits.GuildMessages,
// GatewayIntentBits.GuildMessageReactions,
// GatewayIntentBits.GuildMessageTyping,
],
}
) {

View file

@ -3,7 +3,6 @@ const c = require("../../client/CODMClient");
module.exports = {
name: "scorestreak",
description: "Get Scorestreak stats",
usage: "{Scorestreak}",
category: "CODM",
options: [

View file

@ -41,12 +41,12 @@
},
"dependencies": {
"axios": "^1.1.3",
"cath": "^1.4.7",
"cath": "^1.5.0",
"discord.js": "^14.6.0",
"dotenv": "^16.0.0",
"dotenv": "^16.0.3",
"goosecache": "^9.0.14",
"moment": "^2.29.1",
"moment": "^2.29.4",
"mongoose": "^5.13.14",
"quickchart-js": "^3.0.0"
"quickchart-js": "^3.1.0"
}
}

View file

@ -1,2 +0,0 @@
const { CodeClient } = require("cath");
module.exports = new CodeClient();

View file

@ -1,38 +0,0 @@
const { GiveawaysClient } = require("cath");
const client = require("../..");
require("dotenv").config();
module.exports = new GiveawaysClient({
client,
MongooseConnectionURI: process.env.MONGO,
GiveawayMessages: {
dmWinner: true,
giveaway: "🎉 **GIVEAWAY** 🎉",
giveawayDescription:
"🎁 Prize: **{award}**\n🎊 Hosted by: {hostedBy}\n⏲ Winner(s): `{winners}` \n🙏 Entrants: {totalParticipants} \n\n**Requirements:** {requirements}",
endedGiveawayDescription:
"🎁 Prize: **{award}**\n🎊 Hosted by: {hostedBy}\n⏲ Winner(s): {winners} \n🙏 Entrants: {totalParticipants}",
giveawayFooterImage: "https://emoji.gg/assets/emoji/3461-giveaway.gif",
winMessage:
"Congratulations {winners}! You have won **{award}** from total `{totalParticipants}` entrants!",
rerolledMessage: "Rerolled! {winner} is the new winner of the giveaway!",
toParticipate: "**Click the `Enter` button to enter the giveaway!**",
newParticipant:
"You have successfully entered for this giveaway! There are total `{totalParticipants}` entrants",
alreadyParticipated: "**You have already participated in this giveaway!**",
noParticipants: "There isn't enough entrant in this giveaway!",
noRole:
"You don't have the required role(s)\n{requiredRoles}\n for the giveaway!",
dmMessage:
"You have won a giveaway in **{guildName}**!\nPrize: [{award}]({giveawayURL})",
noWinner:
"There isn't any winner in this giveaway due to not enough entrants",
alreadyEnded: "The giveaway had already ended!",
dropWin: "{winner} Won The Drop!!",
noWeeklyExp:
"you dont have the required minimum weekly xp to join this giveaway",
noLevel: "You dont have the minimum required level to join this giveaway",
nonoRole:
"You do not have the {requiredRoles} role(s) which is required to join this giveaway",
editParticipants: true,
},
});

View file

@ -1,6 +0,0 @@
const { StarboardClient } = require("cath");
const client = require("../..");
module.exports = new StarboardClient({
client,
color: client.color,
});

View file

@ -1,2 +0,0 @@
const { URLClient } = require("cath");
module.exports = new URLClient();

View file

@ -1,39 +0,0 @@
const { readdirSync } = require("fs");
const utils = require("../util/functions/function");
function cmds() {
const categories = [];
readdirSync("./commands").forEach(dir => {
const dirs = readdirSync(`./commands/${dir}`).filter(file =>
file.endsWith(".js")
);
const commands = [];
dirs.map(cmd => {
const file = require(`../../commands/${dir}/${cmd}`);
commands.push({
name: file.name ? file.name : "No command name",
description: file.description
? file.description
: "No command description",
aliases: file.aliases ? file.aliases : "No command aliases",
usage: file.usage ? `C.${file.name} ${file.usage}` : `C.${file.name}`,
timeout: file.timeout
? utils.ms(file.timeout, { long: true })
: "No command cooldown",
BotPermission: file.BotPerms
? file.BotPerms
: "No required bot permission",
UserPermission: file.UserPerms
? file.UserPerms
: "No required user permission",
status: file.status ? file.status : true,
});
});
const data = {
name: dir,
commands,
};
categories.push(data);
});
return categories;
}
module.exports = { cmds };

View file

@ -1,125 +0,0 @@
const schema = require("../../models/modmail");
module.exports = {
name: "choices",
UserPerm: "ADMINISTRATOR",
description: "Add choices for modmail in a server",
usage: "(add/list/rmv) (Emoji) {Text}",
category: "Config",
run: async (client, message, args) => {
schema.findOne({ Guild: message.guild.id }, async (err, data) => {
if (data) {return;}
else {
new schema({
Guild: message.guild.id,
}).save();
}
});
if (args[0].toLowerCase() === "add") {
if (!args[1]) return client.err(message, "Config", "choices", 11);
if (!args[2]) return client.err(message, "Config", "choices", 12);
if (!args.slice(2).join(" ").length > 100) {return client.err(message, "Config", "choices", 13);}
const config = await schema.findOne({ Guild: message.guild.id });
if (
!config ||
!config.Choices ||
!Object.entries(config.Choices).length
) {
const choices = {
0: {
emoji: args[1],
text: args.slice(2).join(" "),
},
};
schema.findOne({ Guild: message.guild.id }, async (err, data) => {
if (data) {
if (data.Choices) {
data.Choices = choices;
await schema.findOneAndUpdate({ Guild: message.guild.id }, data);
}
else if (data.Guild) {
data.Choices = choices;
await schema.findOneAndUpdate({ Guild: message.guild.id }, data);
}
else {
new schema({
Guild: message.guild.id,
Choices: choices,
}).save();
}
}
});
return message.channel.send({
content: `${message.author.tag} has added ${args[1]} as a modmail choice`,
});
}
else {
const choices = Object.entries(config.Choices);
if (choices.length >= 5) {return client.err(message, "Config", "choices", 14);}
const last = choices[choices.length - 1];
const parsed = config.Choices;
parsed[(parseInt(last[0]) + 1).toString()] = {
emoji: args[1],
text: args.slice(2).join(" "),
};
schema.findOne({ Guild: message.guild.id }, async (err, data) => {
if (data) {
data.Choices = parsed;
await schema.findOneAndUpdate({ Guild: message.guild.id }, data);
}
else {
new schema({
Guild: message.guild.id,
Choices: parsed,
}).save();
}
});
return message.channel.send({
content: `${message.author.tag} has added ${args[1]} as a modmail choice`,
});
}
}
if (args[0].toLowerCase() === "list") {
const Data = await schema.findOne({ Guild: message.guild.id });
if (!Data || !Data.Choices || !Object.entries(Data.Choices).length) {return client.err(message, "Config", "choices", 10);}
else {
return message.channel.send(
Object.entries(Data.Choices)
.map(value => {
return `${value[1].emoji}: ${value[1].text}`;
})
.join("\n"),
);
}
}
if (args[0].toLowerCase() === "rmv") {
if (!args[1]) return client.err(message, "Config", "choices", 11);
schema.findOne({ Guild: message.guild.id }, async (err, data) => {
if (!data || !data.Choices || !Object.entries(data.Choices).length) {return client.err(message, "Config", "choices", 10);}
const choices = Object.entries(data.Choices);
const found = choices.find(value => value[1].emoji == args[1]);
if (!found) return client.err(message, "Config", "choices", 15);
const filtered = choices.filter(value => value[1].emoji != args[1]);
const parsed = {};
filtered.map(value => {
parsed[value[0]] = {
emoji: value[1].emoji,
text: value[1].text,
};
});
if (data) {
data.Choices = parsed;
await schema.findOneAndUpdate({ Guild: message.guild.id }, data);
}
else {
new schema({
Guild: message.guild.id,
Choices: parsed,
}).save();
}
});
return message.channel.send({
content: `${args[1]} is removed from choices.`,
});
}
},
};

View file

@ -1,20 +0,0 @@
const schema = require("../../models/custom-commands");
const { EmbedBuilder } = require("discord.js");
module.exports = {
name: "cc-list",
UserPerm: "ADMINISTRATOR",
description: "Check the custom commands in a server",
category: "Config",
run: async (client, message, args) => {
const data = await schema.find({ Guild: message.guild.id });
if (!!data === false) return client.err(messgae, "Config", "cmd-list", 10);
message.channel.send(
new EmbedBuilder()
.setColor(client.color)
.setDescription(
data.map((cmd, i) => `${i + 1}: ${cmd.Command}`).join("\n")
)
);
},
};

View file

@ -1,429 +0,0 @@
const Discord = require("discord.js");
const db = require("../../models/custom-commands");
module.exports = {
name: "cc-create",
UserPerm: "ADMINISTRATOR",
description: "Crate custom commands for a server",
category: "Config",
run: async (client, message, args) => {
message.delete();
message.channel.send(
new Discord.EmbedBuilder()
.setTitle(`Setup | 1/3`)
.setDescription(
"What is the name of the command?\nYou can cancel the setup at any time by sending `cancel`."
)
.setColor(client.color)
);
await startMessageCollectors(client, message, args);
function startMessageCollectors(client, message, args) {
const nameFilter = m => m.author.id === message.author.id;
const nameCollector = new Discord.MessageCollector(
message.channel,
nameFilter,
{ max: 999 }
);
nameCollector.on("collect", async msg => {
const name = msg.content.toLowerCase();
const data = await db.findOne({
Guild: message.guild.id,
Command: name,
});
if (data) {
nameCollector.stop();
return message.reply("This command has already exist.");
}
if (name === "cancel") {
msg.channel.send("The setup has been cancelled.");
db.findOneAndDelete({ Guild: message.guild.id, Command: name });
nameCollector.stop();
return;
}
if (!name) {
await msg.channel.send("You don't specify a name. Cancelled setup.");
nameCollector.stop();
return;
} else {
const newDB = new db({
Guild: message.guild.id,
Command: name,
});
await newDB.save();
console.log(newDB);
msg.channel.send(
new Discord.EmbedBuilder()
.setTitle(`Setup | 2/3`)
.setDescription(
`The command name will be **${name}**.\nWhat is the response for the command? You can have mutliple response by joning them with differnt lines.`
)
.setColor(client.color)
);
nameCollector.stop();
}
const responseFilter = m => m.author.id === message.author.id;
const responseCollector = new Discord.MessageCollector(
message.channel,
responseFilter,
{ max: 999 }
);
responseCollector.on("collect", async msg => {
const response = msg.content.split("\n");
console.log(`Response: ${response}`);
if (msg.content.toLowerCase() === "cancel") {
msg.channel.send("The setup has been cancelled.");
responseCollector.stop();
return;
}
if (!response) {
msg.channel.send(`You didn't specify a response. Setup cancelled.`);
responseCollector.stop();
}
if (response.length > 1) {
responseCollector.stop();
await db.findOne(
{ Guild: message.guild.id, Command: name },
async (err, data) => {
if (data) {
data.Response = response;
await db.findOneAndUpdate(
{ Guild: message.guild.id, Command: name },
data
);
console.log(data);
}
}
);
msg.channel.send(
new Discord.EmbedBuilder()
.setTitle(`Setup | 3/4`)
.setColor(client.color)
.setDescription(
`Ok so there will be ${response.length} responses. Do you want the response be randomized?\n\`Type yes or no\` \nIf you choose no, accumlative responses may let the command can\'t be sent out.`
)
);
const randomFilter = m => m.author.id === message.author.id;
const randomCollector = new Discord.MessageCollector(
message.channel,
randomFilter,
{ max: 999 }
);
randomCollector.on("collect", async msg => {
let maybe;
if (msg.content.toLowerCase() === "yes") {
msg.channel.send(
new Discord.EmbedBuilder()
.setColor(client.color)
.setTitle(`Setup | 4/4`)
.setDescription(
`The responses will be randomized. Do you want to have delete command usage? \`Type yes or no\``
)
);
randomCollector.stop();
maybe = true;
await db.findOne(
{
Guild: message.guild.id,
Response: response,
Command: name,
},
async (err, data) => {
if (data) {
data.Random = maybe;
await db.findOneAndUpdate(
{
Guild: message.guild.id,
Command: name,
Response: response,
},
data
);
console.log(data);
}
}
);
console.log(`Random: ${maybe}`);
const deleteeeFilter = m => m.author.id === message.author.id;
const deleteeeCollector = new Discord.MessageCollector(
message.channel,
deleteeeFilter,
{ max: 999 }
);
deleteeeCollector.on("collect", async msg => {
let idkwor;
if (msg.content.toLowerCase() === "yes") {
deleteeeCollector.stop();
idkwor = true;
await db.findOne(
{
Guild: message.guild.id,
Command: name,
Response: response,
Random: maybe,
},
async (err, data) => {
if (data) {
data.Delete = idkwor;
await db.findOneAndUpdate(
{
Guild: message.guild.id,
Command: name,
Response: response,
Random: maybe,
},
data
);
console.log(data);
msg.reply(
`Saved **${data.Command}** as a custom command`
);
}
}
);
console.log(`Usage Delete: ${idkwor}`);
}
if (msg.content.toLowerCase() === "no") {
deleteeeCollector.stop();
idkwor = false;
await db.findOne(
{
Guild: message.guild.id,
Command: name,
Response: response,
Random: maybe,
},
async (err, data) => {
if (data) {
data.Delete = idkwor;
await db.findOneAndUpdate(
{
Guild: message.guild.id,
Command: name,
Response: response,
Random: maybe,
},
data
);
console.log(data);
msg.reply(
`Saved **${data.Command}** as a custom command`
);
}
}
);
}
if (msg.content.toLowerCase() === "cancel") {
msg.channel.send("The setup has been cancelled.");
deleteeeCollector.stop();
return;
}
});
}
if (msg.content.toLowerCase() === "no") {
msg.channel.send(
new Discord.EmbedBuilder()
.setColor(client.color)
.setTitle(`Setup | 4/4`)
.setDescription(
`The responses won't be randomized. Do you want to have delete command usage? \`Type yes or no\``
)
);
randomCollector.stop();
maybe = false;
await db.findOne(
{
Guild: message.guild.id,
Command: name,
Response: response,
},
async (err, data) => {
if (data) {
data.Random = maybe;
await db.findOneAndUpdate(
{
Guild: message.guild.id,
Command: name,
Response: response,
},
data
);
console.log(data);
}
}
);
const deleteeFilter = m => m.author.id === message.author.id;
const deleteeCollector = new Discord.MessageCollector(
message.channel,
deleteeFilter,
{ max: 999 }
);
deleteeCollector.on("collect", async msg => {
let idkwor;
if (msg.content.toLowerCase() === "yes") {
deleteeCollector.stop();
idkwor = true;
await db.findOne(
{
Guild: message.guild.id,
Command: name,
Response: response,
},
async (err, data) => {
if (data) {
data.Delete = idkwor;
await db.findOneAndUpdate(
{
Guild: message.guild.id,
Command: name,
Response: response,
Random: maybe,
},
data
);
msg.reply(
`Saved **${data.Command}** as a custom command`
);
}
}
);
console.log(`Usage Delete: ${idkwor}`);
}
if (msg.content.toLowerCase() === "no") {
deleteeCollector.stop();
idkwor = false;
await db.findOne(
{
Guild: message.guild.id,
Command: name,
Response: response,
Random: maybe,
},
async (err, data) => {
if (data) {
data.Delete = idkwor;
await db.findOneAndUpdate(
{
Guild: message.guild.id,
Command: name,
Response: response,
},
data
);
msg.reply(
`Saved **${data.Command}** as a custom command`
);
}
}
);
}
if (msg.content.toLowerCase() === "cancel") {
msg.channel.send("The setup has been cancelled.");
deleteeCollector.stop();
return;
}
});
}
if (msg.content.toLowerCase() === "cancel") {
msg.channel.send("The setup has been cancelled.");
randomCollector.stop();
return;
}
});
} else {
await db.findOne(
{ Guild: message.guild.id, Command: name },
async (err, data) => {
if (data) {
data.Response = response;
await db.findOneAndUpdate(
{ Guild: message.guild.id, Command: name },
data
);
console.log(data);
}
}
);
msg.channel.send(
new Discord.EmbedBuilder()
.setTitle(`Setup | 3/3`)
.setColor(client.color)
.setDescription(
`The response is \n**${response}**\nDo you to want have delete command usage?`
)
);
responseCollector.stop();
const deleteFilter = m => m.author.id === message.author.id;
const deleteCollector = new Discord.MessageCollector(
message.channel,
deleteFilter,
{ max: 999 }
);
deleteCollector.on("collect", async msg => {
let idkwor;
if (msg.content.toLowerCase() === "yes") {
deleteCollector.stop();
idkwor = true;
await db.findOne(
{
Guild: message.guild.id,
Command: name,
Response: response,
},
async (err, data) => {
if (data) {
data.Delete = idkwor;
await db.findOneAndUpdate(
{
Guild: message.guild.id,
Command: name,
Response: response,
},
data
);
msg.reply(
`Saved **${data.Command}** as a custom command`
);
}
}
);
}
if (msg.content.toLowerCase() === "no") {
deleteCollector.stop();
idkwor = false;
await db.findOne(
{
Guild: message.guild.id,
Command: name,
Response: response,
},
async (err, data) => {
if (data) {
data.Delete = idkwor;
await db.findOneAndUpdate(
{
Guild: message.guild.id,
Command: name,
Response: response,
},
data
);
msg.reply(
`Saved **${data.Command}** as a custom command`
);
}
}
);
}
if (msg.content.toLowerCase() === "cancel") {
msg.channel.send("The setup has been cancelled.");
deleteCollector.stop();
return;
}
});
}
});
});
}
},
};

View file

@ -1,20 +0,0 @@
const schema = require("../../models/custom-commands");
module.exports = {
name: "cc-delete",
UserPerm: "ADMINISTRATOR",
usage: "(command)",
description: "Delete a custom command for a server",
category: "Config",
run: async (client, message, args) => {
const name = args[0];
if (!name) return client.err(message, "Config", "cc-delete", 47);
const data = await schema.findOne({
Guild: message.guild.id,
Command: name,
});
if (!data) return client.err(message, "Config", "cc-delete", 404);
await schema.findOneAndDelete({ Guild: message.guild.id, Command: name });
message.reply(`Removed **${name}** from custom commands.`);
},
};

View file

@ -1,21 +0,0 @@
const { Client, Message, EmbedBuilder } = require("discord.js");
module.exports = {
name: "migrate",
usage: "(Server ID)",
description: "Migrate all emojis from a server",
category: "Config",
run: async (client, message, args) => {
try {
const oldGuild = args[0];
if (!oldGuild) return;
old = client.guilds.cache.get(oldGuild);
if (!old) return client.err(message, "Config", "migrate", 404);
await old.emojis.cache.map(async e => {
await message.guild.emojis.create(e.url, e.name);
});
return message.channel.send(`Created Emotes.`);
} catch (e) {
console.log(e);
}
},
};

View file

@ -1,33 +0,0 @@
const schema = require("../../models/modmail");
const { Client, Message, EmbedBuilder } = require("discord.js");
module.exports = {
name: "modmail-category",
UserPerm: "ADMINISTRATOR",
description: "Setup modmail category in a server",
usage: "(Category ID)",
category: "Config",
run: async (client, message, args) => {
if (!args.length) {
return client.err(message, "Config", "modmail-category", 0);
}
const category = message.guild.channels.cache.find(
ch => (ch.type = "GUILD_CATEGORY" && ch.id == args[0])
);
if (!category) return client.err(message, "Config", "modmail-category", 1);
schema.findOne({ Guild: message.guild.id }, async (err, data) => {
if (data) {
data.Category = category.id;
await schema.findOneAndUpdate({ Guild: message.guild.id }, data);
} else {
new schema({
Guild: message.guild.id,
Category: category.id,
}).save();
}
});
return message.channel.send({
content: `**Saved category to ${category.name}**`,
});
},
};

View file

@ -1,30 +0,0 @@
const schema = require("../../models/modmail");
module.exports = {
name: "modmail-role",
UserPerm: "ADMINISTRATOR",
description: "Add role for modmail in a server",
usage: "(Role)",
category: "Config",
run: async (client, message, args) => {
if (!args.length) return client.err(message, "Config", "modmail-role", 0);
const role =
message.mentions.roles.first() || message.guild.roles.cache.get(args[0]);
if (!role) return client.err(message, "Config", "modmail-role", 404);
schema.findOne({ Guild: message.guild.id }, async (err, data) => {
if (data) {
data.Role = role.id;
await schema.findOneAndUpdate({ Guild: message.guild.id }, data);
}
else {
new schema({
Guild: message.guild.id,
Role: role.id,
}).save();
}
});
return message.channel.send({
content: `Updated **${role.name}** as the modmail role`,
});
},
};

View file

@ -1,32 +0,0 @@
const { EmbedBuilder } = require("discord.js");
module.exports = {
name: "balance",
description: "Show an user's balance",
usage: "(User)",
category: "Economy",
options: [
{
type: 6,
name: "user",
description: "The user you want to see",
required: false,
},
],
run: async (client, interaction, args) => {
const user =
interaction.guild.members.cache.get(args[0]) || interaction.member;
const bal = await client.bal(user.id);
const embed = new EmbedBuilder()
.setTitle(`${user.displayName}'s Balance`)
.setDescription(`**${bal}** ${client.currency}`)
.setColor(client.color)
.setURL(client.web)
.setTimestamp()
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
});
interaction.followUp({ embeds: [embed] });
},
};

View file

@ -1,87 +0,0 @@
const { EmbedBuilder } = require("discord.js");
const { bool } = require("cath");
module.exports = {
name: "bet",
usage: "(Number)",
timeout: 5000,
description: "Win double amount of coins or lose all coins",
category: "Economy",
options: [
{
type: 4,
name: "cp",
description: "The number of CP you want to bet",
required: true,
},
],
run: async (client, interaction, args) => {
const max = 100000;
let amt = args[0];
if (amt > max) amt = max;
const winamt = amt * 2;
if (args[0] < 100) {
interaction.followUp({
content: `You need to bet at least 100${client.currency}`,
});
} else if ((await client.bal(interaction.user.id)) < amt) {
interaction.followUp({ content: "You don't have enough balance" });
} else if (bool()) {
const multi = (await client.multi(interaction)) / 10 + 1;
await client.add(interaction.user.id, winamt, interaction);
await client.ADDBWin(interaction.user.id);
const abc = new EmbedBuilder()
.setColor("GREEN")
.setTimestamp()
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTitle(`${interaction.user.username} wins a gamble game`)
.addFields(
{
name: "Won",
value: `**${Math.round(winamt * multi)}**${client.currency}`,
inline: true,
},
{
name: "New Balance",
value: `**${Math.round(
(await client.bal(interaction.user.id)) + winamt * multi
)}**${client.currency}`,
inline: true,
},
{
name: "Multiplier",
value: `x${2 + multi}`,
inline: true,
}
);
interaction.followUp({ embeds: [abc] });
} else {
await client.rmv(interaction.user.id, amt);
const cba = new EmbedBuilder()
.setColor("RED")
.setTimestamp()
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTitle(`${interaction.user.username} loses a gamble game`)
.addFields(
{
name: "Lost",
value: `**${amt}**${client.currency}`,
inline: true,
},
{
name: "New Balance",
value: `**${
parseInt(await client.bal(interaction.user.id)) - amt
}**${client.currency}`,
inline: true,
}
);
interaction.followUp({ embeds: [cba] });
}
},
};

View file

@ -1,307 +0,0 @@
const Discord = require("discord.js");
module.exports = {
name: "blackjack",
usage: "(Number)",
description: "Play a blackjack game to win money",
category: "Economy",
timeout: 10000,
options: [
{
type: 4,
name: "cp",
description: "The number of CP you want to give",
required: true,
},
],
run: async (client, interaction, args) => {
let money = args[0];
const max = 100000;
if (money > max) money = max;
const user = interaction.user;
if (money < 100) {
interaction.followUp({
content: `You need to blackjack at least 100 ${client.currency}`,
});
} else if ((await client.bal(user.id)) < money) {
interaction.followUp({ content: "You don't have enough balance" });
} else {
let numCardsPulled = 0;
let gameOver = false;
const player = {
cards: [],
score: 0,
};
const dealer = {
cards: [],
score: 0,
};
function getCardsValue(a) {
let cardArray = [],
sum = 0,
i = 0,
dk = 10.5,
doubleking = "QQ",
aceCount = 0;
cardArray = a;
for (i; i < cardArray.length; i += 1) {
if (
cardArray[i].rank === "J" ||
cardArray[i].rank === "Q" ||
cardArray[i].rank === "K"
) {
sum += 10;
} else if (cardArray[i].rank === "A") {
sum += 11;
aceCount += 1;
} else if (cardArray[i].rank === doubleking) {
sum += dk;
} else {
sum += cardArray[i].rank;
}
}
while (aceCount > 0 && sum > 21) {
sum -= 10;
aceCount -= 1;
}
return sum;
}
const deck = {
deckArray: [],
initialize: function () {
let suitArray, rankArray, s, r, n;
suitArray = ["b", "d", "g", "s"];
rankArray = [2, 3, 4, 5, 6, 7, 8, 9, 10, "J", "Q", "K", "A"];
n = 13;
for (s = 0; s < suitArray.length; s += 1) {
for (r = 0; r < rankArray.length; r += 1) {
this.deckArray[s * n + r] = {
rank: rankArray[r],
suit: suitArray[s],
};
}
}
},
shuffle: function () {
let temp, i, rnd;
for (i = 0; i < this.deckArray.length; i += 1) {
rnd = Math.floor(Math.random() * this.deckArray.length);
temp = this.deckArray[i];
this.deckArray[i] = this.deckArray[rnd];
this.deckArray[rnd] = temp;
}
},
};
deck.initialize();
deck.shuffle();
async function bet(outcome) {
if (outcome === "win") {
await client.add(user.id, money, interaction);
await client.ADDBJWin(interaction.user.id);
}
if (outcome === "lose") {
await client.rmv(user.id, money);
}
}
function endMsg(f, msg, cl, dealerC) {
let cardsMsg = "";
player.cards.forEach(function (card) {
const emAR = ["♥", "♦", "♠", "♣"];
const t = emAR[Math.floor(Math.random() * emAR.length)];
cardsMsg += "[`" + t + card.rank.toString();
if (card.suit == "d1") cardsMsg += "♥";
if (card.suit == "d2") cardsMsg += "♦";
if (card.suit == "d3") cardsMsg += "♠";
if (card.suit == "d4") cardsMsg += "♣";
cardsMsg += "`](https://cath.gq/) ";
});
cardsMsg += " > " + player.score.toString();
let dealerMsg = "";
if (!dealerC) {
const emAR = ["♥", "♦", "♠", "♣"];
const t = emAR[Math.floor(Math.random() * emAR.length)];
dealerMsg = "[`" + t + dealer.cards[0].rank.toString();
if (dealer.cards[0].suit == "d1") dealerMsg += "♥";
if (dealer.cards[0].suit == "d2") dealerMsg += "♦";
if (dealer.cards[0].suit == "d3") dealerMsg += "♠";
if (dealer.cards[0].suit == "d4") dealerMsg += "♣";
dealerMsg += " ? ?`](https://cath.gq/)";
} else {
dealerMsg = "";
dealer.cards.forEach(function (card) {
const emAR = ["♥", "♦", "♠", "♣"];
const t = emAR[Math.floor(Math.random() * emAR.length)];
dealerMsg += "[`" + t + card.rank.toString();
if (card.suit == "d1") dealerMsg += "♥";
if (card.suit == "d2") dealerMsg += "♦";
if (card.suit == "d3") dealerMsg += "♠";
if (card.suit == "d4") dealerMsg += "♣";
dealerMsg += "`](https://cath.gq/) ";
});
dealerMsg += " > " + dealer.score.toString();
}
const gambleEmbed = new Discord.EmbedBuilder()
.setColor(cl || client.color)
.setTimestamp()
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTitle(interaction.user.username + `'s Blackjack game`)
.addField("You", cardsMsg, true)
.addField("NYX", dealerMsg, true)
.addField(f, msg);
interaction.followUp({ embeds: [gambleEmbed] });
}
async function endGame() {
if (player.score === 21) {
bet("win");
gameOver = true;
await endMsg(
`Win! You got 21!`,
`NYX had ${dealer.score.toString()}`,
`GREEN`
);
}
if (player.score > 21) {
bet("lose");
gameOver = true;
await endMsg(
`Lost! You reached over 21!`,
`NYX had ${dealer.score.toString()}`,
`RED`
);
}
if (dealer.score === 21) {
bet("lose");
gameOver = true;
await endMsg(
`Lost! The dealer got 21!`,
`NYX had ${dealer.score.toString()}`,
`RED`
);
}
if (dealer.score > 21) {
bet("win");
gameOver = true;
await endMsg(
`Win! NYX reached over 21!`,
`NYX had ${dealer.score.toString()}`,
`GREEN`
);
}
if (
dealer.score >= 17 &&
player.score > dealer.score &&
player.score < 21
) {
bet("win");
gameOver = true;
await endMsg(
`Win! You defeated NYX!`,
`NYX had ${dealer.score.toString()}`,
`GREEN`
);
}
if (
dealer.score >= 17 &&
player.score < dealer.score &&
dealer.score < 21
) {
bet("lose");
gameOver = true;
await endMsg(
`Lost! NYX won!`,
`NYX had ${dealer.score.toString()}`,
`RED`
);
}
if (
dealer.score >= 17 &&
player.score === dealer.score &&
dealer.score < 21
) {
gameOver = true;
await endMsg(`Tie!`, `NYX had ${dealer.score.toString()}`, `RED`);
}
}
function dealerDraw() {
dealer.cards.push(deck.deckArray[numCardsPulled]);
dealer.score = getCardsValue(dealer.cards);
numCardsPulled += 1;
}
function newGame() {
hit();
hit();
dealerDraw();
endGame();
}
function hit() {
player.cards.push(deck.deckArray[numCardsPulled]);
player.score = getCardsValue(player.cards);
numCardsPulled += 1;
if (numCardsPulled > 2) {
endGame();
}
}
function stand() {
while (dealer.score < 17) {
dealerDraw();
}
endGame();
}
newGame();
async function loop() {
if (gameOver) return;
endMsg(
"To hit type `h`, for stand type `s`",
`GoodLuck ;)`,
client.color
);
const filter = m => m.author.id === interaction.user.id;
interaction.channel
.awaitMessages({ filter, max: 1, time: 1200000, errors: ["time"] })
.then(interaction => {
interaction = interaction.first();
if (
interaction.content.toLowerCase() === "h" ||
interaction.content.toLowerCase() === "hit"
) {
hit();
loop();
return;
} else if (
interaction.content.toLowerCase() === "s" ||
interaction.content.toLowerCase() === "stand"
) {
stand();
loop();
return;
} else {
bet("lose");
endMsg("Invalid response", `You lost ${money}`, "RED");
return;
}
})
.catch(_ => {
interaction.channel.send({ content: "Lost!!" });
bet("lose");
return;
});
}
await loop();
}
},
};

View file

@ -1,103 +0,0 @@
const { EmbedBuilder } = require("discord.js");
const inventory = require("../../models/econ");
const items = require("../../util/Data/item.json");
module.exports = {
name: "buy",
usage: "(Item)",
description: "Buy something from the shop",
category: "Economy",
options: [
{
type: 3,
name: "item",
description: "The item to buy",
required: true,
},
{
type: 4,
name: "amount",
description: "The amount to buy",
required: true,
},
],
run: async (client, interaction, args) => {
const itemToBuy = args[0].toLowerCase();
const validItem = !!items.find(item => item.aliases.includes(itemToBuy));
const num = args[1];
if (num < 0) {
interaction.followUp({
content: `You need to buy at least 1 item`,
});
} else if (!validItem) {
interaction.followUp({
content:
"The item is not valid\nIf you want to get information about the item, use `/shop`",
});
} else {
const itemName = items.find(item =>
item.aliases.includes(itemToBuy)
).name;
const dbName = items.find(item =>
item.aliases.includes(itemToBuy)
).dbname;
const itemPrice = items.find(item =>
item.aliases.includes(itemToBuy)
).price;
const itemEmoji = items.find(item =>
item.aliases.includes(itemToBuy)
).emoji;
const buyable = items.find(item =>
item.aliases.includes(itemToBuy)
).buyable;
if ((await client.bal(interaction.user.id)) < itemPrice * num) {
interaction.followUp({ content: "You don't have enough balance" });
} else if (!buyable) {
interaction.followUp({ content: `That item isn't buyable` });
} else {
const params = { User: interaction.user.id };
inventory.findOne(params, async (err, data) => {
if (data) {
const hasItem = Object.keys(data.Inventory).includes(dbName);
if (!hasItem) {
data.Inventory[dbName] += num;
} else {
data.Inventory[dbName] += num;
}
await inventory.findOneAndUpdate(params, data);
} else {
new inventory({
User: interaction.user.id,
Inventory: {
[dbName]: num,
},
}).save();
}
});
interaction.followUp({
embeds: [
new EmbedBuilder()
.setTimestamp()
.setDescription(
`**${
interaction.user.username
}** buys ** ${num} ${itemEmoji}${itemName}** for **${
itemPrice * num
}**${client.currency}`
)
.setColor("GREEN")
.setURL(client.web)
.setAuthor(
interaction.user.tag,
interaction.user.displayAvatarURL({ dynamic: true })
)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
}),
],
});
await client.rmv(interaction.user.id, itemPrice * num);
}
}
},
};

View file

@ -1,49 +0,0 @@
const { EmbedBuilder } = require("discord.js");
module.exports = {
name: "daily",
description: "Earns daily money",
category: "Economy",
timeout: 1000 * 60 * 60 * 24,
run: async (client, interaction, args) => {
let money;
const user = await client.data.getUser(interaction.user.id);
if (user) {
if (user.Premium == true) {
money = 20000;
const pre_embed = new EmbedBuilder()
.setTitle(`${user.username}'s profile`)
.setDescription(
`Here is your daily **${money}** ${client.currency}\nYou can use this again in 24hrs`
)
.setURL(client.web)
.setColor(client.color)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp();
await client.add(interaction.user.id, money, interaction);
return interaction.followUp({ embeds: [pre_embed] });
} else {
money = 10000;
const norm_embed = new EmbedBuilder()
.setAuthor(
interaction.user.tag,
interaction.user.displayAvatarURL({ dyanmic: true })
)
.setDescription(
`Here is your daily ${money}${client.currency}!\nBe [premium](https://discord.gg/SbQHChmGcp) user, you can get more coins everyday!`
)
.setURL(client.web)
.setColor(client.color)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp();
await client.add(interaction.user.id, money, interaction);
return interaction.followUp({ embeds: [norm_embed] });
}
}
},
};

View file

@ -1,136 +0,0 @@
const { EmbedBuilder } = require("discord.js");
const inventory = require("../../models/econ");
const items = require("../../util/Data/item.json");
module.exports = {
name: "gift",
timeout: 5000,
usage: "(User) (Item)",
description: "Gift item to an user",
category: "Economy",
options: [
{
type: 6,
name: "user",
description: "The user you want to gift",
required: true,
},
{
type: 3,
name: "item",
description: "The item to gift",
required: true,
},
{
type: 4,
name: "amount",
description: "The amount to gift",
required: true,
},
],
run: async (client, interaction, args) => {
const user = interaction.guild.members.cache.get(args[0]);
if (user.id === interaction.user.id) {
interaction.followUp({ content: "You can't gift yourself items" });
}
const itemToGift = args[1].toLowerCase();
const number = args[2];
const validItem = !!items.find(item => item.aliases.includes(itemToGift));
if (number < 0) {
interaction.followUp({
content: `You need to gift at least 1 item`,
});
} else if (!validItem) {
interaction.followUp({
content:
"The item is not valid\nIf you want to get information about the item, use `/shop`",
});
} else {
const params = {
User: interaction.user.id,
};
const param = {
User: user.id,
};
const itemName = items.find(item =>
item.aliases.includes(itemToGift)
).name;
const dbName = items.find(item =>
item.aliases.includes(itemToGift)
).dbname;
const itemEmoji = items.find(item =>
item.aliases.includes(itemToGift)
).emoji;
inventory.findOne(params, async (err, data) => {
if (data.Inventory) {
const hasItem = Object.keys(data.Inventory).includes(dbName);
if (hasItem) {
if (data.Inventory[dbName] <= number) {
interaction.followUp({
content: `You don't have enough items to gift`,
});
} else {
data.Inventory[dbName] -= number;
interaction.followUp({
embeds: [
new EmbedBuilder()
.setColor(client.color)
.setAuthor(
interaction.user.tag,
interaction.user.displayAvatarURL({ dynamic: true })
)
.setFooter(
`Made by ${client.author}`,
client.user.displayAvatarURL()
)
.setTimestamp()
.setDescription(
`**${interaction.user.username}** has given **${
user.user.username
} ${number.toLocaleString()} ${itemEmoji}${itemName}**`
),
],
});
user
.send({
content: `**${
interaction.user.tag
}** has given you **${number.toLocaleString()} ${itemEmoji}${itemName}** in **${
interaction.guild.name
}**`,
})
.catch(e => {});
await inventory.findOneAndUpdate(params, data);
}
} else {
interaction.followUp({
content: `You don't have enough items to gift`,
});
}
} else {
interaction.followUp({
content: `You don't have enough items to gift`,
});
}
});
inventory.findOne(param, async (err, data) => {
if (data?.Inventory) {
const hasItem = Object.keys(data.Inventory).includes(dbName);
if (!hasItem) {
data.Inventory[dbName] += number;
} else {
data.Inventory[dbName] += number;
}
await inventory.findOneAndUpdate(param, data);
} else {
new inventory({
User: user.id,
CP: 0,
Inventory: {
[dbName]: number,
},
}).save();
}
});
}
},
};

View file

@ -1,72 +0,0 @@
const m = require("../../models/econ");
module.exports = {
name: "give",
timeout: 5000,
usage: "(User) (Number)",
description: "Give money to an user",
category: "Economy",
options: [
{
type: 6,
name: "user",
description: "The user you want to give",
required: true,
},
{
type: 4,
name: "cp",
description: "The number of CP you want to give",
required: true,
},
],
run: async (client, interaction, args) => {
const max = 300000;
const user = interaction.guild.members.cache.get(args[0]);
let parsed = args[1];
if (parsed > max) parsed = max;
if (parsed < 100) {
interaction.followUp({
content: `You need to give at least 100 ${client.currency}`,
});
} else if (user.id === interaction.user.id) {
interaction.followUp({ content: "You can't give yourself money" });
} else if (parsed > (await client.bal(interaction.user.id))) {
interaction.followUp({ content: "You don't have enough balance" });
} else {
m.findOne({ User: interaction.user.id }, async (err, data) => {
if (data) {
data.CP -= parsed;
data.save();
} else {
client.createProfile(interaction.user.id);
}
});
m.findOne({ User: user.id }, async (err, data) => {
if (data) {
data.CP += parsed;
data.save();
} else {
new m({ CP: parsed });
}
});
interaction.followUp({
content: `**${interaction.user.username}** gave **${
user.user.username
}** **${parsed.toLocaleString()}** coins, you now have **${(
(await client.bal(interaction.user.id)) - parsed
).toLocaleString()}** ${client.currency} and they have **${(
(await client.bal(user.id)) + parsed
).toLocaleString()}** ${client.currency}`,
});
user
.send({
content: `**${
interaction.user.tag
}** gave you **${parsed.toLocaleString()}** coins in **${
interaction.guild.name
}**`,
})
.catch();
}
},
};

View file

@ -1,123 +0,0 @@
const { EmbedBuilder } = require("discord.js");
const e = require("../../models/econ");
const list = require("../../util/Data/gun.json");
module.exports = {
name: "gun",
description: "Configure Weapon Master System settings",
options: [
{
type: 1,
name: "select",
description: "Select the gun for the game",
options: [
{
name: "gun",
description: "The gun you want to select",
type: 3,
required: true,
choices: [
{
name: "kuk69",
value: "kuku69",
},
{
name: "nani45",
value: "nani45",
},
],
},
],
},
{
type: 1,
name: "list",
description: "See the information for the guns",
options: [],
},
{
type: 1,
name: "info",
description: "See the stats of your gun",
},
],
run: async (client, interaction, args) => {
if (args[0] === "list") {
const lists = list.map(value => {
return `**${value.emoji} ${value.name}**\n**Description**: ${value.description}`;
});
const embed = new EmbedBuilder()
.setColor(client.color)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.setDescription(lists.join("\n\n"));
interaction.followUp({ embeds: [embed] });
} else if (args[0] === "select") {
if (args[1] == "kuku69") {
await e.findOne({ User: interaction.user.id }, async (err, data) => {
if (!data) {
new e({
User: interaction.user.id,
Gun: {
Name: "kuku69",
Rank: "Iron",
Kills: 0,
XP: 0,
Level: 1,
},
});
} else {
data.Gun.Name = "kuku69";
await data.save();
}
});
interaction.followUp({ content: "**Your current gun:\nkuku69**" });
}
if (args[1] == "nani45") {
await e.findOne({ User: interaction.user.id }, async (err, data) => {
if (!data) {
new e({
User: interaction.user.id,
Gun: {
Name: "nani45",
Rank: "Iron",
Kills: 0,
XP: 0,
Level: 1,
},
});
} else {
data.Gun.Name = "nani45";
await data.save();
}
});
interaction.followUp({ content: "**Your current gun:\nnani45**" });
}
} else if (args[0] === "info") {
await e.findOne({ User: interaction.user.id }, async (err, data) => {
if (!data?.Gun.Name) {
interaction.followUp({
content:
"You don't have a gun yet! Please use `/gun select` to select your gun!",
});
} else {
const link = list.find(a => a.name === data.Gun.Name).link;
const embed = new EmbedBuilder()
.setThumbnail(link)
.setTimestamp()
.setColor(client.color)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.addField("Name", data.Gun.Name, true)
.addField("Rank", data.Gun.Rank, true)
.addField("XP", data.Gun.XP.toString(), true);
interaction.followUp({ embeds: [embed] });
}
});
}
},
};

View file

@ -1,67 +0,0 @@
const { EmbedBuilder } = require("discord.js");
const inv = require("../../models/econ");
const { Pagination } = require("cath");
const items = require("../../util/Data/item.json");
module.exports = {
name: "inventory",
description: "Check the inventory of an user",
usage: "{User}",
category: "Economy",
timeout: 5000,
options: [
{
type: 6,
name: "user",
description: "The user you want to see",
required: false,
},
],
run: async (client, interaction, args) => {
const util = new Pagination();
const user =
interaction.guild.members.cache.get(args[0]) || interaction.member;
inv.findOne({ User: user.id }, async (err, data) => {
if (data) {
if (!data.Inventory) {
return interaction.followUp({
content: `User doesn't have any data`,
});
}
const mappedData = Object.keys(data.Inventory)
.map(key => {
if (data.Inventory[key] == 0) {
return;
} else {
const name = items.find(val => val.dbname === key).name;
const emoji = items.find(val => val.dbname === key).emoji;
const type = items.find(val => val.dbname === key).type;
return `\n**${emoji}${name}** — ${data.Inventory[key]}\n **Type**: \`${type}\``;
}
})
.filter(e => e !== undefined);
if (mappedData.length == 0) {
return interaction.followUp({
content: `User doesn't have any data`,
});
}
const c = util.chunk(mappedData, 5).map(x => x.join("\n"));
const embed = new EmbedBuilder()
.setTimestamp()
.setTitle(`${user.displayName}'s inventory`)
.setColor(client.color)
.setDescription(c[0])
.setFooter({ text: `Page 1 of ${c.length}` });
try {
const msg = await interaction.followUp({ embeds: [embed] });
if (mappedData.length > 5) {
await util.pagination(msg, interaction.user, c);
}
} catch (e) {
console.log(e);
}
} else {
return interaction.followUp({ content: `User doesn't have any data` });
}
});
},
};

View file

@ -1,47 +0,0 @@
const { EmbedBuilder } = require("discord.js");
module.exports = {
name: "multiplier",
description: "Displaying your/user's multiplier.",
category: "Economy",
options: [
{
type: 6,
name: "user",
description: "The user you want to see",
required: false,
},
],
run: async (client, interaction, args) => {
let i = "";
let e = 0;
const user =
interaction.guild.members.cache.get(args[0]) || interaction.member;
const data = await client.data.getUser(
args[0] ? args[0] : interaction.member.id
);
if (data?.Premium) {
i += "\nPremium User - 25%\n";
e += 25;
}
if (client.path.includes(interaction.guild.id)) {
i += "NYX Partnered Server - 15%\n";
e += 15;
}
if (interaction.channel.name.toLowerCase().includes("nyx")) {
i += "Channel Name includes NYX - 10%\n";
e += 10;
}
const embed = new EmbedBuilder()
.addField(`**Total Multiplier: ${e}%** (Maximum: 50%)`, i)
.setColor(client.color)
.setURL(client.web)
.setTitle(`${user.displayName}'s Multiplier`)
.setTimestamp()
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
});
interaction.followUp({ embeds: [embed] });
},
};

View file

@ -1,52 +0,0 @@
const { EmbedBuilder } = require("discord.js");
module.exports = {
name: "profile",
usage: "(User)",
description: "Check an user economy profile",
options: [
{
type: 6,
name: "user",
description: "The user you want to see",
required: false,
},
],
run: async (client, interaction, args) => {
const user =
interaction.guild.members.cache.get(args[0]) || interaction.member;
const bjwin = await client.bjWin(user.user.id);
const swin = await client.sWin(user.user.id);
const bwin = await client.bWin(user.user.id);
const cmdused = await client.cmdsUSED(user.user.id);
const bal = await client.bal(user.user.id);
const multi = await client.multi(interaction);
const game = new EmbedBuilder()
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setColor("7196ef")
.setTitle(`${user.displayName}'s profile`)
.setDescription(`Current Balance ${bal} ${client.currency}`)
.setURL(client.web)
.addFields(
{
name: "Basic",
value: `
Total Commands Used \`${cmdused}\`\n
${client.xp} Multiplier \`${`1.${multi}x`}\``,
inline: true,
},
{
name: "🎊 Wins",
value: `Overall \`${bjwin + swin + bwin}\`
🃏 Blackjack \`${bjwin}\`\n
🎰 Slots \`${swin}\`\n
🕹 Bets \`${bwin}\`\n`,
inline: true,
}
);
interaction.followUp({ embeds: [game] });
},
};

View file

@ -1,50 +0,0 @@
const { Collection, EmbedBuilder } = require("discord.js");
module.exports = {
name: "rich",
description: "Displaying top 10 richest users.",
category: "Economy",
timeout: 4000,
run: async (client, interaction) => {
const collection = new Collection();
await Promise.all(
interaction.guild.members.cache.map(async member => {
const id = member.id;
const bal = await client.bal(id);
if (!bal) return;
return bal !== 0
? collection.set(id, {
id,
bal,
})
: null;
})
);
if (!collection) {
return interaction.followUp({
content: `None of the members got ${client.currency}!`,
});
}
const ata = collection.sort((a, b) => b.bal - a.bal).first(10);
interaction.followUp({
embeds: [
new EmbedBuilder()
.setTitle(`Richest users in ${interaction.guild.name}`)
.setDescription(
ata
.map((v, i) => {
return `**${i + 1}** ${
interaction.guild.members.cache.get(v.id).user.tag
} = **${v.bal} ${client.currency}**`;
})
.join("\n")
)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.setColor(client.color),
],
});
},
};

View file

@ -1,78 +0,0 @@
const { EmbedBuilder } = require("discord.js");
const { Pagination } = require("cath");
const items = require("../../util/Data/item.json");
module.exports = {
name: "shop",
description: "Check the items from the shop",
category: "Economy",
options: [
{
type: 3,
name: "item",
description: "The item you want to see",
required: false,
},
],
run: async (client, interaction, args, utils, data) => {
if (!args[0]) {
const util = new Pagination();
const list = items.map(value => {
return `**${value.emoji} ${
value.name
} [${value.price.toLocaleString()} ${
client.currency
}](https://www.youtube.com/watch?v=YSKDu1gKntY)**\n\`Aliases:\` **${value.aliases.join(
", "
)}**\n\`Type:\` **${value.type}**`;
});
const c = util.chunk(list, 5).map(x => x.join("\n\n"));
const embed = new EmbedBuilder()
.setTitle("**NYX Shop**")
.setTimestamp()
.setDescription(c[0])
.setColor(client.color)
.setFooter({ text: `Page 1 of ${c.length}` });
try {
const msg = await interaction.followUp({ embeds: [embed] });
if (list.length > 5) await util.pagination(msg, interaction.user, c);
} catch (e) {
console.log(e);
}
} else {
const itemToSearch = args[0].toLowerCase();
const validItem = !!items.find(item =>
item.aliases.includes(itemToSearch)
);
if (!validItem) {
interaction.followUp({
content:
"The item is not valid\nIf you want to get information about the item, use `/shop`",
});
} else {
const theitem = items.find(i => i.aliases.includes(itemToSearch));
const all = new EmbedBuilder()
.setTitle(`${theitem.emoji} ${theitem.name}`)
.setDescription(
`
**Owns** - ${
data.UserEcon.Inventory?.[theitem.dbname]
? data.UserEcon.Inventory?.[theitem.dbname]
: 0
}
**Cost Price** - ${client.currency} ${theitem.price}\n
**Sell Price** - ${client.currency} ${
theitem.sellable ? theitem.sell : "Unable to sell"
}\n
**Aliases** - \`${theitem.aliases.join(", ")}\`\n\n`
)
.setColor(client.color)
.setFooter(
`Made by ${client.author}`,
client.user.displayAvatarURL({ dynamic: true })
)
.setTimestamp();
interaction.followUp({ embeds: [all] });
}
}
},
};

View file

@ -1,130 +0,0 @@
const { EmbedBuilder } = require("discord.js");
module.exports = {
name: "slots",
usage: "(Number)",
timeout: 5000,
description: "Win more coins by slots",
category: "Economy",
options: [
{
type: 4,
name: "cp",
description: "The number of CP you want to slots",
required: true,
},
],
run: async (client, interaction, args) => {
const max = 100000;
const slots = [
"<:blushca:852174555513618502>",
"<:abusecat:853501068074942464>",
"<:dumbcat:855462498550415362>",
];
const slotOne = slots[Math.floor(Math.random() * slots.length)];
const slotTwo = slots[Math.floor(Math.random() * slots.length)];
const slotThree = slots[Math.floor(Math.random() * slots.length)];
const slotfour = slots[Math.floor(Math.random() * slots.length)];
const slotfive = slots[Math.floor(Math.random() * slots.length)];
const slotsix = slots[Math.floor(Math.random() * slots.length)];
const slotseven = slots[Math.floor(Math.random() * slots.length)];
const sloteight = slots[Math.floor(Math.random() * slots.length)];
const slotnine = slots[Math.floor(Math.random() * slots.length)];
const ar = [1.3, 1.5, 1.7, 1.9, 2.1, 2.3, 2.5, 2.7, 2.9, 3.1, 3.3, 3.5];
const r = ar[Math.floor(Math.random() * ar.length)];
let amt = args[0];
if (amt > max) amt = max;
if (amt < 100) {
interaction.followUp({
content: `You need to slot at least 100${client.currency}`,
});
} else if ((await client.bal(interaction.user.id)) < amt) {
interaction.followUp({ content: "You don't have enough balance" });
} else if (
(slotOne === slotTwo && slotOne === slotThree) ||
(slotfour === slotfive && slotfour === slotsix) ||
(slotseven === sloteight && slotseven === slotnine)
) {
const winamt = Math.round(r * amt);
const multi = (await client.multi(interaction)) / 10 + 1;
await client.add(interaction.user.id, winamt, interaction);
await client.ADDSWin(interaction.user.id);
const won = new EmbedBuilder()
.setColor("GREEN")
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.addField(
"|-----|-----|----|",
`| ${slotfour} | ${slotfive} | ${slotsix} |`
)
.addField(
"|-----|-----|----|",
`| ${slotOne} | ${slotTwo} | ${slotThree} |`
)
.addField(
"|-----|-----|----|",
`| ${slotseven} | ${sloteight} | ${slotnine} |`
)
.setTitle(`${interaction.user.username} wins a slots game`)
.addFields(
{
name: "Won",
value: `**${Math.round(winamt * multi)}**${client.currency}`,
inline: true,
},
{
name: "New Balance",
value: `**${Math.round(
(await client.bal(interaction.user.id)) + winamt * multi
)}**${client.currency}`,
inline: true,
},
{
name: "Multiplier",
value: `x${r + multi}`,
inline: true,
}
);
interaction.followUp({ embeds: [won] });
} else {
await client.rmv(interaction.user.id, amt);
const lost = new EmbedBuilder()
.setColor("RED")
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.addField(
"|-----|-----|----|",
`| ${slotfour} | ${slotfive} | ${slotsix} |`
)
.addField(
"|-----|-----|----|",
`| ${slotOne} | ${slotTwo} | ${slotThree} |`
)
.addField(
"|-----|-----|----|",
`| ${slotseven} | ${sloteight} | ${slotnine} |`
)
.setTitle(`${interaction.user.username} loses a slots game`)
.addFields(
{
name: "Lost",
value: `**${amt}**${client.currency}`,
inline: true,
},
{
name: "New Balance",
value: `**${
parseInt(await client.bal(interaction.user.id)) - amt
}**${client.currency}`,
inline: true,
}
);
interaction.followUp({ embeds: [lost] });
}
},
};

View file

@ -1,151 +0,0 @@
const db = require("../../models/econ");
const { EmbedBuilder } = require("discord.js");
const { bool } = require("cath");
module.exports = {
name: "rob",
description: "Rob money from an user",
usage: "(User)",
category: "Economy",
timeout: 120000,
options: [
{
type: 6,
name: "user",
description: "The user you want to rob",
required: true,
},
],
run: async (client, interaction, args, utils) => {
const s = new Set();
const tryrob = interaction.guild.members.cache.get(args[0]);
if (tryrob.id === interaction.user.id) {
interaction.followUp({ content: "You can't rob yourself" });
} else if (s.has(tryrob.user.tag)) {
interaction.followUp({
content:
"That user has already been robbed within three minutes, be kind!",
});
} else {
await db.findOne({ User: interaction.user.id }, async (err, data) => {
if (data) {
if (!data.CP) {
data.CP = 0;
data.save();
interaction.followUp({ content: "You don't have enough balance" });
} else {
await db.findOne({ User: tryrob.id }, async (err1, data1) => {
const coins = Math.floor(Math.random() * data.CP);
const coins1 = Math.floor(Math.random() * data1?.CP);
if (!data1) {
client.createProfile(tryrob.id);
interaction.followUp({
embeds: [
new EmbedBuilder()
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.setAuthor(
interaction.user.tag,
interaction.user.displayAvatarURL({ dynamic: true })
)
.setColor("RED")
.setDescription(
`They don't have any ${client.currency}. Be kind!`
),
],
});
} else if (data1) {
if (data1.CP <= 0 || !data1.CP) {
interaction.followUp({
embeds: [
new EmbedBuilder()
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.setAuthor(
interaction.user.tag,
interaction.user.displayAvatarURL({ dynamic: true })
)
.setColor("RED")
.setDescription(
`They don't have any ${client.currency}. Be kind!`
),
],
});
}
if (bool()) {
data.CP += coins1;
data.save();
data1.CP -= coins1;
data1.save();
s.add(tryrob.user.tag);
setTimeout(function () {
s.delete(tryrob.user.tag);
}, 1000 * 60 * 3);
tryrob
.send(
`**${
interaction.user.tag
}** has robbed you **${coins1.toLocaleString()}** coins in **${
interaction.guild.name
}**`
)
.catch(e => {});
interaction.followUp({
embeds: [
new EmbedBuilder()
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.setAuthor(
interaction.user.tag,
interaction.user.displayAvatarURL({ dynamic: true })
)
.setColor("GREEN")
.setDescription(
`You robbed **${tryrob.user.tag}**! And you got \`${coins1}\`${client.currency}`
),
],
});
} else {
data.CP -= coins;
data.save();
data1.CP += coins;
data1.save();
interaction.followUp({
embeds: [
new EmbedBuilder()
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.setAuthor(
interaction.user.tag,
interaction.user.displayAvatarURL({ dynamic: true })
)
.setColor("RED")
.setDescription(
`You failed on robbing **${tryrob.user.tag}**! And you had to pay him/her \`${coins}\`${client.currency}`
),
],
});
}
}
});
}
}
if (!data) {
client.createProfile(interaction.user.id);
interaction.followUp({ content: "You don't have enough balance" });
}
});
}
},
};

View file

@ -1,40 +0,0 @@
const { EmbedBuilder } = require("discord.js");
module.exports = {
name: "work",
description: "Work to earn money",
category: "Economy",
timeout: 1000 * 60 * 10,
run: async (client, interaction, args, utils) => {
const jobs = [
"Software engineer",
"Programmer",
"Teacher",
"YouTuber",
"Student",
"Desginer",
"Editor",
"Banker",
];
const earning = utils.rndint(5000, 3000);
const job = jobs[Math.floor(Math.random() * jobs.length)];
await client.add(interaction.user.id, earning, interaction);
interaction.followUp({
embeds: [
new EmbedBuilder()
.setAuthor(
interaction.user.tag,
interaction.user.displayAvatarURL({ dynamic: true })
)
.setDescription(
`Good Job! You worked as a **${job}** and earned **${earning}${client.currency}**`
)
.setTimestamp()
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setColor(client.color),
],
});
},
};

View file

@ -1,112 +0,0 @@
const { EmbedBuilder } = require("discord.js");
module.exports = {
name: "ban",
description: "Ban an user",
BotPerms: ["BAN_MEMBERS"],
UserPerms: ["BAN_MEMBERS"],
usage: "(User) {Reason}",
category: "Moderation",
options: [
{
type: 6,
name: "user",
description: "The user you want to ban",
required: true,
},
{
type: 3,
name: "reason",
description: "The reason you want to ban",
required: false,
},
{
type: 4,
name: "messages",
description:
"Number of days of messages to delete, must be between 0 and 7, inclusive",
required: false,
},
],
run: async (client, interaction, args) => {
const target = interaction.guild.members.cache.get(args[0]);
let reason = args[1] || "No reason provided";
const days = args[2] || 0;
if (days > 7 || days < 0) {
interaction.followUp({
content:
"Number of days of messages to delete must be between 0 and 7, inclusive",
});
} else if (!target) {
try {
const one = await client.users.fetch(args[0]);
if (one.id === interaction.user.id) {
interaction.followUp({ content: "You can't ban yourself" });
}
if (reason.length > 1024) reason = reason.slice(0, 1021) + "...";
const embed = new EmbedBuilder()
.setTitle("User Banned")
.addField("**Moderator**", interaction.user.tag, true)
.addField("**User**", one.tag, true)
.addField("**Reason**", reason, true)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.setThumbnail(interaction.user.displayAvatarURL({ dynamic: true }))
.setColor(client.color);
interaction.followUp({ embeds: [embed] });
await interaction.guild.members.ban(one.id, {
reason,
days,
});
} catch (e) {
console.log(e);
}
} else {
if (target.id === interaction.user.id) {
interaction.followUp({ content: "You can't ban yourself" });
}
if (
interaction.member.roles.highest.position <
target.roles.highest.position
) {
interaction.followUp({ content: "You don't have enough hierarchy" });
}
if (
interaction.guild.me.roles.highest.position <
target.roles.highest.position
) {
interaction.followUp({ content: "Bot doesn't have enough hierarchy" });
}
if (reason.length > 1024) reason = reason.slice(0, 1021) + "...";
try {
const embed = new EmbedBuilder()
.setTitle("User Banned")
.addField("**Moderator**", interaction.user.tag, true)
.addField("**User**", target.user.tag, true)
.addField("**Reason**", reason, true)
.addField(
"Number of days of messages to delete",
days.toString(),
true
)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.setThumbnail(interaction.user.displayAvatarURL({ dynamic: true }))
.setColor(client.color);
interaction.followUp({ embeds: [embed] });
await interaction.guild.members.ban(target.id, {
reason,
days,
});
} catch (e) {
console.log(e);
interaction.followUp({ content: `**Error**: ${e.message}` });
}
}
},
};

View file

@ -1,61 +0,0 @@
const { EmbedBuilder } = require("discord.js");
module.exports = {
name: "kick",
description: "Kick an user",
UserPerms: ["KICK_MEMBERS"],
BotPerms: ["KICK_MEMBERS"],
usage: "(User) {Reason}",
category: "Moderation",
options: [
{
type: 6,
name: "user",
description: "The user you want to kick",
required: true,
},
{
type: 3,
name: "reason",
description: "The reason you want to kick",
required: false,
},
],
run: async (client, interaction, args) => {
const target = interaction.guild.members.cache.get(args[0]);
let reason = args[1] || "No reason provided";
if (target.id === interaction.user.id) {
interaction.followUp({ content: "You can't kick yourself" });
}
if (
interaction.member.roles.highest.position < target.roles.highest.position
) {
interaction.followUp({ content: "You don't have enough hierarchy" });
}
if (
interaction.guild.me.roles.highest.position <
target.roles.highest.position
) {
interaction.followUp({ content: "Bot doesn't have enough hierarchy" });
}
if (reason.length > 1024) reason = reason.slice(0, 1021) + "...";
try {
const embed = new EmbedBuilder()
.setTitle("User Kicked")
.addField("**Moderator**", interaction.user.tag, true)
.addField("**User**", target.user.tag, true)
.addField("**Reason**", reason, true)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.setThumbnail(interaction.user.displayAvatarURL({ dynamic: true }))
.setColor(client.color);
interaction.followUp({ embeds: [embed] });
await target.kick(reason);
} catch (e) {
console.log(e);
interaction.followUp({ content: `**Error**: ${e.message}` });
}
},
};

View file

@ -1,53 +0,0 @@
const { EmbedBuilder } = require("discord.js");
module.exports = {
name: "lockdown",
description: "Lock a channel",
UserPerms: ["MANAGE_CHANNELS"],
BotPerms: ["MANAGE_CHANNELS"],
category: "Moderation",
options: [
{
type: 5,
name: "choice",
description: "Whether lock or unlock the channel",
required: true,
},
],
run: async (client, interaction, args) => {
if (args[0]) {
interaction.channel.permissionOverwrites
.create(interaction.guild.id, { SEND_MESSAGES: false })
.then(() => {
const embed = new EmbedBuilder()
.setTitle("Channel Locked")
.addField("**Moderator**", interaction.user.tag, true)
.addField("**Channel**", `<#${interaction.channel.id}>`, true)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.setThumbnail(interaction.user.displayAvatarURL({ dynamic: true }))
.setColor(client.color);
interaction.followUp({ embeds: [embed] });
});
} else {
interaction.channel.permissionOverwrites
.create(interaction.guild.id, { SEND_MESSAGES: true })
.then(() => {
const embed = new EmbedBuilder()
.setTitle("Channel Unlocked")
.addField("**Moderator**", interaction.user.tag, true)
.addField("**Channel**", `<#${interaction.channel.id}>`, true)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.setThumbnail(interaction.user.displayAvatarURL({ dynamic: true }))
.setColor(client.color);
interaction.followUp({ embeds: [embed] });
});
}
},
};

View file

@ -1,122 +0,0 @@
const { EmbedBuilder } = require("discord.js");
module.exports = {
name: "mute",
description: "Mute an user.",
usage: "(User) (Time) {Reason}",
UserPerms: ["MANAGE_MESSAGES"],
BotPerms: ["MANAGE_ROLES"],
category: "Moderation",
options: [
{
type: 6,
name: "user",
description: "The user you want to mute",
required: true,
},
{
type: 3,
name: "reason",
description: "The reason you want to mute",
required: true,
},
{
type: 3,
name: "time",
description: "The time you want to mute",
required: false,
},
],
run: async (client, interaction, args, utils, data) => {
try {
const user = interaction.guild.members.cache.get(args[0]);
const reason = args[1];
const time = args[2] || "gg";
const mutedrole = interaction.guild.roles.cache.get(data.Guild.Muterole);
if (user.id === interaction.user.id) {
interaction.followUp({ content: "You can't mute yourself" });
}
if (
interaction.member.roles.highest.position < user.roles.highest.position
) {
interaction.followUp({ content: "You don't have enough hierarchy" });
}
if (
interaction.guild.me.roles.highest.position <
user.roles.highest.position
) {
interaction.followUp({ content: "Bot doesn't have enough hierarchy" });
}
if (reason.length > 1024) reason = reason.slice(0, 1021) + "...";
if (!utils.ms(time)) {
if (!mutedrole) {
const newrole = await interaction.guild.roles.create({
name: "Muted",
reason: "For muted people",
permissions: [],
});
await client.data.setMuterole(interaction.guild.id, newrole.id);
interaction.guild.channels.cache
.filter(c => c.type === "GUILD_TEXT")
.forEach(async channel => {
await channel.permissionOverwrites.create(newrole, {
SEND_MESSAGES: false,
ADD_REACTIONS: false,
});
});
} else {
await user.roles.add(mutedrole.id);
const embed = new EmbedBuilder()
.setTitle("User Muted")
.addField("**Moderator**", interaction.user.tag, true)
.addField("**User**", user.user.tag, true)
.addField("**Reason**", reason, true)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.setThumbnail(interaction.user.displayAvatarURL({ dynamic: true }))
.setColor(client.color);
interaction.followUp({ embeds: [embed] });
}
} else if (!mutedrole) {
const newrole = await interaction.guild.roles.create({
name: "Muted",
reason: "For muted people",
permissions: [],
});
await client.data.setMuterole(interaction.guild.id, newrole.id);
interaction.guild.channels.cache
.filter(c => c.type === "GUILD_TEXT")
.forEach(async channel => {
await channel.permissionOverwrites.create(newrole, {
SEND_MESSAGES: false,
ADD_REACTIONS: false,
});
});
} else {
await user.roles.add(mutedrole.id);
const embed = new EmbedBuilder()
.setTitle("User Muted")
.addField("**Moderator**", interaction.user.tag, true)
.addField("**User**", user.user.tag, true)
.addField("**Time**", utils.ms(utils.ms(time), { long: true }), true)
.addField("**Reason**", reason, true)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.setThumbnail(interaction.user.displayAvatarURL({ dynamic: true }))
.setColor(client.color);
interaction.followUp({ embeds: [embed] });
setTimeout(async () => {
await user.roles.remove(mutedrole.id);
}, utils.ms(time));
}
} catch (e) {
console.log(e);
interaction.followUp({ content: `**Error**: ${e.message}` });
}
},
};

View file

@ -1,67 +0,0 @@
const { MessageAttachment } = require("discord.js");
module.exports = {
name: "nuke",
description: "Destroy a channel and create a new one",
usage: "{Channel}",
UserPerms: ["MANAGE_CHANNELS"],
BotPerms: ["MANAGE_CHANNELS"],
category: "Moderation",
run: async (client, interaction, args) => {
try {
const filter = m => m.author.id === interaction.user.id;
interaction.followUp({
content: "Do you want to nuke this channel?\n (Type `Yes` or `no`)",
});
interaction.channel
.awaitMessages({
filter,
max: 1,
time: 99999,
errors: ["time"],
})
.then(msg => {
const message = msg.first();
if (
message.content.toLowerCase() == "yes" ||
message.content.toLowerCase() == "y"
) {
const channel = message.guild.channels.cache.get(
message.channel.id
);
channel.clone().then(ch => {
if (channel.parent) {
ch.setParent(channel.parent.id);
} else {
}
ch.setPosition(channel.position);
channel.delete();
ch.send({
files: [
new MessageAttachment(
"https://i.pinimg.com/originals/06/c3/92/06c392b847166a9a671bfcd590d8fff7.gif"
),
],
content: "\nFriendly nuke has been launched.",
});
});
} else if (
message.content.toLowerCase() == "no" ||
message.content.toLowerCase() == "n"
) {
message.delete();
return message.channel.send({
content: "The process has been cancelled",
});
} else {
message.delete();
return message.channel.send({
content: `The process has been cancelled due to invalid response`,
});
}
});
} catch (e) {
console.log(e);
interaction.followUp({ content: `**Error**: ${e.message}` });
}
},
};

View file

@ -1,85 +0,0 @@
const { EmbedBuilder } = require("discord.js");
module.exports = {
name: "clear",
description: "Clear messages in a specific channel",
options: [
{
name: "channel",
description: "Channel where the messages to be deleted",
type: 7,
required: true,
channelTypes: [0],
},
{
name: "amount",
description: "Amount of message in range of 1-100 to be deleted",
type: 4,
required: true,
},
],
run: async (client, interaction, args) => {
try {
const query = args[1];
const channel = interaction.guild.channels.cache.get(args[0]);
if (query > 100) {
return interaction.followUp({
content: "The amount of messages must be in range of 1-100",
});
}
if (channel.type !== "GUILD_TEXT") {
return interaction.followUp({
content: "Please provide a text channel",
});
}
const limit = await interaction.channel.messages.fetch({
limit: query,
});
await channel.bulkDelete(limit, true).then(async m => {
const results = {};
for (const [, deleted] of m) {
const user = `${deleted.author.username}#${deleted.author.discriminator}`;
if (!results[user]) results[user] = 0;
results[user]++;
}
const userMessageMap = Object.entries(results);
channel.send({
embeds: [
new EmbedBuilder()
.setTitle(`Message Cleared`)
.addField(
"**Moderator**",
`${
interaction.member.nickname
? interaction.member.nickname
: interaction.user.username
}`,
true
)
.addField("Amount of Message Deleted", `${m.size}/${query}`, true)
.addField(
"Authors",
`${userMessageMap
.map(([user, messages]) => `**${user}** : ${messages}`)
.join("\n")}`,
false
)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.setThumbnail(
interaction.user.displayAvatarURL({ dynamic: true })
)
.setColor(client.color),
],
});
});
} catch (e) {
console.log(e);
interaction.followUp({ content: `**Error**: ${e.message}` });
}
},
};

View file

@ -1,65 +0,0 @@
const { EmbedBuilder } = require("discord.js");
module.exports = {
name: "role",
UserPerms: ["MANAGE_ROLES"],
BotPerms: ["MANAGE_ROLES"],
usage: "(Role) (User)",
description: "Add/Remove a role for an user",
category: "Moderation",
options: [
{
type: 6,
name: "user",
description: "The person you want to add/remove role",
required: true,
},
{
type: 8,
name: "role",
description: "The role you want to add/remove",
required: true,
},
],
run: async (client, interaction, args) => {
try {
const target = interaction.guild.members.cache.get(args[0]);
const role = interaction.guild.roles.cache.get(args[1]);
if (role.managed) {
interaction.followUp({ content: "You must provide a non bot role" });
} else if (target.roles.cache.has(role.id)) {
const embed = new EmbedBuilder()
.setTitle("Role Removed")
.addField("**Moderator**", interaction.user.tag, true)
.addField("**User**", target.user.tag, true)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.setThumbnail(interaction.user.displayAvatarURL({ dynamic: true }))
.setColor(client.color);
interaction
.followUp({ embeds: [embed] })
.then(await target.roles.remove(role.id));
} else {
const embed = new EmbedBuilder()
.setTitle("Role Added")
.addField("**Moderator**", interaction.user.tag, true)
.addField("**User**", target.user.tag, true)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.setThumbnail(interaction.user.displayAvatarURL({ dynamic: true }))
.setColor(client.color);
interaction
.followUp({ embeds: [embed] })
.then(await target.roles.add(role.id));
}
} catch (e) {
console.log(e);
interaction.followUp({ content: `**Error**: ${e.message}` });
}
},
};

View file

@ -1,107 +0,0 @@
const Discord = require("discord.js");
module.exports = {
name: "slowmode",
UserPerms: ["MANAGE_CHANNELS"],
description: "Set slowmode at a specific channel",
BotPerms: ["MANAGE_CHANNELS"],
usage: "(Time)",
category: "Moderation",
run: async (client, interaction, args, utils) => {
await interaction.deleteReply();
const menu = new Discord.MessageSelectMenu()
.setCustomId("select")
.setPlaceholder("Select a time")
.addOptions([
{ label: "OFF", value: "OFF" },
{ label: "5s", value: "5s" },
{ label: "10s", value: "10s" },
{ label: "15s", value: "15s" },
{ label: "30s", value: "30s" },
{ label: "1m", value: "1m" },
{ label: "2m", value: "2m" },
{ label: "5m", value: "5m" },
{ label: "10m", value: "10m" },
{ label: "15m", value: "15m" },
{ label: "30m", value: "30m" },
{ label: "1h", value: "1h" },
{ label: "2h", value: "2h" },
{ label: "6h", value: "6h" },
]);
let row = new Discord.MessageActionRow().addComponents(menu);
const slowmoEmbed = new Discord.EmbedBuilder()
.setColor(client.color)
.setTitle("Slowmode")
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.setAuthor(
`Requested by ${interaction.user.tag}`,
interaction.user.displayAvatarURL({ dynmiac: true })
);
interaction.channel
.send({ embeds: [slowmoEmbed], components: [row] })
.then(sent => {
const filter = i => {
i.deferUpdate();
if (i.user.id === interaction.user.id) return true;
return;
};
const collector = sent.createMessageComponentCollector({
filter,
componentType: "SELECT_MENU",
time: 30e3,
});
collector.on("collect", collected => {
collector.resetTimer({ time: 30e3 });
menu.setPlaceholder(`Set to: ${collected.values[0]}`);
row = new Discord.MessageActionRow().addComponents(menu);
if (collected.values[0] !== "OFF") {
const embed = new Discord.EmbedBuilder()
.setColor("GREEN")
.setTitle("Slowmode Added")
.addField("**Moderator**", interaction.user.tag, true)
.addField("**Channel**", `<#${interaction.channel.id}>`, true)
.addField(
"**Rate**",
`${utils.ms(utils.ms(collected.values[0]), { long: true })}`,
true
)
.setFooter({
text:
interaction.member.displayName || interaction.user.username,
iconURL: interaction.user.displayAvatarURL({ dynamic: true }),
})
.setThumbnail(client.user.displayAvatarURL());
interaction.channel.setRateLimitPerUser(
utils.ms(collected.values[0]) / 1e3
);
return sent.edit({ embeds: [embed], components: [row] });
} else {
const embed = new Discord.EmbedBuilder()
.setColor("RED")
.setTitle("Slowmode Removed")
.addField("**Moderator**", interaction.user.tag, true)
.addField("**Channel**", `<#${interaction.channel.id}>`, true)
.setFooter({
text:
interaction.member.displayName || interaction.user.username,
iconURL: interaction.user.displayAvatarURL({ dynamic: true }),
})
.setThumbnail(client.user.displayAvatarURL())
.setColor("RED");
interaction.channel.setRateLimitPerUser(0);
return sent.edit({ embeds: [embed], components: [row] });
}
});
collector.on("end", () => {
menu.setDisabled(true);
row = new Discord.MessageActionRow().addComponents(menu);
return sent.edit({ components: [row] });
});
});
},
};

View file

@ -1,37 +0,0 @@
const { EmbedBuilder } = require("discord.js");
module.exports = {
name: "unban",
description: "Unban an user",
UserPerms: ["BAN_MEMBERS"],
BotPerms: ["BAN_MEMBERS"],
usage: "(User)",
category: "Moderation",
options: [
{
type: 6,
name: "user",
description: "The person you want to unban",
required: true,
},
],
run: async (client, interaction, args) => {
try {
const user = await interaction.guild.members.unban(args[0]);
const embed = new EmbedBuilder()
.setTitle("User Unbanned")
.addField("**Moderator**", interaction.user.tag, true)
.addField("**User**", user.tag, true)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.setThumbnail(interaction.user.displayAvatarURL({ dynamic: true }))
.setColor(client.color);
interaction.followUp({ embeds: [embed] });
} catch (e) {
console.log(e);
interaction.followUp({ content: `**Error**: ${e.message}` });
}
},
};

View file

@ -1,42 +0,0 @@
const { EmbedBuilder } = require("discord.js");
module.exports = {
name: "unmute",
UserPerms: ["MANAGE_MESSAGES"],
BotPerms: ["MANAGE_ROLES"],
usage: "(User)",
description: "Unmute an user",
category: "Moderation",
options: [
{
type: 6,
name: "user",
description: "The user you want to unmute",
required: true,
},
],
run: async (client, interaction, args, utils, data) => {
try {
const user = interaction.guild.members.cache.get(args[0]);
const mutedrole = interaction.guild.roles.cache.get(data.Guild.Muterole);
if (!mutedrole) {
interaction.followUp({ content: "Mute role not found in database" });
}
await user.roles.remove(mutedrole);
const embed = new EmbedBuilder()
.setTitle("User Unmuted")
.addField("**Moderator**", interaction.user.tag, true)
.addField("**User**", user.user.tag, true)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.setThumbnail(interaction.user.displayAvatarURL({ dynamic: true }))
.setColor(client.color);
interaction.followUp({ embeds: [embed] });
} catch (e) {
console.log(e);
interaction.followUp({ content: `**Error**: ${e.message}` });
}
},
};

View file

@ -1,276 +0,0 @@
const db = require("../../../models/warns");
const moment = require("moment");
const { EmbedBuilder } = require("discord.js");
module.exports = {
name: "warn",
UserPerms: ["MANAGE_MESSAGES"],
description: "Add/remove/show warnings of an user",
category: "Moderation",
options: [
{
type: 1,
name: "add",
description: "Warn a user",
options: [
{
type: 6,
name: "user",
description: "The user you want to warn",
required: true,
},
{
type: 3,
name: "reason",
description: "The reason you want to warn",
required: false,
},
],
},
{
type: 1,
name: "list",
description: "Show a list of warnings of an user",
options: [
{
type: 6,
name: "user",
description: "The user to show the list",
required: true,
},
],
},
{
type: 1,
name: "remove",
description: "Remove a latest warn for an user",
options: [
{
type: 6,
name: "user",
description: "The user to remove warn",
required: true,
},
{
type: 4,
name: "number",
description: "The number of warn",
required: true,
},
],
},
{
type: 1,
name: "clear",
description: "Clear an user's warns",
options: [
{
type: 6,
name: "user",
description: "The user to clear warns",
required: true,
},
],
},
],
run: async (client, interaction, args) => {
try {
if (args[0] == "add") {
const user = interaction.guild.members.cache.get(args[1]);
const reason = args[2] || "No reason provided";
if (user.id === interaction.user.id) {
interaction.followUp({ content: "You can't warn yourself" });
}
if (
interaction.member.roles.highest.position <
user.roles.highest.position
) {
interaction.followUp({ content: "You don't have enough hierarchy" });
}
if (
interaction.guild.me.roles.highest.position <
user.roles.highest.position
) {
interaction.followUp({
content: "Bot doesn't have enough hierarchy",
});
}
if (reason.length > 1024) reason = reason.slice(0, 1021) + "...";
db.findOne(
{ Guild: interaction.guild.id, User: user.id },
async (err, data) => {
if (!data) {
data = new db({
Guild: interaction.guild.id,
User: user.id,
Warns: [
{
Reason: reason,
Moderator: interaction.user.id,
Timestamp: Date.now(),
},
],
});
} else {
data.Warns.push({
Reason: reason,
Moderator: interaction.user.id,
Timestamp: Date.now(),
});
}
data.save();
}
);
user
.send({
content: `You have been warned in **${interaction.guild.name}** for **${reason}**`,
})
.catch(e => {});
const embed = new EmbedBuilder()
.setTitle("User Warned")
.addField("**Moderator**", interaction.user.tag, true)
.addField("**User**", user.user.tag, true)
.addField("**Reason**", reason, true)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.setThumbnail(interaction.user.displayAvatarURL({ dynamic: true }))
.setColor(client.color);
interaction.followUp({ embeds: [embed] });
} else if (args[0] == "list") {
const user = interaction.guild.members.cache.get(args[1]);
db.findOne(
{ Guild: interaction.guild.id, User: user.id },
async (err, data) => {
if (data.Warns.map(e => e).length > 0) {
interaction.followUp({
embeds: [
new EmbedBuilder()
.setTitle(`${user.user.tag}'s warns`)
.setDescription(
data.Warns.map(
(w, i) =>
`\`${i + 1}\` | Moderator: ${
interaction.guild.members.cache.get(w.Moderator) ||
"Unknown"
}\nReason: ${w.Reason}\nDate: ${moment(
w.Timestamp
).format("MMMM Do YYYY")}`
).join("\n\n")
)
.setFooter(
`Made by ${client.author}`,
client.user.displayAvatarURL()
)
.setTimestamp()
.setColor(client.color),
],
});
} else {
interaction.followUp({
content: `User doesn't have any warns`,
});
}
}
);
} else if (args[0] == "remove") {
const user = interaction.guild.members.cache.get(args[1]);
if (
interaction.member.roles.highest.position <
user.roles.highest.position
) {
interaction.followUp({ content: "You don't have enough hierarchy" });
}
if (
interaction.guild.me.roles.highest.position <
user.roles.highest.position
) {
interaction.followUp({
content: "Bot doesn't have enough hierarchy",
});
}
db.findOne(
{ Guild: interaction.guild.id, User: user.id },
async (err, data) => {
if (err) throw err;
if (data) {
const number = args[2] - 1;
data.Warns.splice(number, 1);
const embed = new EmbedBuilder()
.setTitle("Warn Removed")
.addField("**Moderator**", interaction.user.tag, true)
.addField("**User**", user.user.tag, true)
.setFooter(
`Made by ${client.author}`,
client.user.displayAvatarURL()
)
.setTimestamp()
.setThumbnail(
interaction.user.displayAvatarURL({ dynamic: true })
)
.setColor(client.color);
interaction.followUp({ embeds: [embed] });
data.save();
} else {
interaction.followUp({
content: `User doesn't have any warns`,
});
}
}
);
} else {
const user = interaction.guild.members.cache.get(args[1]);
if (
interaction.member.roles.highest.position <
user.roles.highest.position
) {
interaction.followUp({ content: "You don't have enough hierarchy" });
}
if (
interaction.guild.me.roles.highest.position <
user.roles.highest.position
) {
interaction.followUp({
content: "Bot doesn't have enough hierarchy",
});
}
db.findOne(
{ Guild: interaction.guild.id, User: user.id },
async (err, data) => {
if (data) {
await db.findOneAndDelete({
Guild: interaction.guild.id,
User: user.id,
});
interaction.followUp({
embeds: [
new EmbedBuilder()
.setTitle(`Warns Cleared`)
.addField("**Moderator**", interaction.user.tag, true)
.addField("**User**", user.user.tag, true)
.setFooter(
`Made by ${client.author}`,
client.user.displayAvatarURL()
)
.setTimestamp()
.setThumbnail(
interaction.user.displayAvatarURL({ dynamic: true })
)
.setColor(client.color),
],
});
} else {
interaction.followUp({
content: `User doesn't have any warns`,
});
}
}
);
}
} catch (e) {
console.log(e);
interaction.followUp({ content: `**Error**: ${e.message}` });
}
},
};

View file

@ -1,53 +0,0 @@
const levels = {
none: 0.0,
low: 0.2,
medium: 0.3,
high: 0.35,
};
module.exports = {
name: "bassboost",
description: "Set filter/bassboost level",
category: "Music",
usage: "(Number)",
Premium: true,
options: [
{
type: 3,
name: "level",
description: `Please provide a bassboost level`,
required: true,
choices: [
{ name: "low", value: "low" },
{ name: "medium", value: "medium" },
{ name: "high", value: "high" },
{ name: "none", value: "none" },
],
},
],
run: async (client, interaction, args) => {
const player = await client.manager.get(interaction.guild.id);
const channel = interaction.member.voice.channel.id;
if (!channel) {
client.err(
interaction,
"**You must be in a voice channel to use this command.**"
);
}
if (player.voiceChannel !== channel) {
client.err(
interaction,
"**You must be in the same voice channel as me to use this command**"
);
}
if (!player) client.err(interaction, "**Nothing is playing right now**");
player.setEQ(
...new Array(3)
.fill(null)
.map((_, i) => ({ band: i, gain: levels[args[0]] }))
);
client.se(
interaction,
`✅ | **Set the bassboost level to** \`${args[0]}\``
);
},
};

View file

@ -1,24 +0,0 @@
module.exports = {
name: "clear-queue",
description: "Clears the server queue",
category: "Music",
run: async (client, interaction, args) => {
const player = client.manager.get(interaction.guild.id);
const channel = interaction.member.voice.channel.id;
if (!channel) {
client.err(
interaction,
"**You must be in a voice channel to use this command.**"
);
}
if (player.voiceChannel !== channel) {
client.err(
interaction,
"**You must be in the same voice channel as me to use this command**"
);
}
if (!player) client.err(interaction, "**Nothing is playing right now**");
player.queue.clear();
client.se(interaction, "✅ | **Cleared the queue!**");
},
};

View file

@ -1,25 +0,0 @@
module.exports = {
name: "disconnect",
description: "To stop the music and clear the queue",
category: "Music",
run: async (client, interaction, args) => {
const player = await client.manager.get(interaction.guild.id);
const channel = interaction.member.voice.channel.id;
if (!channel) {
return client.err(
interaction,
"**You must be in a voice channel to use this command.**"
);
}
if (player.voiceChannel !== channel) {
return client.err(
interaction,
"**You must be in the same voice channel as me to use this command**"
);
}
if (!player) client.err(interaction, "**Nothing is playing right now**");
player.destroy();
client.se(interaction, "🎶| **Disconnected!**");
},
};

View file

@ -1,55 +0,0 @@
const { EmbedBuilder } = require("discord.js");
module.exports = {
name: "grab",
description: "Saves the current song to your Direct Messages",
run: async (client, interaction, args, utils) => {
const player = await client.manager.get(interaction.guild.id);
const channel = interaction.member.voice.channel.id;
if (!channel) {
client.err(
interaction,
"**You must be in a voice channel to use this command.**"
);
}
if (player.voiceChannel !== channel) {
client.err(
interaction,
"**You must be in the same voice channel as me to use this command**"
);
}
if (!player) client.err(interaction, "**Nothing is playing right now**");
try {
const embed = new EmbedBuilder()
.setAuthor(
`Song saved: `,
"https://cdn.discordapp.com/emojis/897017864085712936.gif"
)
.setThumbnail(
`https://img.youtube.com/vi/${player.queue.current.identifier}/mqdefault.jpg`
)
.setURL(player.queue.current.uri)
.setColor(client.color)
.setTimestamp()
.setTitle(`**${player.queue.current.title}**`)
.addField(
`⌛ Duration: `,
`\`${utils.prettyMs(player.queue.current.duration, {
colonNotation: true,
})}\``,
true
)
.addField(`🎵 Author: `, `\`${player.queue.current.author}\``, true)
.addField(`▶ Play it:`, `\`${player.queue.current.uri}\``)
.addField(`🔎 Saved in:`, `<#${interaction.channel.id}>`)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
});
interaction.user.send({ embeds: [embed] });
} catch (e) {
console.log(e);
return client.err(interaction, "**Your DM are disabled**");
}
client.se(interaction, "✅ | **Check your DM**");
},
};

View file

@ -1,53 +0,0 @@
module.exports = {
name: "loop",
description: "Music loop",
category: "Music",
options: [
{
type: 1,
name: "track",
description: "Loop the track",
options: [],
},
{
type: 1,
name: "queue",
description: "Loop the whole queue",
options: [],
},
],
run: async (client, interaction, args) => {
const player = await client.manager.get(interaction.guild.id);
const channel = interaction.member.voice.channel.id;
if (!channel) {
client.err(
interaction,
"**You must be in a voice channel to use this command.**"
);
}
if (player.voiceChannel !== channel) {
client.err(
interaction,
"**You must be in the same voice channel as me to use this command**"
);
}
if (!player) client.err(interaction, "**Nothing is playing right now**");
if (args[0] === "track") {
player.setTrackRepeat(player.trackRepeat ? false : true);
client.se(
interaction,
`🔂 \`Music loop is now ${
player.trackRepeat ? "enabled" : "disabled"
}\``
);
} else {
player.setQueueRepeat(player.queueRepeat ? false : true);
client.se(
interaction,
`🔂 \`Queue Loop is now ${
player.trackRepeat ? "enabled" : "disabled"
}\``
);
}
},
};

View file

@ -1,50 +0,0 @@
module.exports = {
name: "move",
description: "Moves a track to a specified position",
options: [
{
type: 4,
name: "track",
description: "Track to move.",
required: true,
},
{
type: 4,
name: "position",
description: "Moves selected track to the specified position.",
required: true,
},
],
run: async (client, interaction, args) => {
const player = await client.manager.get(interaction.guild.id);
const channel = interaction.member.voice.channel.id;
if (!channel) {
client.err(
interaction,
"**You must be in a voice channel to use this command.**"
);
}
if (player.voiceChannel !== channel) {
client.err(
interaction,
"**You must be in the same voice channel as me to use this command**"
);
}
if (!player) client.err(interaction, "**Nothing is playing right now**");
const trackNum = args[0] - 1;
const dest = args[1] - 1;
if (trackNum < 0 || trackNum > player.queue.length - 1) {
client.err(interaction, "**Invalid track number**");
} else if (dest < 0 || dest > player.queue.length - 1) {
client.err(interaction, "**Invalid track destination**");
} else {
const track = player.queue[trackNum];
player.queue.splice(trackNum, 1);
player.queue.splice(dest, 0, track);
client.se(
interaction,
`✅ | **${track.title}** has been moved to position ${dest + 1}`
);
}
},
};

View file

@ -1,64 +0,0 @@
const { EmbedBuilder } = require("discord.js");
module.exports = {
name: "nowplaying",
description: "Show now playing music info",
category: "Music",
run: async (client, interaction, args, utils) => {
const player = await client.manager.get(interaction.guild.id);
const channel = interaction.member.voice.channel.id;
if (!channel) {
client.err(
interaction,
"**You must be in a voice channel to use this command.**"
);
}
if (player.voiceChannel !== channel) {
client.err(
interaction,
"**You must be in the same voice channel as me to use this command**"
);
}
if (!player) client.err(interaction, "**Nothing is playing right now**");
interaction.followUp({
embeds: [
new EmbedBuilder()
.setAuthor(
`Current song playing:`,
client.user.displayAvatarURL({
dynamic: true,
})
)
.addField(
"🕰️ Duration: ",
`${
utils.progressBar(
player.position,
player.queue.current.duration,
15
).Bar
} \`${utils.prettyMs(player.position, {
colonNotation: true,
})} / ${utils.prettyMs(player.queue.current.duration, {
colonNotation: true,
})}\``
)
.setThumbnail(player.queue.current.displayThumbnail())
.setURL(player.queue.current.uri)
.setColor(client.color)
.setTitle(`🎶 **${player.queue.current.title}** 🎶`)
.addField(`🎼 Song By: `, `\`${player.queue.current.author}\``, true)
.addField(
`🔢 Queue length: `,
`\`${player.queue.length} Songs\``,
true
)
.setFooter(
`Requested by: ${player.queue.current.requester.tag}`,
player.queue.current.requester.displayAvatarURL({
dynamic: true,
})
),
],
});
},
};

View file

@ -1,29 +0,0 @@
module.exports = {
name: "pause",
description: "Pauses the current playing music",
category: "Music",
run: async (client, interaction, args) => {
const player = await client.manager.get(interaction.guild.id);
const channel = interaction.member.voice.channel.id;
if (!channel) {
return client.err(
interaction,
"**You must be in a voice channel to use this command.**"
);
}
if (player.voiceChannel !== channel) {
return client.err(
interaction,
"**You must be in the same voice channel as me to use this command**"
);
}
if (!player) client.err(interaction, "**Nothing is playing right now**");
if (player.paused) {
client.err(interaction, "Music is already paused");
} else {
player.pause(true);
client.se(interaction, "**⏯ Paused!**");
}
},
};

View file

@ -1,145 +0,0 @@
const { EmbedBuilder } = require("discord.js");
module.exports = {
name: "play",
description: "Plays your favourite music from YouTube or Spotify",
usage: "(Song/Song URL)",
category: "Music",
options: [
{
type: 3,
name: "song",
description: "Play song or a playlist in the voice channel",
required: true,
},
],
run: async (client, interaction, args, utils) => {
const voiceChannel = interaction.member.voice.channel;
if (!voiceChannel) {
client.err(
interaction,
"**You must be in a voice channel to use this command**"
);
} else {
const player = client.manager.create({
guild: interaction.guild.id,
voiceChannel: voiceChannel.id,
textChannel: interaction.channel.id,
selfDeafen: true,
volume: 100,
});
if (player.state != "CONNECTED") await player.connect();
const search = args[0];
let res;
try {
res = await player.search(search, interaction.user);
if (res.loadType === "LOAD_FAILED") {
if (!player.queue.current) player.destroy();
client.err(interaction, "**There was an error while searching**");
}
} catch {
client.err(interaction, "**There was an error while searching**");
}
switch (res.loadType) {
case "NO_MATCHES":
if (!player.queue.current) player.destroy();
client.err(interaction, "**No results were found**");
break;
case "TRACK_LOADED":
player.queue.add(res.tracks[0]);
if (!player.playing && !player.paused && !player.queue.length) {
player.play();
}
const SongAddedEmbed = new EmbedBuilder()
.setAuthor(`Added to queue`, client.user.displayAvatarURL())
.setThumbnail(res.tracks[0].displayThumbnail())
.setColor(client.color)
.setDescription(`[${res.tracks[0].title}](${res.tracks[0].uri})`)
.addField(
"Duration",
`\`${utils.prettyMs(res.tracks[0].duration, {
colonNotation: true,
})}\``,
true
);
if (player.queue.totalSize > 1) {
SongAddedEmbed.addField(
"Position in queue",
`${player.queue.size - 0}`,
true
);
}
interaction.followUp({ embeds: [SongAddedEmbed] });
break;
case "PLAYLIST_LOADED":
player.queue.add(res.tracks);
await player.play();
const SongAdded = new EmbedBuilder()
.setAuthor(
`Playlist added to queue`,
client.user.displayAvatarURL()
)
.setThumbnail(res.tracks[0].displayThumbnail())
.setColor(client.color)
.setDescription(`[${res.playlist.name}](${args[0]})`)
.addField("Enqueued", `\`${res.tracks.length}\` songs`, false)
.addField(
"Playlist duration",
`\`${utils.prettyMs(res.playlist.duration, {
colonNotation: true,
})}\``,
false
);
interaction.followUp({ embeds: [SongAdded] });
break;
case "SEARCH_RESULT":
const track = res.tracks[0];
player.queue.add(track);
if (!player.playing && !player.paused && !player.queue.length) {
const SongAddedEmbed = new EmbedBuilder()
.setAuthor(`Added to queue`, client.user.displayAvatarURL())
.setThumbnail(track.displayThumbnail())
.setColor(client.color)
.setDescription(`[${track.title}](${track.uri})`)
.addField(
"Duration",
`\`${utils.prettyMs(track.duration, {
colonNotation: true,
})}\``,
true
);
if (player.queue.totalSize > 1) {
SongAddedEmbed.addField(
"Position in queue",
`${player.queue.size - 0}`,
true
);
}
player.play();
interaction.followUp({ embeds: [SongAddedEmbed] });
} else {
const SongAddedEmbed = new EmbedBuilder()
.setAuthor(`Added to queue`, client.user.displayAvatarURL())
.setThumbnail(track.displayThumbnail())
.setColor(client.color)
.setDescription(`[${track.title}](${track.uri})`)
.addField(
"Duration",
`\`${utils.prettyMs(track.duration, {
colonNotation: true,
})}\``,
true
);
if (player.queue.totalSize > 1) {
SongAddedEmbed.addField(
"Position in queue",
`${player.queue.size - 0}`,
true
);
}
interaction.followUp({ embeds: [SongAddedEmbed] });
break;
}
}
}
},
};

View file

@ -1,114 +0,0 @@
const { EmbedBuilder } = require("discord.js");
const { Pagination } = require("cath");
module.exports = {
name: "queue",
description: "To show the songs queue",
category: "Music",
run: async (client, interaction, args, utils) => {
const pagination = new Pagination();
const player = await client.manager.get(interaction.guild.id);
const channel = interaction.member.voice.channel.id;
if (!channel) {
client.err(
interaction,
"**You must be in a voice channel to use this command.**"
);
}
if (player.voiceChannel !== channel) {
client.err(
interaction,
"**You must be in the same voice channel as me to use this command**"
);
}
if (!player) client.err(interaction, "**Nothing is playing right now**");
if (!player.queue || !player.queue.length || player.queue === 0) {
const QueueEmbed = new EmbedBuilder()
.setAuthor(
"Currently playing",
interaction.user.displayAvatarURL({ dynamic: true })
)
.setColor(client.color)
.setDescription(
`[${player.queue.current.title}](${player.queue.current.uri})`
)
.addField("Requested by", `${player.queue.current.requester}`, true)
.addField(
"Duration",
`${
utils.progressBar(
player.position,
player.queue.current.duration,
15
).Bar
} \`[${utils.prettyMs(player.position, {
colonNotation: true,
})} / ${utils.prettyMs(player.queue.current.duration, {
colonNotation: true,
})}]\``
)
.setTimestamp()
.setThumbnail(player.queue.current.displayThumbnail());
interaction.followUp({ embeds: [QueueEmbed] });
}
const queue = player.queue.map((t, i) => {
t.index = i;
return t;
});
const mapped = queue.map((t, i) => {
if (i == 0) {
return `**Up Next:** \n\`${t.index + 1}:\` [${t.title}](${
t.uri
}) \n\`${utils.prettyMs(t.duration, {
colonNotation: true,
})}\` **|** Requested by: ${t.requester}\n`;
} else {
return `\n\`${t.index + 1}:\` [${t.title}](${
t.uri
}) \n\`${utils.prettyMs(t.duration, {
colonNotation: true,
})}\` **|** Requested by: ${t.requester}\n`;
}
});
const c = pagination.chunk(mapped, 10).map(x => x.join("\n"));
const embed = new EmbedBuilder()
.setAuthor(
`Queue for ${interaction.guild.name}`,
interaction.user.displayAvatarURL({ dynamic: true })
)
.setColor(client.color)
.setDescription(c[0])
.addField("Total songs: \n", `\`${player.queue.totalSize - 1}\``, true)
.addField(
"Total length: \n",
`\`${utils.prettyMs(player.queue.duration, {
colonNotation: true,
})}\``,
true
)
.addField("Requested by:", `${player.queue.current.requester}`, true)
.addField(
"Current song duration:",
`${
utils.progressBar(player.position, player.queue.current.duration, 15)
.Bar
} \`[${utils.prettyMs(player.position, {
colonNotation: true,
})} / ${utils.prettyMs(player.queue.current.duration, {
colonNotation: true,
})}]\``
)
.addField(
"**Currently Playing:**",
`[${player.queue.current.title}](${player.queue.current.uri})`,
true
)
.setTimestamp()
.setFooter({ text: `Page 1 of ${c.length}` })
.setThumbnail(player.queue.current.displayThumbnail());
const msg = await interaction.followUp({
embeds: [embed],
});
pagination.pagination(msg, interaction.user, c);
},
};

View file

@ -1,42 +0,0 @@
module.exports = {
name: "remove",
description: "Remove a song from the queue",
category: "Music",
options: [
{
type: 4,
name: "track",
description: "Remove a song from the queue",
required: true,
},
],
run: async (client, interaction, args) => {
const player = await client.manager.get(interaction.guild.id);
const channel = interaction.member.voice.channel.id;
if (!channel) {
client.err(
interaction,
"**You must be in a voice channel to use this command.**"
);
}
if (player.voiceChannel !== channel) {
client.err(
interaction,
"**You must be in the same voice channel as me to use this command**"
);
}
if (!player) client.err(interaction, "**Nothing is playing right now**");
if (args[0] > player.queue.length) {
client.err(
interaction,
`The queue has only **${player?.queue.length}** songs`
);
} else {
client.se(
interaction,
`✅ | **Removed track** \`${parseInt(args[0])}\` from the queue!`
);
player.queue.remove(parseInt(args[0]) - 1);
}
},
};

View file

@ -1,28 +0,0 @@
module.exports = {
name: "resume",
description: "Pauses the current playing music",
category: "Music",
run: async (client, interaction) => {
const player = await client.manager.get(interaction.guild.id);
const channel = interaction.member.voice.channel.id;
if (!channel) {
client.err(
interaction,
"**You must be in a voice channel to use this command.**"
);
}
if (player.voiceChannel !== channel) {
client.err(
interaction,
"**You must be in the same voice channel as me to use this command**"
);
}
if (!player) client.err(interaction, "**Nothing is playing right now**");
if (player.playing) {
client.err(interaction, "**Music is already resumed!**");
} else {
player.pause(false);
client.se(interaction, "**⏯ Resumed!**");
}
},
};

View file

@ -1,53 +0,0 @@
module.exports = {
name: "seek",
description: "seek the current playing music",
category: "Music",
usage: "(Number)",
options: [
{
type: 3,
name: "position",
description: "Enter a timestamp you want to seek to. Example - 2m 10s",
required: true,
},
],
run: async (client, interaction, args, utils) => {
const player = await client.manager.get(interaction.guild.id);
const channel = interaction.member.voice.channel.id;
if (!channel) {
client.err(
interaction,
"**You must be in a voice channel to use this command.**"
);
}
if (player.voiceChannel !== channel) {
client.err(
interaction,
"**You must be in the same voice channel as me to use this command**"
);
}
if (!player) client.err(interaction, "**Nothing is playing right now**");
const SeekTo = utils.parseTimestring(args[0]);
if (SeekTo < 0 || SeekTo >= player.queue.current.duration / 1000) {
client.err(
interaction,
`You may seek from \`0\` - \`${player.queue.current.duration}\`\nExample - 2m 10s`
);
}
if (!player.queue.current.isSeekable) {
client.err(interaction, "**I'm not able to seek this song**");
}
if (!SeekTo) {
client.err(
interaction,
`You may seek from \`0\` - \`${player.queue.current.duration}\`\nExample - 2m 10s`
);
}
player.seek(SeekTo * 1000);
client.se(
interaction,
"✅ | **Successfully moved the song to **",
`\`${SeekTo}\``
);
},
};

View file

@ -1,27 +0,0 @@
module.exports = {
name: "shuffle",
description: "Music shuffle",
category: "Music",
run: async (client, interaction) => {
const player = await client.manager.get(interaction.guild.id);
const channel = interaction.member.voice.channel.id;
if (!channel) {
client.err(
interaction,
"**You must be in a voice channel to use this command.**"
);
}
if (player.voiceChannel !== channel) {
client.err(
interaction,
"**You must be in the same voice channel as me to use this command**"
);
}
if (!player) client.err(interaction, "**Nothing is playing right now**");
if (!player.queue || !player.queue.length || player.queue.length === 0) {
client.err(interaction, "**Not enough songs in the queue to shuffle**");
}
player.queue.shuffle();
client.se(interaction, "✅ | Shuffled the queue");
},
};

View file

@ -1,38 +0,0 @@
module.exports = {
name: "skip",
description: "Skips to a song in a queue",
category: "Music",
options: [
{
type: 4,
name: "position",
description: "Skips to a specific song in the queue",
required: true,
},
],
run: async (client, interaction, args) => {
const player = await client.manager.get(interaction.guild.id);
const channel = interaction.member.voice.channel.id;
if (!channel) {
client.err(
interaction,
"**You must be in a voice channel to use this command.**"
);
}
if (player.voiceChannel !== channel) {
client.err(
interaction,
"**You must be in the same voice channel as me to use this command**"
);
}
if (!player?.queue?.current) {
client.err(interaction, "**Nothing is playing right now**");
}
const skipTo = args[0];
if (skipTo < 1 || skipTo > player.queue.length) {
client.err(interaction, "❌ | **Invalid number to skip!**");
}
player.stop(skipTo);
client.se(interaction, `⏭ Skipped \`${Number(skipTo)}\` songs`);
},
};

View file

@ -1,37 +0,0 @@
module.exports = {
name: "volume",
description: "To change the server song queue volume",
category: "Music",
description: "Set volume level of the music",
options: [
{
type: 4,
name: "volume",
description: "The volume of the player. Default is 100",
required: true,
},
],
run: async (client, interaction) => {
const player = await client.manager.get(interaction.guild.id);
const channel = interaction.member.voice.channel.id;
if (!channel) {
client.err(
interaction,
"**You must be in a voice channel to use this command.**"
);
}
if (player.voiceChannel !== channel) {
client.err(
interaction,
"**You must be in the same voice channel as me to use this command**"
);
}
if (!player) client.err(interaction, "**Nothing is playing right now**");
const vol = parseInt(args[0]);
player.setVolume(vol);
client.se(
interaction,
`🔉 | The player's volume has been set to \`${player.volume}\``
);
},
};

View file

@ -1,68 +0,0 @@
module.exports = {
name: "economy",
category: "Owner",
description: "Add/Remove coins from someone",
Owner: true,
options: [
{
type: 1,
name: "add",
description: "Remove coins from someone",
options: [
{
type: 6,
name: "user",
description: "The user you want to add",
required: true,
},
{
type: 4,
name: "cp",
description: "The amount of CP you want to add",
required: true,
},
],
},
{
type: 1,
name: "rmv",
description: "Remove coins from someone",
options: [
{
type: 6,
name: "user",
description: "The user you want to remove",
required: true,
},
{
type: 4,
name: "cp",
description: "The amount of CP you want to remove",
required: true,
},
],
},
],
run: async (client, interaction, args) => {
if (args[0] === "add") {
await client.add(args[0], args[1], interaction);
interaction.followUp({
content: `<a:nyx_checkmark:897240322411724841> Successfully added **${interaction.options.getInteger(
"cp"
)}** ${client.currency} in **${
interaction.options.getUser("user").username
}**'s balance`,
});
}
if (args[0] === "rmv") {
await client.rmv(args[0], args[1]);
interaction.followUp({
content: `<a:nyx_checkmark:897240322411724841> Successfully removed **${interaction.options.getInteger(
"cp"
)}** ${client.currency} from **${
interaction.options.getUser("user").username
}**'s balance`,
});
}
},
};

View file

@ -1,38 +0,0 @@
const { EmbedBuilder } = require("discord.js");
module.exports = {
name: "afk",
description: "Tell someone you are AFK.",
usage: "{Status}",
category: "Utilities",
options: [
{
type: 3,
name: "status",
description: "The status that shows to user while you are AFK",
required: false,
},
],
run: async (client, interaction, args) => {
const uuser = interaction.guild.members.cache.get(interaction.user.id);
const content = args[0] || "No status provided.";
uuser.setNickname(`[AFK] ${interaction.user.username}`).catch();
await client.data.AFK(interaction.user.id, content);
const embed = new EmbedBuilder()
.setDescription(
`${interaction.user.username} is set into AFK.\nStatus : ${content}`
)
.setTimestamp()
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setColor(client.color)
.setAuthor({
text: interaction.user.username,
iconURL: interaction.user.displayAvatarURL({ dynamic: true }),
})
.setURL(client.web);
interaction.followUp({ embeds: [embed] });
},
};

View file

@ -1,17 +0,0 @@
const CodeClient = require("../../client/CodeClient");
module.exports = {
name: "Create Code Bin",
type: "MESSAGE",
run: async (client, interaction) => {
const msg = await interaction.channel.messages.fetch(interaction.targetId);
if (!msg.content) {
interaction.followUp({ content: "The message must have a content" });
} else {
const title = "Code";
const description = msg.author.tag;
const code = msg.content;
const link = await CodeClient.createBin(title, description, code);
interaction.followUp({ content: link });
}
},
};

View file

@ -1,85 +0,0 @@
const { EmbedBuilder, MessageActionRow, MessageButton } = require("discord.js");
const draws = require("../../../util/Data/draws.json");
module.exports = {
name: "draw",
description: "Buy a lucky draw",
run: async (client, message, args, utils) => {
const embed = new EmbedBuilder()
.setTitle("**__Daily Lucky Draw__**")
.setColor(client.color)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.setDescription(
"Welcome to the Lucky Draw,\nclick `Spin`, so that the draw spins and hits a random item.\nClick `Info` to find out how high the probability is\n that a particular item will be unlocked"
)
.addFields(
draws[0].map(c => {
return { name: c.name, value: c.emoji, inline: true };
})
);
const button1 = new MessageButton()
.setStyle("SUCCESS")
.setEmoji("🔄")
.setLabel("Spin")
.setCustomId("spin");
const button2 = new MessageButton()
.setStyle("PRIMARY")
.setEmoji("894962394932064346")
.setLabel("Info")
.setCustomId("spininfo");
const row = new MessageActionRow().addComponents([button1, button2]);
const msg = await message.channel.send({
embeds: [embed],
components: [row],
});
const filter = i =>
["spin", "spininfo"].includes(i.customId) &&
i.user.id === message.author.id;
const collector = msg.createMessageComponentCollector({
filter,
time: 999999,
});
function select() {
let pick = Math.floor(Math.random() * 100);
for (const g in draws[0]) {
pick -= draws[0][g].percent;
if (pick <= 0) {
return `You got **${draws[0][g].name}** with propability **${draws[0][g].percent}%**`;
}
}
}
console.log(utils.colorize("test").magenta);
collector.on("collect", i => {
if (i.customId === "spin") {
i.reply({
content: select(),
});
}
if (i.customId === "spininfo") {
i.reply({
embeds: [
new EmbedBuilder()
.setTitle("**__Information Table__**")
.addFields(
draws[0].map(c => {
return {
name: `**${c.name}**`,
value: `Percentage: ${c.percent}%`,
inline: true,
};
})
)
.addField("Name:", "**Item 1**")
.addField("Percent:", "**69**")
.addField("Emoji:", ":bughuntergold:"),
],
});
}
});
},
};

View file

@ -1,83 +0,0 @@
const { Util } = require("discord.js");
module.exports = {
name: "emoji",
usage: "(Emoji)",
description: "Show an emoji URL",
category: "Utilities",
options: [
{
type: 3,
name: "first",
description: "The first emoji",
required: true,
},
{
type: 3,
name: "second",
description: "The second emoji",
required: false,
},
{
type: 3,
name: "third",
description: "The third emoji",
required: false,
},
{
type: 3,
name: "forth",
description: "The forth emoji",
required: false,
},
{
type: 3,
name: "fifth",
description: "The fifth emoji",
required: false,
},
{
type: 3,
name: "sixth",
description: "The sixth emoji",
required: false,
},
{
type: 3,
name: "seventh",
description: "The seventh emoji",
required: false,
},
{
type: 3,
name: "eighth",
description: "The eighth emoji",
required: false,
},
{
type: 3,
name: "ninth",
description: "The ninth emoji",
required: false,
},
{
type: 3,
name: "tenth",
description: "The tenth emoji",
required: false,
},
],
run: async (client, interaction, args) => {
await interaction.deleteReply();
for (const rawEmoji of args) {
const parsedEmoji = Util.parseEmoji(rawEmoji);
if (parsedEmoji.id) {
const extension = parsedEmoji.animated ? ".gif" : ".png";
const url = `https://cdn.discordapp.com/emojis/${
parsedEmoji.id + extension
}`;
await interaction.channel.send({ content: `Emoji URL:\n${url}` });
}
}
},
};

View file

@ -1,38 +0,0 @@
module.exports = {
name: "emojiadd",
usage: "(Link) (Name)",
description: "Show an emoji URL or add the emoji to the server",
category: "Utilities",
UserPerms: ["MANAGE_EMOJIS_AND_STICKERS"],
BotPerms: ["MANAGE_EMOJIS_AND_STICKERS"],
options: [
{
type: 3,
name: "link",
description: "The link you want to add",
required: true,
},
{
type: 3,
name: "name",
description: "The emoji name you want to add",
required: true,
},
],
run: async (client, interaction, args) => {
try {
if (args[1].length < 2 || args[1].match(/\W/)) {
interaction.followUp({
content:
"The emoji name must have at least 2 charcter and must only contain alphanumeric characters & underscore",
});
}
interaction.guild.emojis.create(args[0], args[1]).then(() => {
const em = interaction.guild.emojis.cache.find(a => a.name == args[1]);
interaction.followUp(`Added <:${em.name}:${em.id}> to the server`);
});
} catch (e) {
console.log(e);
}
},
};

View file

@ -1,44 +0,0 @@
module.exports = {
name: "emojify",
description: "Emojify",
options: [
{
type: 3,
name: "word",
description: "word",
required: true,
},
],
run: async (client, interaction, args) => {
const s = {
0: ":zero:",
1: ":one:",
2: ":two:",
3: ":three:",
4: ":four:",
5: ":five:",
6: ":six:",
7: ":seven:",
8: ":eight:",
9: ":nine:",
"#": ":hash:",
"*": ":asterisk:",
"!": ":grey_exclamation:",
"?": ":grey_question:",
" ": " ",
};
let ar = args
.join(" ")
.toLowerCase()
.split("")
.map(l => {
if (/[a-z]/g.test(l)) {
return `:regional_indicator_${l}:`;
} else if (s[l]) {
return `${s[l]}`;
}
})
.join("");
interaction.followUp({ content: ar });
},
};

View file

@ -1,131 +0,0 @@
const { EmbedBuilder } = require("discord.js");
const moment = require("moment");
module.exports = {
name: "editsnipe",
description: "Snipes a edited message",
category: "Utilities",
options: [
{
type: 7,
name: "channel",
description: "The sniped channel",
required: true,
channelTypes: [0],
},
{
type: 4,
name: "message",
description: "The sniped message",
required: false,
},
],
run: async (client, interaction, args) => {
var i = 0;
let description = "";
const embed = new EmbedBuilder()
.setAuthor(
`Sniped by ${interaction.user.tag}`,
interaction.user.displayAvatarURL({ dynamic: true })
)
.setColor(client.color)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.setURL(client.web);
const snipes = client.esnipes.get(args[0]) || [];
if (interaction.guild.channels.cache.get(args[0]).type !== "GUILD_TEXT") {
interaction.followUp({ content: "Please provide a text channel" });
} else if (args[1]) {
const msg = snipes[args[1] - 1];
if (!msg) {
snipes.forEach(m => {
const map = [];
for (var i = 0; i < m.attachment?.length; i++) {
map.push(
`**Attchment ${i + 1}:** [Click to view](${m.attachment[i]})`
);
}
if (m.author !== "No Author") {
description += `\n\n**Author:** ${m.author.username}#${
m.author.discriminator
} (Deleted ${moment(m.date).fromNow()})\n**ID:** ${
m.author.id
}\n**Old Content:** ${m.oldContent}\n**New Content:** ${
m.newContent
}\n${map ? map.join("\n") : ""}`;
i++;
} else {
description += `\n\n**Author:** None (Deleted ${moment(
m.date
).fromNow()})\n\n**Old Content:** ${
m.oldContent
}\n**New Content:** ${m.newContent}\n${map ? map.join("\n") : ""}`;
i++;
}
});
embed.setDescription(description);
return interaction.followUp({ embeds: [embed] });
} else {
const map = [];
for (var i = 0; i < msg.attachment?.length; i++) {
map.push(
`**Attchment ${i + 1}:** [Click to view](${msg.attachment[i]})`
);
}
if (msg.author !== "No Author") {
description += `\n\n**Author:** ${msg.author.username}#${
msg.author.discriminator
} (Deleted ${moment(msg.date).fromNow()})\n**ID:** ${
msg.author.id
}\n**Old Content:** ${m.oldContent}\n**New Content:** ${
m.newContent
}\n${map ? map.join("\n") : ""}`;
i++;
} else {
description += `\n\n**Author:** None (Deleted ${moment(
msg.date
).fromNow()})\n\n**Old Content:** ${m.oldContent}\n**New Content:** ${
m.newContent
}\n${map ? map.join("\n") : ""}`;
i++;
}
embed.setDescription(description);
return interaction.followUp({ embeds: [embed] });
}
} else if (!snipes.length) {
interaction.followUp({
content: "There isn't any snipe in this channel yet",
});
} else {
snipes.forEach(m => {
const map = [];
for (var i = 0; i < m.attachment?.length; i++) {
map.push(
`**Attchment ${i + 1}:** [Click to view](${m.attachment[i]})`
);
}
if (m.author !== "No Author") {
description += `\n\n**Author:** ${m.author.username}#${
m.author.discriminator
} (Deleted ${moment(m.date).fromNow()})\n**ID:** ${
m.author.id
}\n**Old Content:** ${m.oldContent}\n**New Content:** ${
m.newContent
}\n${map ? map.join("\n") : ""}`;
i++;
} else {
description += `\n\n**Author:** None (Deleted ${moment(
m.date
).fromNow()})\n\n**Old Content:** ${m.oldContent}\n**New Content:** ${
m.newContent
}\n${map ? map.join("\n") : ""}`;
i++;
}
});
embed.setDescription(description);
return interaction.followUp({ embeds: [embed] });
}
},
};

View file

@ -1,144 +0,0 @@
const GiveawaysClient = require("../../client/GiveawaysClient");
module.exports = {
name: "giveaway",
description: "Giveaway",
UserPerms: ["MANAGE_MESSAGES"],
options: [
{
type: 1,
name: "start",
description: "Start a giveaway",
options: [
{
type: 3,
name: "prize",
description: "The prize of the giveaway",
required: true,
choices: [],
},
{
type: 4,
name: "winners",
description: "The amount of winners of the giveaway",
required: true,
},
{
type: 3,
name: "time",
description: "The amount of time of the giveaway",
required: true,
},
{
type: 7,
name: "channel",
description: "The channel of the giveaway",
required: true,
channelTypes: [0],
},
{
type: 8,
name: "role1",
description: "The required role to join the giveaway",
},
{
type: 8,
name: "role2",
description: "The required role to join the giveaway",
},
{
type: 8,
name: "role3",
description: "The required role to join the giveaway",
},
],
},
{
type: 1,
name: "reroll",
description: "Reroll a giveaway",
options: [
{
type: 3,
name: "message",
description: "The message ID of the giveaway",
required: true,
choices: [],
},
],
},
{
type: 1,
name: "end",
description: "End a giveaway",
options: [
{
type: 3,
name: "message",
description: "The message ID of the giveaway",
required: true,
choices: [],
},
],
},
],
run: async (client, interaction, args, utils) => {
if (args[0] == "start") {
const [, prize, winners, time, channel, roles1, roles2, roles3] = args;
if (!utils.ms(time)) {
interaction.followUp({
content: "Time must be a valid time to parse (Example: 10m, 100s)",
});
}
await GiveawaysClient.create(client, {
prize,
host: interaction.user.id,
winners,
endAfter: time,
requirements: roles1
? {
Enabled: true,
Roles: [roles1],
}
: roles2 && roles1
? {
Enabled: true,
Roles: [roles1, roles2],
}
: roles1 && roles2 && roles3
? {
Enabled: true,
Roles: [roles1, roles2, roles3],
}
: { Enabled: false },
Channel: channel,
});
interaction.followUp({
content: `Giveaway is started in ${interaction.guild.channels.cache.get(
channel
)}`,
});
} else if (args[0] == "reroll") {
const giveaway = await GiveawaysClient.getByMessage(args[1]);
const m = await client.guilds.cache
.get(giveaway.Guild)
.channels.cache.get(giveaway.Channel)
.messages.fetch(args[1]);
if (!m) {
interaction.followUp({ content: "Unable to find the giveaway ⚠" });
} else {
await GiveawaysClient.end(m, giveaway, m);
}
} else {
const giveaway = await GiveawaysClient.getByMessage(args[1]);
const m = await client.guilds.cache
.get(giveaway.Guild)
.channels.cache.get(giveaway.Channel)
.messages.fetch(args[1]);
if (!m) {
interaction.followUp({ content: "Unable to find the giveaway ⚠" });
} else {
await GiveawaysClient.end(m, giveaway, m);
}
}
},
};

View file

@ -1,58 +0,0 @@
const { EmbedBuilder } = require("discord.js");
const axios = require("axios");
const { Pagination } = require("cath");
module.exports = {
name: "lyrics",
description: "Get lyrics for the currently playing song",
category: "Music",
usage: "(Song)",
options: [
{
type: 3,
name: "song",
description: "The song to search",
required: true,
},
],
run: async (client, interaction, args) => {
const splitlyrics = new Pagination();
const lyricsdata = await axios
.get(
`${process.env.api}/api/v1/lyrics?name=${encodeURIComponent(args[0])}`
)
.then(res => res.data);
if (!lyricsdata?.lyrics) {
interaction.followUp({
content: `**No lyrics are found for ${args[0]}**`,
});
} else {
const splittedLyrics = splitlyrics.chunk(lyricsdata.lyrics, 1024);
const lyricsEmbed = new EmbedBuilder()
.setAuthor(`Lyrics`)
.setColor("YELLOW")
.addFields(
{ name: "Song Name", value: lyricsdata.title, inline: true },
{ name: "", value: "", inline: true },
{
name: "Full Lyrics",
value: `${
process.env.api
}/api/v1/lyrics/full?name=${encodeURIComponent(args[0])}`,
inline: true,
}
)
.setDescription(splittedLyrics[0])
.setFooter({ text: `Page 1 of ${splittedLyrics.length}` })
.setThumbnail(lyricsdata.image)
.setTimestamp();
const lyricsMsg = await interaction.followUp({ embeds: [lyricsEmbed] });
if (splittedLyrics.length > 1) {
await splitlyrics.pagination(
lyricsMsg,
interaction.user,
splittedLyrics
);
}
}
},
};

View file

@ -1,166 +0,0 @@
const schema = require("../../models/modmail");
const { EmbedBuilder, MessageAttachment } = require("discord.js");
const fs = require("fs");
module.exports = {
name: "modmail",
BotPerm: "MANAGE_CHANNELS",
description: "Create a modmail thread with moderators in a server",
usage: "(Emoji) (Text)",
category: "Utilities",
run: async (client, interaction, args) => {
try {
const data = await schema.findOne({ Guild: interaction.guild.id });
if (
!data ||
!data.Role ||
!data.Category ||
!data.Choices ||
!Object.entries(data.Choices).length ||
!interaction.guild.roles.cache.has(data.Role) ||
!interaction.guild.channels.cache.find(
value => value.type == "GUILD_CATEGORY" && value.id === data.Category
)
) {
return interaction.followUp({
content: `This server isn't setup properly. Please find an administrator or a moderator to specify a category, role and choices for users to create thread. The issue may be caused by invalid role/category.`,
});
}
interaction.deleteReply();
const choices = Object.entries(data.Choices);
const embed = new EmbedBuilder()
.setDescription(
`Choices of topic:\n${choices
.map(value => `${value[1].emoji} - ${value[1].text}`)
.join("\n")}`
)
.setAuthor(
interaction.guild.name,
interaction.guild.iconURL({ dynamic: true })
)
.setColor(client.color)
.setTimestamp()
.setTitle(`${interaction.user.tag}'s modmail`);
const msg = await interaction.user.send({
content: "Please react below",
embeds: [embed],
});
choices.map(async value => {
await msg.react(value[1].emoji);
});
const filter = (reaction, user) => {
return (
choices.map(value => value[1].emoji).includes(reaction.emoji.name) &&
user.id !== interaction.user.id
);
};
const reactionCollector = msg.createReactionCollector({
filter,
});
let type;
reactionCollector
.on("collect", async (reaction, user) => {
type = choices.find(value => value[1].emoji == reaction.emoji.name);
await msg.delete();
reactionCollector.stop("done");
})
.on("end", async (collected, reason) => {
if (reason.toLowerCase() == "time") {
return interaction.user.send({
content: "You didn't provide a reaction in-time. Cancelled",
});
} else {
const channel = await interaction.guild.channels.create(
`${interaction.user.username}-${interaction.user.discriminator}`,
{
reason: "Modmail thread",
parent: data.Category,
topic: `${type[1].text}`,
type: "text",
}
);
const transcript = [];
channel.permissionOverwrites.create(data.Role, {
VIEW_CHANNEL: true,
SEND_MESSAGES: true,
});
channel.permissionOverwrites.create(interaction.guild.id, {
VIEW_CHANNEL: false,
});
channel.send({
content: `A modmail thread has been started by **${interaction.user.tag}** with type: **${type[1].text}**\nUse \`close\` to close the thread`,
});
interaction.user.send({
content: "Thread created. Use `close` to close the thread.",
});
const filter = m => !m.author.bot;
const channelCollector = channel.createMessageCollector({ filter });
const dmCollector =
interaction.user.dmChannel.createMessageCollector({
filter,
});
channelCollector.on("collect", async m => {
if (m.content.toLowerCase().startsWith("close")) {
interaction.user.send({
content: `Admin has closed the thread`,
});
channel.send({ content: "Closing.." });
dmCollector.stop("done");
channelCollector.stop("done");
fs.writeFileSync(
`./${interaction.user.id}.txt`,
transcript.join("\n")
);
const attachment = new MessageAttachment(
fs.createReadStream(`./${interaction.user.id}.txt`),
`Transcript-${interaction.user.id}`
);
await channel.send({
content: "Transcript:",
files: [attachment],
});
fs.unlinkSync(`./transcript-${interaction.user.id}.txt`);
setTimeout(() => {
channel.delete();
}, 1000 * 10);
}
interaction.user.send({ content: `**Admin**: ${m.content}` });
transcript.push(`**Admin**: ${m.content}`);
});
dmCollector.on("collect", async m => {
if (m.content.toLowerCase().startsWith("close")) {
interaction.user.send({ content: "Closed" });
channel.send({
content: `${interaction.user.tag} has closed the thread`,
});
dmCollector.stop("done");
channelCollector.stop("done");
fs.writeFileSync(
`./${interaction.user.id}.txt`,
transcript.join("\n")
);
const attachment = new MessageAttachment(
fs.createReadStream(`./${interaction.user.id}.txt`),
`Transcript-${interaction.user.id}`
);
await channel.send({
content: "Transcript:",
files: [attachment],
});
fs.unlinkSync(`./${interaction.user.id}.txt`);
setTimeout(() => {
channel.delete();
}, 1000 * 60 * 12);
}
channel.send({
content: `**${interaction.user.tag}**: ${m.content}`,
});
transcript.push(`**${interaction.user.tag}**: ${m.content}`);
});
}
});
} catch (e) {
console.log(e);
return interaction.followUp({ content: "An error occured" });
}
},
};

View file

@ -1,150 +0,0 @@
const { getreddit } = require("cath");
const { MessageActionRow, MessageButton, EmbedBuilder } = require("discord.js");
module.exports = {
name: "nsfw",
description: "NSFW command",
run: async (client, interaction) => {
const msg = await interaction.channel.send({ content: "Getting images" });
async function embed() {
if (!interaction.channel.nsfw) {
const embed = new EmbedBuilder()
.setTitle(`AYO Calm Yo Cheeks`)
.setDescription("This command only works in NSFW Channels!")
.setImage(
"https://media.discordapp.net/attachments/851761493815853060/893777701599584266/warning.gif"
)
.setColor(client.color)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp();
interaction.followUp({ embeds: [embed] });
}
let subreddits = [
"GodPussy",
"peachlips",
"vagina",
"GoneWild",
"WorkGoneWild",
"GoneWild30Plus",
"hentai",
"HentaiAnime",
"nekogirls",
"ass",
"BestBooties",
"BootyGIFs",
"booty_queens",
"BlowJob",
"blowjobs",
"blowjobgifs",
"OralSex",
"boobs",
"GrabHerTitties",
"titfuck",
"milf",
"OnlyHotMilfs",
"realmoms",
"thighs",
"PerfectThighs",
"thickthighs",
"PushHerHead",
"ThroatFuck",
];
const reddit = subreddits[Math.round(Math.random() * subreddits.length)];
let data = await getreddit(reddit);
while (data.length === 0) {
while (data.image.length === 0) {
data = await getreddit(reddit);
}
}
let embed1 = null;
embed1 = new EmbedBuilder({
title: data.title,
url: data.url,
image: { url: data.image },
timestamp: Date.now(),
footer: { text: data.footer },
color: client.color,
author: {
name: interaction.user.tag,
iconURL: interaction.user.displayAvatarURL({ dynamic: true }),
},
});
return embed1;
}
const row = new MessageActionRow().addComponents(
new MessageButton()
.setCustomId("reload")
.setLabel("Reload")
.setStyle("SUCCESS")
);
const disabled = new MessageActionRow().addComponents(
new MessageButton()
.setCustomId("reload")
.setLabel("Reload")
.setStyle("SECONDARY")
.setDisabled(true)
);
await msg.delete();
let m = await interaction.followUp({
embeds: [await embed()],
components: [row],
});
const collector = m.createMessageComponentCollector({
componentType: "BUTTON",
time: 120000,
});
collector.on("collect", async i => {
if (i.user.id === interaction.user.id) {
i.deferUpdate();
await update(m);
collector.stop();
} else {
i.reply({
content: `These buttons aren't for you!`,
ephemeral: true,
});
}
});
collector.on("end", (mes, r) => {
if (r == "time") {
m.edit({
components: [disabled],
});
}
});
async function update(m) {
m.edit({
embeds: [await embed()],
}).catch(null);
const collector = m.createMessageComponentCollector({
componentType: "BUTTON",
time: 120000,
});
collector.on("collect", async i => {
if (i.user.id === interaction.user.id) {
i.deferUpdate();
await update(m);
collector.stop();
} else {
i.reply({
content: `These buttons aren't for you!`,
ephemeral: true,
});
}
});
collector.on("end", (mes, r) => {
if (r == "time") {
m.edit({
components: [disabled],
});
}
});
}
},
};

View file

@ -1,41 +0,0 @@
const { EmbedBuilder } = require("discord.js");
const block = "⬛";
const heart = "🟥";
module.exports = {
name: "ship",
description: "Ship an user to an user",
usage: "(User) (User)",
category: "Fun",
options: [
{
type: 6,
name: "1stuser",
description: "The user you want to ship",
required: true,
},
{
type: 6,
name: "2nduser",
description: "The user you want to ship",
required: true,
},
],
run: async (client, interaction, args) => {
const user1 = interaction.guild.members.cache.get(args[0]).user.username;
const user2 = interaction.guild.members.cache.get(args[1]).user.username;
const loveEmbed = new EmbedBuilder()
.setColor("dd2e44")
.setFooter({ text: `Shipped by ${interaction.user.tag}` })
.setTimestamp()
.setTitle(`💘 | Shipping ${user1} and ${user2} | 💘`)
.setDescription(`🔻 | ${user1} \n${ship()}\n🔺 | ${user2}`);
interaction.followUp({ embeds: [loveEmbed] });
},
};
function ship() {
const hearts = Math.floor(Math.random() * 100);
const hearte = hearts / 10;
const str = `${heart.repeat(hearte)}${block.repeat(10 - hearte)} ${hearts}%`;
return str;
}

View file

@ -1,35 +0,0 @@
const URLClient = require("../../client/URLClient");
module.exports = {
name: "shorten-url",
description: "Shorten a URL",
options: [
{
type: 3,
name: "short-name",
description:
"The short name that for the shorten-url (For example, https://url.cath.gq/youtube)",
required: true,
},
{
type: 3,
name: "link",
description:
"The link for the shorten-url (For example, https://youtube.com)",
required: true,
},
],
run: async (client, interaction, args) => {
if (!args[1].includes("https://")) {
interaction.followUp({ content: "The link must contain 'https://'" });
} else {
const shortName = args[0];
const targetURL = args[1];
const cc = await URLClient.createShortURL(shortName, targetURL);
if (!cc) {
interaction.followUp({ content: `URL already exist` });
} else {
interaction.followUp({ content: `https://url.cath.gq/${cc}` });
}
}
},
};

View file

@ -1,125 +0,0 @@
const { EmbedBuilder } = require("discord.js");
const moment = require("moment");
module.exports = {
name: "snipe",
description: "Snipes a deleted message",
category: "Utilities",
options: [
{
type: 7,
name: "channel",
description: "The sniped channel",
required: true,
channelTypes: [0],
},
{
type: 4,
name: "message",
description: "The sniped message",
required: false,
},
],
run: async (client, interaction, args) => {
var i = 0;
let description = "";
const embed = new EmbedBuilder()
.setAuthor(
`Sniped by ${interaction.user.tag}`,
interaction.user.displayAvatarURL({ dynamic: true })
)
.setColor(client.color)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp()
.setURL(client.web);
const snipes = client.snipes.get(args[0]) || [];
if (interaction.guild.channels.cache.get(args[0]).type !== "GUILD_TEXT") {
interaction.followUp({ content: "Please provide a text channel" });
} else if (args[1]) {
const msg = snipes[args[1] - 1];
if (!msg) {
snipes.forEach(m => {
const map = [];
for (var i = 0; i < m.attachment?.length; i++) {
map.push(
`**Attchment ${i + 1}:** [Click to view](${m.attachment[i]})`
);
}
if (m.author !== "No Author") {
description += `\n\n**Author:** ${m.author.username}#${
m.author.discriminator
} (Deleted ${moment(m.date).fromNow()})\n**ID:** ${
m.author.id
}\n**Content:** ${m.content}\n${map ? map.join("\n") : ""}`;
i++;
} else {
description += `\n\n**Author:** None (Deleted ${moment(
m.date
).fromNow()})\n\n**Content:** ${m.content}\n${
map ? map.join("\n") : ""
}`;
i++;
}
});
embed.setDescription(description);
return interaction.followUp({ embeds: [embed] });
} else {
const map = [];
for (var i = 0; i < msg.attachment?.length; i++) {
map.push(
`**Attchment ${i + 1}:** [Click to view](${msg.attachment[i]})`
);
}
if (msg.author !== "No Author") {
description += `\n\n**Author:** ${msg.author.username}#${
msg.author.discriminator
} (Deleted ${moment(msg.date).fromNow()})\n**ID:** ${
msg.author.id
}\n**Content:** ${msg.content}\n${map ? map.join("\n") : ""}`;
i++;
} else {
description += `\n\n**Author:** None (Deleted ${moment(
msg.date
).fromNow()})\n\n**Content:** ${msg.content}\n${
map ? map.join("\n") : ""
}`;
i++;
}
embed.setDescription(description);
return interaction.followUp({ embeds: [embed] });
}
} else if (!snipes.length) {
interaction.followUp({
content: "There isn't any snipe in this channel yet",
});
} else {
snipes.forEach(m => {
const map = [];
for (var i = 0; i < m.attachment?.length; i++) {
map.push(
`**Attchment ${i + 1}:** [Click to view](${m.attachment[i]})`
);
}
if (m.author !== "No Author") {
description += `\n\n**Author:** ${m.author.username}#${
m.author.discriminator
} (Deleted ${moment(m.date).fromNow()})\n**ID:** ${
m.author.id
}\n**Content:** ${m.content}\n${map ? map.join("\n") : ""}`;
i++;
} else {
description += `\n\n**Author:** None (Deleted ${moment(
m.date
).fromNow()})\n\n**Content:** ${m.content}\n${
map ? map.join("\n") : ""
}`;
i++;
}
});
embed.setDescription(description);
return interaction.followUp({ embeds: [embed] });
}
},
};

View file

@ -1,227 +0,0 @@
const { EmbedBuilder } = require("discord.js");
const client = require("..");
/**
* @param {String} message
* @param {String} dir
* @param {String} file
* @param {String} err
*/
module.exports = async (message, dir, file, err) => {
switch (err) {
case 101:
err = "Invalid argument";
break;
case 0:
err = "Missing argument";
break;
case 1:
err = "Missing 'User' argument";
break;
case 2:
err = "'User' argument can't be author";
break;
case 3:
err = "Missing 'Role' argument";
break;
case 4:
err = "Missing 'Message' argument";
break;
case 5:
err = "Missing 'Number' argument";
break;
case 6:
err = "Missing permission";
break;
case 7:
err = "Invalid number";
break;
case 8:
err = "User doesn't have enough hierarchy";
break;
case 9:
err = "Bot doesn't have enough hierarchy";
break;
case 10:
err = "There isn't any data";
break;
case 11:
err = "Missing 'Emoji' argument";
break;
case 12:
err = "Missing 'Text' argument";
break;
case 13:
err = "'Text' argument must be less than or equal to 100";
break;
case 14:
err = "The maximum of modmail choices is 5";
break;
case 15:
err = "Emoji can't be found";
break;
case 16:
err = "'Time' argument must be larger than 1 second";
break;
case 17:
err = "Missing 'Command'/'Category' argument";
break;
case 18:
err = "'Command'/'Category' is already disabled";
break;
case 19:
err = "Missing 'Time' argument";
break;
case 20:
err = "Insufficient balance";
break;
case 21:
err = "Missing 'Item' argument";
break;
case 22:
err = "Invalid Item";
break;
case 23:
err = "You didn't have enough item to gift";
break;
case 24:
err = "Item invalid or you don't have that item";
break;
case 25:
err = "Inventory is empty";
break;
case 26:
err = "Giveaway not found";
break;
case 27:
err = "Missing 'Message ID' argument";
break;
case 28:
err = "Missing 'Channel' argument";
break;
case 29:
err = "'Time' argument is invalid";
break;
case 30:
err = "Missing 'Winners' argument";
break;
case 31:
err = "'Winner' argument must be a number";
break;
case 32:
err = "Missing 'Prize' argument";
break;
case 33:
err = "You cannot hug yourself";
break;
case 34:
err = "There isn't any song playing in the server currently";
break;
case 35:
err = "You must be in a voice channel";
break;
case 36:
err = "The player has stopped and the queue has been cleared";
break;
case 37:
err = "There is no queue";
break;
case 38:
err = "Can't find the playlist at YouTube";
break;
case 39:
err = "Can't join the voice channel";
break;
case 40:
err = "Left the voice channel since there is no song at the queue";
break;
case 41:
err = "I am not in a voice channel";
break;
case 42:
err = "I can't find this song/video";
break;
case 43:
err = "I can't find the song at SoundCloud";
break;
case 44:
err = "I can't find the song at YouTube";
break;
case 45:
err = "Invalid selection";
break;
case 46:
err = "Missing 'Prefix' argument";
break;
case 47:
err = "Missing 'Command' argument";
break;
case 48:
err = "The attachment must be an image";
break;
case 49:
err = "'Emoji' name must be more than 2 characters";
break;
case 50:
err =
"The error maybe the link isn't a image, or the image size is too big";
break;
case 51:
err = "Missing 'Query' argument";
break;
case 52:
err = "This message doesn't exist in this channel";
break;
case 53:
err = "Missing 'Code' argument";
break;
case 54:
err = "'Text' argument must be less than or equal to 2000";
break;
case 55:
err = "Different channel between user and client";
break;
case 404:
err = "Error 404 - Not Found";
break;
case 505:
err = "You have reached the maximum number of premium servers";
break;
case 506:
err = "This server is already premium";
break;
case 999:
err = "An unexpected error occured. Please try again.";
break;
default:
"Missing argument";
break;
}
const pull = require(`../../commands/${dir}/${file}`);
const pre = await client.prefix(message);
const embed = new EmbedBuilder()
.setAuthor(
`Error from ${message.author.tag}`,
message.author.displayAvatarURL({ dynamic: true })
)
.setColor("RED")
.setDescription(
`${require("../config").ca}\nUse \`${pre}help ${
pull.name
}\` to get help\n\n `
)
.addField(
`**>Usage**: ${pre}${pull.name} ${pull.usage ? pull.usage : ""}`,
`\`${err}\``
)
.setTimestamp()
.setThumbnail(client.user.displayAvatarURL({ dynamic: false }))
.setURL(client.web)
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
});
const msg = await message.reply({ embeds: [embed] });
setTimeout(function () {
msg.delete();
}, 15000);
};

View file

@ -1,25 +0,0 @@
const client = require("../..");
client.on("messageCreate", async message => {
if (message.author.bot || !message.guild) return;
const dataa = await client.data.getUser(message.author.id);
if (dataa?.AFK) {
message.reply({
content: `Welcome back <@${dataa.User}>! I have removed your AFK status.`,
});
const nothahaa = message.guild.members.cache.get(message.author.id);
nothahaa.setNickname(`${message.author.username}`).catch();
await client.data.DelAFK(message.author.id);
}
if (message.mentions.users.first()?.id) {
const data1 = await client.data.getUser(
message.mentions.members.first()?.id
);
if (data1?.AFK) {
message.reply({
content: `**${
message.mentions.members.first().user.tag
}** is in afk **(${data1.AFK})**`,
});
}
}
});

View file

@ -1,26 +0,0 @@
const client = require("../");
client.on("messageDelete", async message => {
const all = [];
if (message.attachments) {
const files = message.attachments.map(e => e);
for (let i = 0; i < files.length; i++) {
all.push(files[i].url);
}
}
if (message.embeds) {
for (let i = 0; i < message.embeds.length; i++) {
const files = message.embeds.map(e => e.image?.url);
all.push(files);
}
}
const snipes = client.snipes.get(message.channel.id) || [];
snipes.push({
channel: message.channel,
content: message.content ? message.content : "None",
author: message.author ? message.author : "No Author",
attachment: message.attachments ? all : null,
date: new Date(),
});
snipes.splice(10);
client.snipes.set(message.channel.id, snipes);
});

View file

@ -1,28 +0,0 @@
const client = require("..");
client.on("messageUpdate", async (message, newMessage) => {
const all = [];
if (message.attachments) {
const files = message.attachments.map(e => e);
for (var i = 0; i < files.length; i++) {
const file = files[i];
all.push(file.url);
}
}
if (message.embeds) {
for (var i = 0; i < message.embeds.length; i++) {
const files = message.embeds.map(e => e.image?.url);
all.push(files);
}
}
const esnipes = client.esnipes.get(message.channel.id) || [];
esnipes.push({
channel: message.channel,
oldContent: message.content ? message.content : "None",
newContent: newMessage.content ? newMessage.content : "None",
author: message.author ? message.author : "No Author",
attachment: message.attachments ? all : null,
date: new Date(),
});
esnipes.splice(10);
client.esnipes.set(message.channel.id, esnipes);
});

View file

@ -1,2 +0,0 @@
const client = require("../..");
client.on("raw", c => client.manager.updateVoiceState(c));

View file

@ -1,8 +0,0 @@
const client = require("../..");
const starboardclient = require("../client/StarboardClient");
client.on("messageReactionAdd", async reaction => {
starboardclient.listener(reaction);
});
client.on("messageReactionRemove", async reaction => {
starboardclient.listener(reaction);
});

View file

@ -1,63 +0,0 @@
const { EmbedBuilder } = require("discord.js");
const client = require("../..");
client.on("voiceStateUpdate", async (oldState, newState) => {
const guildId = newState.guild.id;
const player = client.manager.get(guildId);
if (!player || player.state !== "CONNECTED") return;
const stateChange = {};
if (oldState.channel === null && newState.channel !== null) {
stateChange.type = "JOIN";
}
if (oldState.channel !== null && newState.channel === null) {
stateChange.type = "LEAVE";
}
if (oldState.channel !== null && newState.channel !== null) {
stateChange.type = "MOVE";
}
if (oldState.channel === null && newState.channel === null) return;
if (newState.serverMute == true && oldState.serverMute == false) {
return player.pause(true);
}
if (newState.serverMute == false && oldState.serverMute == true) {
return player.pause(false);
}
if (stateChange.type === "MOVE") {
if (oldState.channel.id === player.voiceChannel) stateChange.type = "LEAVE";
if (newState.channel.id === player.voiceChannel) stateChange.type = "JOIN";
}
if (stateChange.type === "JOIN") stateChange.channel = newState.channel;
if (stateChange.type === "LEAVE") stateChange.channel = oldState.channel;
if (!stateChange.channel || stateChange.channel.id !== player.voiceChannel) {
return;
}
stateChange.members = stateChange.channel.members.filter(
member => !member.user.bot
);
switch (stateChange.type) {
case "JOIN":
if (stateChange.members.size === 1 && player.paused) {
const emb = new EmbedBuilder()
.setAuthor(`Resumed`, client.user.displayAvatarURL())
.setColor(client.config.color)
.setDescription(
`Resuming the player as somebody join the voice channel`
);
client.channels.cache.get(player.textChannel).send({ embeds: [emb] });
player.pause(false);
}
break;
case "LEAVE":
if (stateChange.members.size === 0 && !player.paused && player.playing) {
player.pause(true);
const emb = new EmbedBuilder()
.setAuthor(`Paused`, client.user.displayAvatarURL())
.setColor(client.config.color)
.setDescription(
`The player has been paused as nobody is in the voice channel`
);
client.channels.cache.get(player.textChannel).send({ embeds: [emb] });
}
break;
}
});

View file

@ -1,11 +0,0 @@
const mongoose = require("mongoose");
module.exports = mongoose.model(
"custom-commands",
new mongoose.Schema({
Guild: String,
Command: String,
Response: Array,
Delete: Boolean,
Random: Boolean,
}),
);

View file

@ -1,11 +0,0 @@
const mongoose = require("mongoose");
module.exports = mongoose.model(
"modmail",
new mongoose.Schema({
Guild: String,
Category: String,
Choices: Object,
Role: String,
}),
);