diff --git a/src/discord/discord.js b/src/discord/discord.js index f7ac8f2..f209794 100644 --- a/src/discord/discord.js +++ b/src/discord/discord.js @@ -110,6 +110,14 @@ async function init(database) { .setURL(discordConnectionsURL)) await interaction.reply({ content: "Authorize access to your account by logging in with your Discord account.", components: [row], ephemeral: true }) } + } else if (interaction.commandName === "whois") { + const discordUserId = interaction.options.get("user").value + const member = await database.UserInfo.findOne({ id: discordUserId }, "id") + if (!member) { + await interaction.reply({ content: "Jäsentä ei ole vielä rekisterissä. Yritä huomenna uudelleen.", ephemeral: true }) + return + } + await interaction.reply({ content: member._id.toString(), ephemeral: true }) } } catch (e) { console.error("Failed to process application command", e) diff --git a/src/discord/slashCommands.js b/src/discord/slashCommands.js index b7b6ad9..f46475f 100644 --- a/src/discord/slashCommands.js +++ b/src/discord/slashCommands.js @@ -61,5 +61,17 @@ export default [ ] } ] + }, + { + name: "whois", + description: "Hae käyttäjän jäsentunniste", + options: [ + { + type: 6, + name: "user", + description: "Käyttäjä", + required: true + } + ] } ]