Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { SlashCommandBuilder, EmbedBuilder, PermissionFlagsBits } = require("discord.js");
- module.exports = {
- data: new SlashCommandBuilder()
- .setName("answer")
- .setDescription("Answer to a message")
- .setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages)
- .addStringOption(option => option
- .setName("message-id")
- .setDescription("the message id")
- .setRequired(true)
- )
- .addStringOption(option => option
- .setName("thema")
- .addChoices(
- {name: "option-1", value: "op1"},
- {name: "option-2", value: "op2"}
- )
- .setDescription("Das Thema")
- .setRequired(true)
- ),
- async execute (interaction, client) {
- const msgid = interaction.options.getString("message-id");
- const thema = interaction.options.getString("thema");
- const embed1 = new EmbedBuilder()
- .setTitle("Option 1")
- .addFields(
- {name: "Moderator", value: `<@${interaction.user.id}>`, inline: true},
- )
- .setDescription("Test")
- .setColor("Random")
- const embed2 = new EmbedBuilder()
- .setTitle("Option 2")
- .addFields(
- {name: "Moderator", value: `<@${interaction.user.id}>`, inline: true},
- )
- .setDescription("Test")
- .setColor("Random")
- await interaction.reply({
- content: `Answered to https://ptb.discord.com/channels/${interaction.guild.id}/${interaction.channel.id}/${msgid}`,
- ephemeral: true
- })
- if (thema === "op1") {
- client.channels.cache.get(interaction.channel.id).messages.fetch(msgid).then(message => message.reply({embeds: [embed1]}))
- }
- if (thema === "op2") {
- client.channels.cache.get(interaction.channel.id).messages.fetch(msgid).then(message => message.reply({embeds: [embed1]}))
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment