nyx

The first CODM discrod bot -- cath.exe Template
git clone https://codeberg.org/night0721/nyx
Log | Files | Refs | LICENSE

commit ca5813d12cd739e9836426829d8da3943287ac1d
parent 182c2a21d61f038002fc71c64dbce71998be543a
Author: night0721 <[email protected]>
Date:   Wed,  2 Mar 2022 22:37:01 +0800

use less files and fix footer

Diffstat:
Mcommand/Fun/ship.js | 2+-
Mcommand/Fun/simprate.js | 5++++-
Mcommand/Fun/truth.js | 2+-
Mcommand/Fun/wyr.js | 14++++++++------
Mcommand/Information/avatar.js | 13++++++++-----
Mcommand/Information/botinfo.js | 33+++++++++------------------------
Mcommand/Information/help.js | 34+++++++++++++++++-----------------
Dutil/Data/giveaways.json | 1-
Mutil/dist/handler.js | 7++-----
9 files changed, 50 insertions(+), 61 deletions(-)

diff --git a/command/Fun/ship.js b/command/Fun/ship.js @@ -27,7 +27,7 @@ module.exports = { const user2 = interaction.guild.members.cache.get(args[1]).user.username; const loveEmbed = new MessageEmbed() .setColor("dd2e44") - .setFooter(`Shipped by ${interaction.user.tag}`) + .setFooter({ text: `Shipped by ${interaction.user.tag}` }) .setTimestamp() .setTitle(`πŸ’˜ | Shipping ${user1} and ${user2} | πŸ’˜`) .setDescription(`πŸ”» | ${user1} \n${ship()}\nπŸ”Ί | ${user2}`); diff --git a/command/Fun/simprate.js b/command/Fun/simprate.js @@ -22,7 +22,10 @@ module.exports = { .setTitle(`${user.user.username}'s simp rate`) .setDescription(`${user.user.username} is a ${simp}% simp`) .setColor(client.color) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp(), ], }); diff --git a/command/Fun/truth.js b/command/Fun/truth.js @@ -9,7 +9,7 @@ module.exports = { name: interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ dyamic: true }), }) - .setTitle(tnd.truth[Math.round(Math.random() * tnd.truth.length)]) + .setTitle(tnd.truth[Math.round(Math.random() * tnd.truth.length - 1)]) .setColor(client.color) .setFooter({ text: `Made by ${client.author}`, diff --git a/command/Fun/wyr.js b/command/Fun/wyr.js @@ -1,6 +1,5 @@ const { MessageEmbed } = require("discord.js"); const questions = require("../../util/Data/wyr.json"); - module.exports = { name: "wyr", description: "Send some would-you rather questions", @@ -15,12 +14,15 @@ module.exports = { .setDescription( `πŸ‡¦ ${Option1} \n\n **OR** \n\n :regional_indicator_b: ${Option2}` ) - .setAuthor( - interaction.user.tag, - interaction.user.displayAvatarURL({ dynamic: true }) - ) + .setAuthor({ + name: interaction.user.tag, + iconURL: interaction.user.displayAvatarURL({ dyamic: true }), + }) .setColor(client.color) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp(); wyrmessage = await interaction.followUp({ embeds: [embed] }); wyrmessage.react("πŸ‡¦"); diff --git a/command/Information/avatar.js b/command/Information/avatar.js @@ -17,10 +17,10 @@ module.exports = { const member = interaction.guild.members.cache.get(args[0]) || interaction.member; const embed = new MessageEmbed() - .setAuthor( - member.user.tag, - member.user.displayAvatarURL({ dynamic: true, size: 1024 }) - ) + .setAuthor({ + text: member.user.tag, + iconURL: member.user.displayAvatarURL({ dynamic: true, size: 1024 }), + }) .setColor(client.color) .setTitle(`${member.user.username}'s Avatar`) .setDescription( @@ -41,7 +41,10 @@ module.exports = { .setImage( member.user.avatarURL({ size: 2048, dynamic: true, format: "png" }) ) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setURL(client.web) .setTimestamp(); interaction.followUp({ embeds: [embed] }); diff --git a/command/Information/botinfo.js b/command/Information/botinfo.js @@ -1,14 +1,12 @@ const { MessageEmbed, version: djsversion } = require("discord.js"); const version = require("../../../package.json").version; const { utc } = require("moment"); -// const os = require("os"); module.exports = { name: "botinfo", description: "Check the info of the bot", category: "Information", type: "CHAT_INPUT", - run: async (client, interaction, args, utils) => { - // const core = os.cpus()[0]; + run: async (client, interaction) => { const embed = new MessageEmbed() .setTitle(`NYX - CODM Gunsmith Bot`) .setURL( @@ -43,36 +41,23 @@ module.exports = { inline: true, } ) - .addFields( - { - name: `Platform`, - value: ` + .addFields({ + name: `Platform`, + value: ` NYX ❯ \`v${version}\` Discord.js ❯ \`v${djsversion}\` Node.js ❯ \`${process.version}\``, - } - // Removed OS Info for troubleshooting. - // - // { - // name: `Hardware`, - // value: ` - // Uptime:** ${utils.timer(os.uptime() * 1000, { long: true })} - // Platform:** ${process.platform} - // CPU:** - // \u3000 Cores: ${os.cpus().length} - // \u3000 Model: ${core.model} - // \u3000 Speed: ${core.speed}MHz - // **`, - // inline: true, - // } - ) + }) .addFields({ name: `**${client.author}**`, value: `**Development Management**\n\u3000Εƒ1ght#0001\n\u3000Cat drinking a cat#0795\n\u3000mightyful#6536\n\u3000Thunder#2128\n\u3000mobo#9277\n **Research & Documentation**\n\u3000𝔔𝓻𝔦ค𝔁𝔖ค𝔦ӄø#0690\n\u3000Thunder#2128\n **Website**\n\u3000Chunchunmaru#8570`, }) - .setFooter(`Made by ${client.author}`, client.user.displayAvatarURL()) + .setFooter({ + text: `Made by ${client.author}`, + iconURL: client.user.displayAvatarURL(), + }) .setTimestamp(); interaction.followUp({ embeds: [embed] }); }, diff --git a/command/Information/help.js b/command/Information/help.js @@ -122,7 +122,9 @@ module.exports = { ) .setTimestamp() .setColor(client.color) - .setFooter(`Please use /help (Command Name) for more details`) + .setFooter({ + text: `Please use /help (Command Name) for more details`, + }) .setDescription( category.commands .map(cmd => { @@ -168,28 +170,26 @@ module.exports = { "**Command**:", command.name ? `\`${command.name}\`` : "N/A" ); - if (command.usage) { + if (command.usage) embed.addField("**Usage**:", `\`/${command.name} ${command.usage}\``); - } else { - embed.addField("**Usage**:", `\`/${command.name}\``); - } - if (command.description) { + else embed.addField("**Usage**:", `\`/${command.name}\``); + + if (command.description) embed.addField("**Description**:", command.description); - } - if (command.timeout) { + + if (command.timeout) embed.addField("**Cooldown**:", utils.timer(command.timeout)); - } - if (command.UserPerms) { + + if (command.UserPerms) embed.addField("**Required User Permission**:", UserPerms); - } - if (command.BotPerms) { + + if (command.BotPerms) embed.addField("**Required Bot Permission**:", BotPerms); - } embed - .setFooter( - `Requested by ${interaction.user.tag}`, - interaction.user.displayAvatarURL({ dynamic: true }) - ) + .setFooter({ + text: `Requested by ${interaction.user.tag}`, + iconURL: interaction.user.displayAvatarURL({ dynamic: true }), + }) .setTimestamp() .setURL(client.web) .setColor(client.color); diff --git a/util/Data/giveaways.json b/util/Data/giveaways.json @@ -1 +0,0 @@ -[] diff --git a/util/dist/handler.js b/util/dist/handler.js @@ -1,7 +1,5 @@ -const { DiscordAPIError, HTTPError } = require("discord.js"); const fs = require("fs"); -const cmds = []; -const ownercmds = []; +const cmds = []ownercmds = []; module.exports = async client => { fs.readdirSync("./events").forEach(file => { require(`${process.cwd()}/events/${file}`); @@ -29,8 +27,7 @@ module.exports = async client => { ownercmds.push(file); }); client.on("ready", async () => { - const gg = client.guilds.cache.get("840225563193114624"); - await gg.commands.set(ownercmds); + await client.guilds.cache.get("840225563193114624").commands.set(ownercmds); await client.application.commands .set(cmds) .then(async cmd => {