chipmunkbot3/commands/myuser.js

24 lines
610 B
JavaScript

const { literal } = require('brigadier-commands')
module.exports = {
register (dispatcher) {
const node = dispatcher.register(
literal('myuser')
.executes(this.myUserCommand)
)
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)
}
}