chipmunkbot3/commands/matrix.js

39 lines
985 B
JavaScript
Raw Permalink Normal View History

2024-04-02 17:53:10 -04:00
const { literal } = require('brigadier-commands')
module.exports = {
register (dispatcher) {
const node = dispatcher.register(
literal('matrix')
.executes(c => this.matrixCommand(c))
2024-04-02 17:53:10 -04:00
)
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)
}
}