toowake

Answer.js

Aug 7th, 2023
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. const { SlashCommandBuilder, EmbedBuilder, PermissionFlagsBits } = require("discord.js");
  2.  
  3. module.exports = {
  4. data: new SlashCommandBuilder()
  5. .setName("answer")
  6. .setDescription("Answer to a message")
  7. .setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages)
  8. .addStringOption(option => option
  9. .setName("message-id")
  10. .setDescription("the message id")
  11. .setRequired(true)
  12. )
  13. .addStringOption(option => option
  14. .setName("text")
  15. .setDescription("your text")
  16. .setRequired(true)
  17. ),
  18.  
  19. async execute (interaction, client) {
  20. const msgid = interaction.options.getString("message-id");
  21. const thema = interaction.options.getString("thema");
  22.  
  23. const embed1 = new EmbedBuilder()
  24. .setTitle("Option 1")
  25. .addFields(
  26. {name: "Moderator", value: `<@${interaction.user.id}>`, inline: true},
  27. )
  28. .setDescription("Test")
  29. .setColor("Random")
  30.  
  31. const embed2 = new EmbedBuilder()
  32. .setTitle("Option 2")
  33. .addFields(
  34. {name: "Moderator", value: `<@${interaction.user.id}>`, inline: true},
  35. )
  36. .setDescription("Test")
  37. .setColor("Random")
  38.  
  39. if (msgid.startsWith("http")) {
  40. return await interaction.reply({
  41. content: "You can only use the message id, to get the message id enable the discord developer mode!",
  42. ephemeral: true
  43. })
  44. }
  45.  
  46. await interaction.reply({
  47. content: `Answered to https://ptb.discord.com/channels/${interaction.guild.id}/${interaction.channel.id}/${msgid}`,
  48. ephemeral: true
  49. })
  50.  
  51. if (thema === "op1") {
  52. client.channels.cache.get(interaction.channel.id).messages.fetch(msgid).then(message => message.reply({embeds: [embed1]}))
  53. }
  54.  
  55. if (thema === "op2") {
  56. client.channels.cache.get(interaction.channel.id).messages.fetch(msgid).then(message => message.reply({embeds: [embed1]}))
  57. }
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment