commit cbc93bc54a94d64a363c237df9545349dfab3dee
parent 4b9da66b12d242a15f56463f7c539d79d590f9fd
Author: night0721 <[email protected]>
Date: Thu, 3 Feb 2022 06:46:57 +0800
fix
Diffstat:
5 files changed, 73 insertions(+), 81 deletions(-)
diff --git a/command/CODM/build.js b/command/CODM/build.js
@@ -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",
diff --git a/command/CODM/scorestreak.js b/command/CODM/scorestreak.js
@@ -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: [
diff --git a/config.js b/config.js
@@ -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",
diff --git a/events/interactionCreate.js b/events/interactionCreate.js
@@ -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] });
+}
diff --git a/index.js b/index.js
@@ -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();