toowake

google.js

Aug 7th, 2023
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. const { ChatInputCommandInteraction, SlashCommandBuilder, EmbedBuider, ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder } = require("discord.js")
  2.  
  3. module.exports = {
  4. data: new SlashCommandBuilder()
  5. .setName("google")
  6. .setDescription("replies with the google search you put")
  7. .addStringOption((option) =>
  8. option.setName("topic")
  9. .setDescription("topic to search")
  10. .setRequired(true)),
  11. /**
  12. *
  13. * @param {ChatInputCommandInteraction} interaction
  14. */
  15. execute(interaction) {
  16. const topic = interaction.options.getString("topic").slice().split(" ")
  17. const search = topic.join("+")
  18. const row = new ActionRowBuilder()
  19. .addComponents(
  20. new ButtonBuilder()
  21. .setLabel("Google Search")
  22. .setStyle(ButtonStyle.Link)
  23. .setURL(`https://google.com/search?q=${search}`)
  24. );
  25.  
  26. const embed = new EmbedBuilder()
  27. .setTitle("Google")
  28. .setDescription(`Click [here](https://google.com/search?q=${search}) or the button below me to view your google search`)
  29. interaction.reply({ embeds: [embed], components: [row]})
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment