Advertisement
PrinceOfCookies

Untitled

Oct 26th, 2023
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
  2. const User = require("../../schemas/users");
  3.  
  4. module.exports = {
  5. data: new SlashCommandBuilder()
  6. .setName("whois")
  7. .setDescription("whois command")
  8. .addUserOption((option) =>
  9. option.setName("user").setDescription("User to get info on")
  10. ),
  11. async execute(interaction) {
  12. const { options } = interaction;
  13.  
  14. let user = options.getUser("user");
  15.  
  16. if (!user) user = interaction.user;
  17.  
  18. // Get the users roles
  19. let guser = interaction.guild.members.cache.get(user.id);
  20. let roles = guser.roles.cache.map((role) => `<@&${role.id}>`).join(", ");
  21.  
  22. let profile = await User.findOne({ id: user.id });
  23.  
  24. let joinedTimestamp = guser.joinedTimestamp / 1000;
  25. let Nick = guser.nickname ? guser.nickname : "None";
  26.  
  27. const embed = new EmbedBuilder()
  28. .setColor("#0099ff")
  29. .setTitle(`Info About ${user.username}`)
  30. .setDescription(`Yep.. this is the description`)
  31. .setThumbnail(guser.displayAvatarURL({ dynamic: true }))
  32. .addFields(
  33. {
  34. name: "Discord Name",
  35. value: user.username,
  36. inline: true,
  37. },
  38. {
  39. name: "Discord ID",
  40. value: user.id,
  41. inline: true,
  42. },
  43. {
  44. name: "TGC Profile Made",
  45. value: `<t:${profile.timeCreated}>`,
  46. inline: true,
  47. },
  48. {
  49. name: "Account Creation Date",
  50. value: `<t:${Math.floor(user.createdTimestamp / 1000)}>`,
  51. inline: false,
  52. },
  53. {
  54. name: "Bot",
  55. value: user.bot ? "Yes" : "No",
  56. inline: true,
  57. },
  58. {
  59. name: "Server Join Date",
  60. value: `<t:${Math.floor(joinedTimestamp)}>`,
  61. inline: true,
  62. },
  63. {
  64. name: "Nickname",
  65. value: Nick,
  66. inline: true,
  67. },
  68. {
  69. name: "Roles",
  70. value: roles,
  71. inline: false,
  72. }
  73. );
  74.  
  75. interaction.reply({
  76. content: "T",
  77. embeds: [embed]
  78. })
  79. },
  80. };
  81.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement