const { literal } = require('brigadier-commands') module.exports = { register (dispatcher) { const node = dispatcher.register( literal('matrix') .executes(c => this.matrixCommand(c)) ) node.description = 'Sends the Matrix invite' node.permissionLevel = 0 }, matrixCommand (context) { const source = context.source const bot = source.bot source.sendFeedback([ { text: 'Join the ', color: 'gray' }, { text: 'ChipmunkBot Matrix', ...bot.styles.primary }, ' at ', { text: bot.matrix.inviteUrl, ...bot.styles.secondary, hoverEvent: { action: 'show_text', contents: 'Click to copy the invite link to your clipboard!' }, clickEvent: { action: 'copy_to_clipboard', // * Minecraft, and Java's URI class in general, seem to hate `#`, so open_url does not work. value: bot.matrix.inviteUrl } }, '!' ], false) } }