nyx

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

commit b946d5f41139430a12894a197fa659a956f9de0c
parent 49e5bee0d4466684b45add71b28dbf9137f31323
Author: night0721 <[email protected]>
Date:   Sun, 13 Jun 2021 12:09:00 +0800

bug fixes

Diffstat:
Mcommands/Owner/accept.js | 7++++---
Mcommands/Owner/deny.js | 7++++---
Mcommands/Utilities/report.js | 7+++----
Acommands/Utilities/suggest.js | 82+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mconfig.json | 4++--
Mindex.js | 4+++-
6 files changed, 98 insertions(+), 13 deletions(-)

diff --git a/commands/Owner/accept.js b/commands/Owner/accept.js @@ -1,5 +1,4 @@ const { Client, Message, MessageEmbed } = require("discord.js"); -const { Suggestion } = require("../../config.json"); module.exports = { name: "accept", category: "Owner", @@ -14,11 +13,13 @@ module.exports = { run: async (client, message, args) => { const MessageID = args[0]; const acceptQuery = - args.slice(1).join(" ") || `Night doesn't leave any message.`; + args.slice(1).join(" ") || `They didn't leave any message.`; if (!MessageID) return message.reply("Please specify a valid ID"); try { - const suggestionChannel = message.guild.channels.cache.get(Suggestion); + const suggestionChannel = message.guild.channels.cache.get( + client.SuggestionLog + ); const suggestEmbed = await suggestionChannel.messages.fetch(MessageID); console.log(suggestEmbed); const data = suggestEmbed.embeds[0]; diff --git a/commands/Owner/deny.js b/commands/Owner/deny.js @@ -1,5 +1,4 @@ const { Client, Message, MessageEmbed } = require("discord.js"); -const { Suggestion } = require("../../config.json"); module.exports = { name: "deny", category: "Owner", @@ -14,11 +13,13 @@ module.exports = { run: async (client, message, args) => { const MessageID = args[0]; const denyQuery = - args.slice(1).join(" ") || `Night doesn't leave any message.`; + args.slice(1).join(" ") || `They didn't leave any message.`; if (!MessageID) return message.reply("Please specify a valid ID"); try { - const suggestionChannel = message.guild.channels.cache.get(Suggestion); + const suggestionChannel = message.guild.channels.cache.get( + client.SuggestionLog + ); const suggestEmbed = await suggestionChannel.messages.fetch(MessageID); console.log(suggestEmbed); const data = suggestEmbed.embeds[0]; diff --git a/commands/Utilities/report.js b/commands/Utilities/report.js @@ -49,7 +49,7 @@ module.exports = { new MessageEmbed() .setTitle("SUCCESS!") .setDescription( - "You have reported the bug.\nPlease wait for Night to solve it" + "You have reported a bug.\nPlease wait for us to solve it" ) .setColor("GREEN") ); @@ -57,7 +57,7 @@ module.exports = { } }); - const appsChannel = client.channels.cache.get("808200253261611018"); + const appsChannel = client.channels.cache.get(client.ReportLog); collector.on("end", (collected, reason) => { if (reason === "fulfilled") { let index = 1; @@ -73,8 +73,7 @@ module.exports = { message.author.tag, message.author.displayAvatarURL({ dynamic: true }) ) - .setTitle("New Apllication") - + .setTitle("New Bug") .setDescription(mapedResponses) .setColor("ORANGE") .setTimestamp() diff --git a/commands/Utilities/suggest.js b/commands/Utilities/suggest.js @@ -0,0 +1,82 @@ +const { Client, Message, MessageEmbed } = require("discord.js"); +module.exports = { + name: "suggest", + description: "Make a suggestion of the bot", + category: "Utilities", + /** + * @param {Client} client + * @param {Message} message + * @param {String[]} args + */ + run: async (client, message, args) => { + const questions = [ + "Describe the suggestion", + //"question 2" + ]; + + let collectCounter = 0; + let endCounter = 0; + + const filter = m => m.author.id === message.author.id; + message.inlineReply("Check your dm."); + const appStart = await message.author.send( + new MessageEmbed() + .setAuthor(message.author.username, message.author.displayAvatarURL()) + .setDescription(questions[collectCounter++]) + .setFooter(client.user.username) + .setTimestamp() + ); + const channel = appStart.channel; + + const collector = channel.createMessageCollector(filter); + + collector.on("collect", () => { + if (collectCounter < questions.length) { + channel.send( + new MessageEmbed() + .setAuthor( + message.author.username, + message.author.displayAvatarURL() + ) + .setDescription(questions[collectCounter++]) + .setFooter(client.user.username) + .setTimestamp() + ); + } else { + channel.send( + new MessageEmbed() + .setTitle("SUCCESS!") + .setDescription( + "You have sent a suggestion.\nPlease wait for us to review it" + ) + .setColor("GREEN") + ); + collector.stop("fulfilled"); + } + }); + + const appsChannel = client.channels.cache.get(client.ReportLog); + collector.on("end", (collected, reason) => { + if (reason === "fulfilled") { + let index = 1; + const mapedResponses = collected + .map(msg => { + return `${questions[endCounter++]}**\n->** ${msg.content}`; + }) + .join("\n\n"); + + appsChannel.send( + new MessageEmbed() + .setAuthor( + message.author.tag, + message.author.displayAvatarURL({ dynamic: true }) + ) + .setTitle("New Suggestion") + .setDescription(mapedResponses) + .setColor("ORANGE") + .setTimestamp() + ); + } + }); + }, +}; diff --git a/config.json b/config.json @@ -6,7 +6,7 @@ "soundcloud": "dmDh7QSlmGpzH9qQoH1YExYCGcyYeYYC", "ca": "**[Invite](https://discord.com/api/oauth2/authorize?client_id=800966959268364288&permissions=4231314550&scope=bot%20applications.commands) | [Support](https://discord.gg/SbQHChmGcp) | [YouTube](https://youtube.com/Kirito01) | [Website](https://www.cath.gq)**", "cat": "**[Invite](https://discord.com/api/oauth2/authorize?client_id=800966959268364288&permissions=4231314550&scope=bot%20applications.commands) | [Support](https://discord.gg/SbQHChmGcp) | [YouTube](https://youtube.com/Kirito01) | [Website](https://www.cath.gq)**\n\n", - "Suggestion": "837870173376741387", - "Report": "837870173376741387", + "Suggestion": "853319776034226186", + "Report": "853319776034226186", "Welcome": "837913442228371456" } diff --git a/index.js b/index.js @@ -51,6 +51,7 @@ process.on("unhandledRejection", async err => { return console.log(err); }); client.SuggestionLog = config.Suggestion; +client.ReportLog = config.Report; client.commands = new Collection(); client.aliases = new Collection(); client.events = new Collection(); @@ -72,6 +73,7 @@ client.owners = [ "749692825402212494", "766645910087139338", "755476040029306952", + "534027706325532694", ]; client.currency = "<:cp:836630372661329990>"; client.path = [ @@ -81,7 +83,7 @@ client.path = [ "718762019586572341", "784052348561522730", "840225563193114624", - "800396461229080619" + "800396461229080619", ]; client.xp = [ "749135655350697986",