PineaFan | a34d04b | 2023-01-03 22:05:42 +0000 | [diff] [blame] | 1 | import { ContextMenuCommandBuilder, GuildMember, UserContextMenuCommandInteraction } from "discord.js"; |
| 2 | import { userAbout } from "../../commands/user/about.js"; |
| 3 | |
Skyler Grey | da16adf | 2023-03-05 10:22:12 +0000 | [diff] [blame] | 4 | const command = new ContextMenuCommandBuilder().setName("User info"); |
PineaFan | a34d04b | 2023-01-03 22:05:42 +0000 | [diff] [blame] | 5 | |
| 6 | const callback = async (interaction: UserContextMenuCommandInteraction) => { |
TheCodedProf | 680c497 | 2023-04-23 15:14:08 -0400 | [diff] [blame^] | 7 | try { |
| 8 | console.log("getting user info") |
| 9 | const guild = interaction.guild!; |
| 10 | let member = interaction.targetMember as GuildMember | null; |
| 11 | if (!member) member = await guild.members.fetch(interaction.targetId); |
| 12 | await userAbout(guild, member as GuildMember, interaction); |
| 13 | } catch (e) { console.log(e) } |
Skyler Grey | da16adf | 2023-03-05 10:22:12 +0000 | [diff] [blame] | 14 | }; |
PineaFan | a34d04b | 2023-01-03 22:05:42 +0000 | [diff] [blame] | 15 | |
| 16 | const check = async (_interaction: UserContextMenuCommandInteraction) => { |
PineaFan | a34d04b | 2023-01-03 22:05:42 +0000 | [diff] [blame] | 17 | return true; |
Skyler Grey | da16adf | 2023-03-05 10:22:12 +0000 | [diff] [blame] | 18 | }; |
PineaFan | a34d04b | 2023-01-03 22:05:42 +0000 | [diff] [blame] | 19 | |
Skyler Grey | da16adf | 2023-03-05 10:22:12 +0000 | [diff] [blame] | 20 | export { command, callback, check }; |