From 51c1724784004dfce6b01a27c6b0068ef89f6831 Mon Sep 17 00:00:00 2001 From: M_Viper Date: Wed, 7 Feb 2024 14:48:48 +0000 Subject: [PATCH] Dateien nach "commands/suggestion" hochladen --- commands/suggestion/lol | 1 + commands/suggestion/reply.js | 87 +++++++++++++++++++++++++++++++ commands/suggestion/setsuggest.js | 29 +++++++++++ commands/suggestion/suggest.js | 36 +++++++++++++ 4 files changed, 153 insertions(+) create mode 100644 commands/suggestion/lol create mode 100644 commands/suggestion/reply.js create mode 100644 commands/suggestion/setsuggest.js create mode 100644 commands/suggestion/suggest.js diff --git a/commands/suggestion/lol b/commands/suggestion/lol new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/commands/suggestion/lol @@ -0,0 +1 @@ + diff --git a/commands/suggestion/reply.js b/commands/suggestion/reply.js new file mode 100644 index 0000000..eb3aff4 --- /dev/null +++ b/commands/suggestion/reply.js @@ -0,0 +1,87 @@ +const Discord = require("discord.js"); +const { MessageEmbed } = require("discord.js"); +const db = require("quick.db"); + +module.exports = { + name: "sreply", + category: "suggestion", + run: async (client, message, args) => { + +let channel = await db.fetch(`suggestion_${message.guild.id}`); +if (channel === null) return; + + if(!message.member.hasPermission('MANAGE_GUILD')) return; + + const rgx = /^(?:<@!?)?(\d+)>?$/; + + const messageID = args[0]; + const replyQuery = args.slice(1).join(' '); + + const number = new MessageEmbed() + .setDescription(`<:bfdno:832931445991276584> | Ich glaube nicht, dass das eine Nachrichten-ID war!`) + .setColor("FF2052") + + const id = new MessageEmbed() + .setDescription(`<:bfdno:832931445991276584> |Sie haben vergessen, die Nachrichten-ID anzugeben!`) + .setColor("FF2052") + + const query = new MessageEmbed() + .setDescription(`<:bfdno:832931445991276584> | Sie haben vergessen, die Antwort anzugeben!`) + .setColor("FF2052") + + const reply = new MessageEmbed() + .setDescription(`<:bfdyes:832931453892558848> | Vorschlag erfolgreich beantwortet.`) + .setColor("00FFFF") + + const noChannel = new MessageEmbed() + .setDescription(`<:bfdno:832931445991276584> | Kein Vorschlagskanal gefunden!`) + .setColor("FF2052") + + const noMessage = new MessageEmbed() + .setDescription(`<:bfdno:832931445991276584> | Keine Nachricht mit dieser ID gefunden!`) + .setColor("FF2052") + + if(!messageID) return message.channel.send(id); + + if (!rgx.test(messageID)) return message.channel.send(number); + + if(!replyQuery) return message.channel.send(query) + + try{ + const suggestionChannel = message.guild.channels.cache.get(channel) + + if(!suggestionChannel) return message.channel.send(noChannel) + + const suggestedEmbed = await suggestionChannel.messages.fetch(messageID).catch(error => { + const noMessage = new MessageEmbed() + .setDescription(`<:bfdno:832931445991276584> | Keine Nachricht mit dieser ID gefunden!`) + .setColor("FF2052") + return message.channel.send(noMessage); + }) + + const data = suggestedEmbed.embeds[0]; + + const replyEmbed = new MessageEmbed() + .setAuthor(`${data.author.name}`, data.author.iconURL) + .setDescription(data.description) + .setColor("BLUE") + .addField(`Reply from ${message.author.tag}`, replyQuery) + .setFooter("Status: Replied") + .setTimestamp(); + + suggestedEmbed.edit(replyEmbed) + + message.channel.send(reply) + + const user = await client.users.cache.find((u) => u.tag === data.author.name) + + const embed = new MessageEmbed() + .setDescription(`Sie haben eine Antwort auf Ihren Vorschlag erhalten <:bfdyes:832931453892558848> . **[Message Link](https://discord.com/channels/${message.guild.id}/${channel}/${messageID})**`) + .setColor("BLUE") + user.send(embed) + + } catch(err) { + return; + } + } +} \ No newline at end of file diff --git a/commands/suggestion/setsuggest.js b/commands/suggestion/setsuggest.js new file mode 100644 index 0000000..9fa951b --- /dev/null +++ b/commands/suggestion/setsuggest.js @@ -0,0 +1,29 @@ +const Discord = require("discord.js"); +const { MessageEmbed } = require("discord.js"); +const db = require("quick.db"); + +module.exports = { + name: "setsuggest", + category: "suggestion", + usage: "setsuggest <#channel>", + authorPermission: ["MANAGE_GUILD"], + run: async (client, message, args) => { +if (!message.member.hasPermission("MANAGE_GUILD")) { + return message.channel.send(`Sie haben keine Berechtigung, diesen Befehl zu verwenden! Server verwalten`) + } + let Channel = message.mentions.channels.first() || message.guild.channels.cache.get(args[0]); + + if (!Channel) return message.channel.send(`Bitte erwähnen Sie einen Kanal!`); + + if (Channel.type === "voice") return message.channel.send(`Bitte erwähnen Sie einen Textkanal!`); + + await db.set(`suggestion_${message.guild.id}`, Channel.id); + + let Embed = new MessageEmbed() + .setColor("00FFFF") + .setDescription(`Vorschlagskanal ist eingestellt als <#${Channel.id}>`) + + return message.channel.send(Embed); + + } +}; \ No newline at end of file diff --git a/commands/suggestion/suggest.js b/commands/suggestion/suggest.js new file mode 100644 index 0000000..110c753 --- /dev/null +++ b/commands/suggestion/suggest.js @@ -0,0 +1,36 @@ +const Discord = require("discord.js"); +const { MessageEmbed } = require("discord.js"); +const db = require("quick.db"); + +module.exports = { + name: "suggest", + category:"suggestion", + + run: async (client, message, args) => { + + let channel = await db.fetch(`suggestion_${message.guild.id}`); + if (channel === null) return; + + const suggestionQuery = args.join(" "); + if(!suggestionQuery) return message.reply("Bitte schlagen Sie etwas vor."); + + const embed = new MessageEmbed() + + .setAuthor(message.author.tag, message.author.displayAvatarURL({dynamic: true})) + .setDescription(`${suggestionQuery}`) + .setColor("00FFFF") + .setFooter("Status: Pending") + .setTimestamp(); + + const done = new MessageEmbed() + .setDescription(`<:bfdyes:832931453892558848> | Ihr Vorschlag wird hier eingereicht, <#${channel}>\n\nNote: Sie haben zugestimmt, eine Direktnachricht auf eine Antwort auf Ihren Vorschlag zu erhalten!`) + .setColor("00FFFF") + + message.channel.send(done) + + let msgEmbed = await message.guild.channels.cache.get(channel).send(embed) + + await msgEmbed.react('<:upvote:832931955556745236>') + await msgEmbed.react('<:downvote:832931677294428161> ') + } +} \ No newline at end of file