Skip to content

Commit d99ffed

Browse files
committed
feat: command for looking up member id
1 parent d05092c commit d99ffed

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/discord/discord.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,14 @@ async function init(database) {
110110
.setURL(discordConnectionsURL))
111111
await interaction.reply({ content: "Authorize access to your account by logging in with your Discord account.", components: [row], ephemeral: true })
112112
}
113+
} else if (interaction.commandName === "whois") {
114+
const discordUserId = interaction.options.get("user").value
115+
const member = await database.UserInfo.findOne({ id: discordUserId }, "id")
116+
if (!member) {
117+
await interaction.reply({ content: "Jäsentä ei ole vielä rekisterissä. Yritä huomenna uudelleen.", ephemeral: true })
118+
return
119+
}
120+
await interaction.reply({ content: member._id.toString(), ephemeral: true })
113121
}
114122
} catch (e) {
115123
console.error("Failed to process application command", e)

src/discord/slashCommands.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,17 @@ export default [
6161
]
6262
}
6363
]
64+
},
65+
{
66+
name: "whois",
67+
description: "Hae käyttäjän jäsentunniste",
68+
options: [
69+
{
70+
type: 6,
71+
name: "user",
72+
description: "Käyttäjä",
73+
required: true
74+
}
75+
]
6476
}
6577
]

0 commit comments

Comments
 (0)