chipmunkbot3/commands/myuser.js
2024-07-31 22:34:19 -04:00

24 lines
618 B
JavaScript

const { literal } = require('brigadier-commands')
module.exports = {
register (dispatcher) {
const node = dispatcher.register(
literal('myuser')
.executes(c => this.myUserCommand(c))
)
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()
source.sendFeedback([
{ text: 'Your username is: ', ...bot.styles.primary },
{ text: player.username, ...bot.styles.secondary }
], false)
}
}