This commit is contained in:
night0721 2022-02-03 06:46:57 +08:00
parent 4b9da66b12
commit cbc93bc54a
5 changed files with 73 additions and 81 deletions

View file

@ -6,7 +6,6 @@ module.exports = {
description: "Get gunsmith builds",
usage: "[Weapon Name] [Author] [Tag]",
type: "CHAT_INPUT",
usage: "[Weapon Name] [Author] [Tag]",
category: "CODM",
options: [
{
@ -108,7 +107,7 @@ module.exports = {
},
{
type: 3,
name: "Author",
name: "author",
description: "Select a Content Creator",
required: true,
choices: [
@ -164,7 +163,7 @@ module.exports = {
required: true,
choices: [
{
name: "RUS-79u",
name: "RUS-79U",
value: "D01",
},
{
@ -235,7 +234,7 @@ module.exports = {
},
{
type: 3,
name: "Author",
name: "author",
description: "Select a Content Creator",
required: true,
choices: [
@ -326,7 +325,7 @@ module.exports = {
},
{
type: 3,
name: "Author",
name: "author",
description: "Select a Content Creator",
required: true,
choices: [
@ -409,7 +408,7 @@ module.exports = {
},
{
type: 3,
name: "Author",
name: "author",
description: "Select a Content Creator",
required: true,
choices: [
@ -488,7 +487,7 @@ module.exports = {
},
{
type: 3,
name: "Author",
name: "author",
description: "Select a Content Creator",
required: true,
choices: [
@ -551,7 +550,7 @@ module.exports = {
},
{
type: 3,
name: "Author",
name: "author",
description: "Select a Content Creator",
required: true,
choices: [
@ -626,7 +625,7 @@ module.exports = {
},
{
type: 3,
name: "Author",
name: "author",
description: "Select a Content Creator",
required: true,
choices: [
@ -676,8 +675,8 @@ module.exports = {
jokesta: "Jokesta",
// littleb:"Little B",
aggressive: "aggressive",
passive: "passive",
aggressive: "Aggressive",
passive: "Passive",
"Search And Destroy": "Search And Destroy",
respawn: "respawn",
ads: "ADS",

View file

@ -8,7 +8,7 @@ module.exports = {
category: "CODM",
options: [
{
type: "SUB_COMMAND",
type: 1,
name: "lethal",
description: "Lethal Scorestreak",
options: [
@ -83,7 +83,7 @@ module.exports = {
],
},
{
type: "SUB_COMMAND",
type: 1,
name: "support",
description: "Support Scorestreak",
options: [

View file

@ -7,7 +7,7 @@ module.exports = {
Welcome: "837913442228371456",
DMLog: "900549765534736394",
CMDLog: "848613827226239046",
ErrorLog: "900509758786773022",
ErrorLog: "938538311537012796",
ServerLog: "848613714537873518",
Lavalink: {
Host: "lavalink-repl.thunderemperor.repl.co",

View file

@ -115,68 +115,59 @@ client.on("interactionCreate", async interaction => {
}
}
const random = utils.rndint(3, 6);
try {
if (cmd.timeout) {
const current_time = Date.now();
const cooldown_amount = cmd.timeout;
cooldown.findOne(
{ User: interaction.user.id, CMD: cmd.name },
async (er, d) => {
if (d) {
const expiration_time = d.Time + cooldown_amount;
if (current_time < expiration_time) {
if (data.Guild.Tips) utils.tips(interaction, client);
utils.cooldown(d.Time, cooldown_amount, interaction);
} else {
if (data.Guild.Tips) utils.tips(interaction, client);
await cooldown.findOneAndUpdate(
{ User: interaction.user.id, CMD: cmd.name },
{ Time: current_time }
);
cmd.run(client, interaction, args, utils, data);
client.addcmdsused(interaction.user.id);
client.channels.cache.get(client.config.CMDLog).send({
content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${cmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``,
});
// await client.addXP(interaction.user.id, random, interaction);
}
if (cmd.timeout) {
const current_time = Date.now();
const cooldown_amount = cmd.timeout;
cooldown.findOne(
{ User: interaction.user.id, CMD: cmd.name },
async (er, d) => {
if (d) {
const expiration_time = d.Time + cooldown_amount;
if (current_time < expiration_time) {
if (data.Guild.Tips) utils.tips(interaction, client);
utils.cooldown(d.Time, cooldown_amount, interaction);
} else {
if (data.Guild.Tips) utils.tips(interaction, client);
cmd.run(client, interaction, args, utils, data);
await cooldown.findOneAndUpdate(
{ User: interaction.user.id, CMD: cmd.name },
{ Time: current_time }
);
cmd
.run(client, interaction, args, utils, data)
.catch(e => sendE(e));
client.addcmdsused(interaction.user.id);
client.channels.cache.get(client.config.CMDLog).send({
content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${cmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``,
});
client.addcmdsused(interaction.user.id);
// await client.addXP(interaction.user.id, random, interaction);
new cooldown({
User: interaction.user.id,
CMD: cmd.name,
Time: current_time,
Cooldown: cmd.timeout,
}).save();
}
} else {
if (data.Guild.Tips) utils.tips(interaction, client);
cmd
.run(client, interaction, args, utils, data)
.catch(e => sendE(e));
client.channels.cache.get(client.config.CMDLog).send({
content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${cmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``,
});
client.addcmdsused(interaction.user.id);
// await client.addXP(interaction.user.id, random, interaction);
new cooldown({
User: interaction.user.id,
CMD: cmd.name,
Time: current_time,
Cooldown: cmd.timeout,
}).save();
}
);
} else {
if (data.Guild.Tips) utils.tips(interaction, client);
cmd.run(client, interaction, args, utils, data);
client.channels.cache.get(client.config.CMDLog).send({
content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${cmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``,
});
client.addcmdsused(interaction.user.id);
// await client.addXP(interaction.user.id, random, interaction);
}
} catch (e) {
const embed = new MessageEmbed()
.setTitle("Command Error")
.setDescription(`\`\`\`ini\n${e.stack}\`\`\``)
.setTimestamp()
.setColor(client.color)
.setFooter(client.user.username);
client.channels.cache
.get(client.config.ErrorLog)
.send({ embeds: [embed] });
console.error(e);
}
);
} else {
if (data.Guild.Tips) utils.tips(interaction, client);
cmd.run(client, interaction, args, utils, data).catch(e => sendE(e));
client.channels.cache.get(client.config.CMDLog).send({
content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${cmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``,
});
client.addcmdsused(interaction.user.id);
// await client.addXP(interaction.user.id, random, interaction);
}
}
if (interaction.isContextMenu()) {
@ -204,14 +195,19 @@ client.on("interactionCreate", async interaction => {
interaction.member = interaction.guild.members.cache.get(
interaction.user.id
);
try {
ownercmd.run(client, interaction, args, utils);
client.channels.cache.get(client.config.CMDLog).send({
content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${ownercmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``,
});
client.addcmdsused(interaction.user.id);
} catch (e) {
console.log(e);
}
ownercmd.run(client, interaction, args, utils).catch(e => sendE(e));
client.channels.cache.get(client.config.CMDLog).send({
content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${ownercmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``,
});
client.addcmdsused(interaction.user.id);
}
});
function sendE(e) {
const embed = new MessageEmbed()
.setTitle("Command Error")
.setDescription(`\`\`\`yaml\n${e.stack}\`\`\``)
.setTimestamp()
.setColor(client.color)
.setFooter({ text: client.user.username });
client.channels.cache.get(client.config.ErrorLog).send({ embeds: [embed] });
}

View file

@ -1,8 +1,5 @@
const { HTTPError, DiscordAPIError } = require("discord.js");
const NYX = require("./client/NYX");
const client = new NYX();
module.exports = client;
process.on("unhandledRejection", err => {
console.error(err);
});
process.on("unhandledRejection", () => {});
client.start();