chipmunkbot3/commands/myuser.js

25 lines
618 B
JavaScript
Raw Normal View History

2024-04-02 17:53:10 -04:00
const { literal } = require('brigadier-commands')
2024-02-11 21:23:41 -05:00
2024-04-02 17:53:10 -04:00
module.exports = {
register (dispatcher) {
const node = dispatcher.register(
literal('myuser')
.executes(c => this.myUserCommand(c))
2024-04-02 17:53:10 -04:00
)
2024-02-11 21:23:41 -05:00
2024-04-02 17:53:10 -04:00
node.description = 'Sends the username of the sender of the command'
node.permissionLevel = 0
},
myUserCommand (context) {
const source = context.source
const bot = source.bot
const player = source.getPlayerOrThrow()
2024-02-11 21:23:41 -05:00
2024-04-02 17:53:10 -04:00
source.sendFeedback([
{ text: 'Your username is: ', ...bot.styles.primary },
{ text: player.username, ...bot.styles.secondary }
], false)
}
}