-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
point.ts
33 lines (29 loc) · 984 Bytes
/
point.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import * as app from "#app"
import points from "#tables/point.ts"
export default new app.Command({
name: "point",
description: "Check your points",
channelType: "guild",
aliases: ["points", "pts", "score"],
async run(message) {
const user = await app.getUser(message.member, true)
const data = (await points.query
.select(app.database.raw("sum(amount) as total"))
.where("to_id", user._id)
.first()) as { total: number } | undefined
await message.channel.send({
embeds: [
new app.EmbedBuilder()
.setTitle(`Points de ${message.member.displayName}`)
.setDescription(
`Vous avez actuellement ${
data?.total ?? 0
} points. Vous pouvez en gagner en aidant les autres membres et en utilisant la commande \`${await app.prefix(
message.guild,
)}point ask @membre\`.`,
),
],
})
},
subs: [app.pointLadder.generateCommand()],
})