Skip to content

Commit

Permalink
feat: command for looking up member id
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnl committed Jul 6, 2024
1 parent d05092c commit d99ffed
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/discord/discord.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 12 additions & 0 deletions src/discord/slashCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
}
]

0 comments on commit d99ffed

Please sign in to comment.