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

View file

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

View file

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

View file

@ -115,68 +115,59 @@ client.on("interactionCreate", async interaction => {
} }
} }
const random = utils.rndint(3, 6); const random = utils.rndint(3, 6);
try { if (cmd.timeout) {
if (cmd.timeout) { const current_time = Date.now();
const current_time = Date.now(); const cooldown_amount = cmd.timeout;
const cooldown_amount = cmd.timeout; cooldown.findOne(
cooldown.findOne( { User: interaction.user.id, CMD: cmd.name },
{ User: interaction.user.id, CMD: cmd.name }, async (er, d) => {
async (er, d) => { if (d) {
if (d) { const expiration_time = d.Time + cooldown_amount;
const expiration_time = d.Time + cooldown_amount; if (current_time < expiration_time) {
if (current_time < expiration_time) { if (data.Guild.Tips) utils.tips(interaction, client);
if (data.Guild.Tips) utils.tips(interaction, client); utils.cooldown(d.Time, cooldown_amount, interaction);
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);
}
} else { } else {
if (data.Guild.Tips) utils.tips(interaction, client); 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({ 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})\``, 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); // 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); } else {
cmd.run(client, interaction, args, utils, data); if (data.Guild.Tips) utils.tips(interaction, client);
client.channels.cache.get(client.config.CMDLog).send({ cmd.run(client, interaction, args, utils, data).catch(e => sendE(e));
content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${cmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.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); 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);
} }
} }
if (interaction.isContextMenu()) { if (interaction.isContextMenu()) {
@ -204,14 +195,19 @@ client.on("interactionCreate", async interaction => {
interaction.member = interaction.guild.members.cache.get( interaction.member = interaction.guild.members.cache.get(
interaction.user.id interaction.user.id
); );
try { ownercmd.run(client, interaction, args, utils).catch(e => sendE(e));
ownercmd.run(client, interaction, args, utils); client.channels.cache.get(client.config.CMDLog).send({
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})\``,
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);
client.addcmdsused(interaction.user.id);
} catch (e) {
console.log(e);
}
} }
}); });
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 NYX = require("./client/NYX");
const client = new NYX(); const client = new NYX();
module.exports = client; module.exports = client;
process.on("unhandledRejection", err => { process.on("unhandledRejection", () => {});
console.error(err);
});
client.start(); client.start();