mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
fix sender not working, remove sender from chat parser, remove raw username
This commit is contained in:
parent
c097f263e2
commit
ec2fde1a0b
38 changed files with 74 additions and 81 deletions
|
@ -4,10 +4,10 @@ module.exports = {
|
||||||
description: 'Sudos everyone on Ayunboom!',
|
description: 'Sudos everyone on Ayunboom!',
|
||||||
trusted: 1,
|
trusted: 1,
|
||||||
usage: '<hash> <c:|command>',
|
usage: '<hash> <c:|command>',
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
bot.core.run(`essentials:sudo * ${args.slice(1).join(' ')}`)
|
bot.core.run(`essentials:sudo * ${args.slice(1).join(' ')}`)
|
||||||
},
|
},
|
||||||
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
discordExecute (bot, username, sender, prefix, args, channeldc, message) {
|
||||||
bot.core.run(`essentials:sudo * ${args.join(' ')}`)
|
bot.core.run(`essentials:sudo * ${args.join(' ')}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,10 @@ module.exports = {
|
||||||
description: 'Shows the bot\'s username and UUID',
|
description: 'Shows the bot\'s username and UUID',
|
||||||
usage: '',
|
usage: '',
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
bot.tellraw(selector, [{ text: 'The bot\'s username is: ', color: 'white' }, { text: `${bot.username}`, color: 'gold', clickEvent: { action: 'copy_to_clipboard', value: `${bot.username}` }, hoverEvent: { action: 'show_text', contents: [{ text: 'Click here to copy the username to your clipboard', color: 'green' }] } }, { text: ' and the UUID is: ' }, { text: `${bot.uuid}`, color: 'aqua', clickEvent: { action: 'copy_to_clipboard', value: `${bot.uuid}` }, hoverEvent: { action: 'show_text', contents: [{ text: 'Click here to copy the UUID to your clipboard', color: 'green' }] } }])
|
bot.tellraw(selector, [{ text: 'The bot\'s username is: ', color: 'white' }, { text: `${bot.username}`, color: 'gold', clickEvent: { action: 'copy_to_clipboard', value: `${bot.username}` }, hoverEvent: { action: 'show_text', contents: [{ text: 'Click here to copy the username to your clipboard', color: 'green' }] } }, { text: ' and the UUID is: ' }, { text: `${bot.uuid}`, color: 'aqua', clickEvent: { action: 'copy_to_clipboard', value: `${bot.uuid}` }, hoverEvent: { action: 'show_text', contents: [{ text: 'Click here to copy the UUID to your clipboard', color: 'green' }] } }])
|
||||||
},
|
},
|
||||||
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
|
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
|
||||||
const Embed = new MessageEmbed()
|
const Embed = new MessageEmbed()
|
||||||
.setColor(config.discord.embedsColors.normal)
|
.setColor(config.discord.embedsColors.normal)
|
||||||
.setTitle('Bot\'s User')
|
.setTitle('Bot\'s User')
|
||||||
|
|
|
@ -9,7 +9,7 @@ module.exports = {
|
||||||
'<hash>'
|
'<hash>'
|
||||||
],
|
],
|
||||||
trusted: 1,
|
trusted: 1,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
if (args[1] === 'true' || args[1] === 'on') {
|
if (args[1] === 'true' || args[1] === 'on') {
|
||||||
bot.visibility = true
|
bot.visibility = true
|
||||||
bot.chat('/essentials:vanish disable')
|
bot.chat('/essentials:vanish disable')
|
||||||
|
@ -29,7 +29,7 @@ module.exports = {
|
||||||
throw new SyntaxError('Invalid argument')
|
throw new SyntaxError('Invalid argument')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
|
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
|
||||||
if (args[0] === 'true' || args[0] === 'on') {
|
if (args[0] === 'true' || args[0] === 'on') {
|
||||||
bot.visibility = true
|
bot.visibility = true
|
||||||
bot.chat('/essentials:vanish disable')
|
bot.chat('/essentials:vanish disable')
|
||||||
|
|
|
@ -5,10 +5,10 @@ module.exports = {
|
||||||
description: 'RecycleBot bruhify but actionbar',
|
description: 'RecycleBot bruhify but actionbar',
|
||||||
usage: '<message>',
|
usage: '<message>',
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
bot.bruhifyText = args.join(' ')
|
bot.bruhifyText = args.join(' ')
|
||||||
},
|
},
|
||||||
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
|
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
|
||||||
bot.bruhifyText = args.join(' ')
|
bot.bruhifyText = args.join(' ')
|
||||||
const Embed = new MessageEmbed()
|
const Embed = new MessageEmbed()
|
||||||
.setColor(config.discord.embedsColors.normal)
|
.setColor(config.discord.embedsColors.normal)
|
||||||
|
|
|
@ -4,10 +4,10 @@ module.exports = {
|
||||||
description: 'Executes a command in the command core',
|
description: 'Executes a command in the command core',
|
||||||
usage: '<command>',
|
usage: '<command>',
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
bot.core.run(args.join(' '))
|
bot.core.run(args.join(' '))
|
||||||
},
|
},
|
||||||
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc) {
|
discordExecute (bot, username, sender, prefix, args, channeldc) {
|
||||||
bot.core.run(args.join(' '))
|
bot.core.run(args.join(' '))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ module.exports = {
|
||||||
description: 'Shows the bot\'s changelog',
|
description: 'Shows the bot\'s changelog',
|
||||||
usage: '',
|
usage: '',
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
const component = []
|
const component = []
|
||||||
|
|
||||||
component.push({ text: 'Changelogs ', color: 'green' })
|
component.push({ text: 'Changelogs ', color: 'green' })
|
||||||
|
@ -26,7 +26,7 @@ module.exports = {
|
||||||
|
|
||||||
bot.tellraw(selector, component)
|
bot.tellraw(selector, component)
|
||||||
},
|
},
|
||||||
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
|
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
|
||||||
let changelogs = ''
|
let changelogs = ''
|
||||||
changelog.forEach((message, number) => {
|
changelog.forEach((message, number) => {
|
||||||
number += 1
|
number += 1
|
||||||
|
|
|
@ -5,14 +5,14 @@ module.exports = {
|
||||||
description: 'Clears the chat',
|
description: 'Clears the chat',
|
||||||
usage: '[specific] <player>',
|
usage: '[specific] <player>',
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
if (args[0] === 'specific') {
|
if (args[0] === 'specific') {
|
||||||
bot.tellraw(args[1], [{ text: `${'\n'.repeat(100)}`, color: 'white' }, { text: `Your chat has been cleared by ${username}.`, color: 'dark_green' }])
|
bot.tellraw(args[1], [{ text: `${'\n'.repeat(100)}`, color: 'white' }, { text: `Your chat has been cleared by ${username}.`, color: 'dark_green' }])
|
||||||
} else {
|
} else {
|
||||||
bot.tellraw('@a', [{ text: `${'\n'.repeat(100)}`, color: 'white' }, { text: 'The chat has been cleared.', color: 'dark_green' }])
|
bot.tellraw('@a', [{ text: `${'\n'.repeat(100)}`, color: 'white' }, { text: 'The chat has been cleared.', color: 'dark_green' }])
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
discordExecute (bot, username, sender, prefix, args, channeldc, message) {
|
||||||
if (args[0] === 'specific') {
|
if (args[0] === 'specific') {
|
||||||
bot.tellraw(args[1], [{ text: `${'\n'.repeat(100)}`, color: 'white' }, { text: `Your chat has been cleared by ${username} (on Discord).`, color: 'dark_green' }])
|
bot.tellraw(args[1], [{ text: `${'\n'.repeat(100)}`, color: 'white' }, { text: `Your chat has been cleared by ${username} (on Discord).`, color: 'dark_green' }])
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -53,7 +53,7 @@ module.exports = {
|
||||||
'<hash> list'
|
'<hash> list'
|
||||||
],
|
],
|
||||||
trusted: 1,
|
trusted: 1,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
if (args[1] === 'add' && args[3]) {
|
if (args[1] === 'add' && args[3]) {
|
||||||
if (!Number(args[2]) && Number(args[2]) !== 0) throw new SyntaxError('Invalid interval')
|
if (!Number(args[2]) && Number(args[2]) !== 0) throw new SyntaxError('Invalid interval')
|
||||||
bot.cloop.add(args.slice(3).join(' '), args[2])
|
bot.cloop.add(args.slice(3).join(' '), args[2])
|
||||||
|
@ -70,7 +70,7 @@ module.exports = {
|
||||||
throw new SyntaxError('Invalid argument')
|
throw new SyntaxError('Invalid argument')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
|
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
|
||||||
if (args[0] === 'add' && args[2]) {
|
if (args[0] === 'add' && args[2]) {
|
||||||
if (!Number(args[1]) && Number(args[1]) !== 0) throw new SyntaxError('Invalid interval')
|
if (!Number(args[1]) && Number(args[1]) !== 0) throw new SyntaxError('Invalid interval')
|
||||||
bot.cloop.add(args.slice(2).join(' '), args[1])
|
bot.cloop.add(args.slice(2).join(' '), args[1])
|
||||||
|
|
|
@ -10,7 +10,7 @@ module.exports = {
|
||||||
'list (not support on Discord)'
|
'list (not support on Discord)'
|
||||||
],
|
],
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
if (args[0] === 'list') {
|
if (args[0] === 'list') {
|
||||||
const listed = Object.keys(cows)
|
const listed = Object.keys(cows)
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ module.exports = {
|
||||||
bot.tellraw(selector, { text: cowsay.say(args.slice(1).join(' '), { cow: cows[args[0]] }) })
|
bot.tellraw(selector, { text: cowsay.say(args.slice(1).join(' '), { cow: cows[args[0]] }) })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
|
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
|
||||||
const Embed = new MessageEmbed()
|
const Embed = new MessageEmbed()
|
||||||
.setColor(config.discord.embedsColors.normal)
|
.setColor(config.discord.embedsColors.normal)
|
||||||
.setTitle('Cowsay')
|
.setTitle('Cowsay')
|
||||||
|
|
|
@ -18,10 +18,10 @@ module.exports = {
|
||||||
description: 'Crashes the server',
|
description: 'Crashes the server',
|
||||||
usage: '<hash>',
|
usage: '<hash>',
|
||||||
trusted: 1,
|
trusted: 1,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
crash(bot)
|
crash(bot)
|
||||||
},
|
},
|
||||||
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
discordExecute (bot, username, sender, prefix, args, channeldc, message) {
|
||||||
crash(bot)
|
crash(bot)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,10 @@ module.exports = {
|
||||||
description: 'Shows the bot\'s creator',
|
description: 'Shows the bot\'s creator',
|
||||||
usage: '',
|
usage: '',
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
bot.tellraw(selector, [{ text: 'ChomeNS Bot ', color: 'yellow' }, { text: 'was created by ', color: 'white' }, { text: 'chayapak', color: 'gold' }])
|
bot.tellraw(selector, [{ text: 'ChomeNS Bot ', color: 'yellow' }, { text: 'was created by ', color: 'white' }, { text: 'chayapak', color: 'gold' }])
|
||||||
},
|
},
|
||||||
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
|
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
|
||||||
const Embed = new MessageEmbed()
|
const Embed = new MessageEmbed()
|
||||||
.setColor(config.discord.embedsColors.normal)
|
.setColor(config.discord.embedsColors.normal)
|
||||||
.setTitle('Creator')
|
.setTitle('Creator')
|
||||||
|
|
|
@ -4,7 +4,7 @@ module.exports = {
|
||||||
description: 'Shows the discord invite',
|
description: 'Shows the discord invite',
|
||||||
usage: '',
|
usage: '',
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
bot.tellraw(selector, [
|
bot.tellraw(selector, [
|
||||||
{
|
{
|
||||||
text: 'The Discord invite is ',
|
text: 'The Discord invite is ',
|
||||||
|
|
|
@ -8,7 +8,7 @@ module.exports = {
|
||||||
alias: [],
|
alias: [],
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
usage: '<image url (JPEG, PNG, WebP, AVIF, GIF, SVG, TIFF)>',
|
usage: '<image url (JPEG, PNG, WebP, AVIF, GIF, SVG, TIFF)>',
|
||||||
execute: async function (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute: async function (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
try {
|
try {
|
||||||
const url = args.join(' ')
|
const url = args.join(' ')
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ module.exports = {
|
||||||
description: 'Lags Eaglercraft and crash it',
|
description: 'Lags Eaglercraft and crash it',
|
||||||
usage: '<hash> <on|off>',
|
usage: '<hash> <on|off>',
|
||||||
trusted: 1,
|
trusted: 1,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
switch (args[1]) {
|
switch (args[1]) {
|
||||||
case 'on':
|
case 'on':
|
||||||
bot.eaglercrash.on()
|
bot.eaglercrash.on()
|
||||||
|
|
|
@ -4,10 +4,10 @@ module.exports = {
|
||||||
description: 'Says a message',
|
description: 'Says a message',
|
||||||
usage: '<message>',
|
usage: '<message>',
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
bot.chat(args.join(' '))
|
bot.chat(args.join(' '))
|
||||||
},
|
},
|
||||||
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc) {
|
discordExecute (bot, username, sender, prefix, args, channeldc) {
|
||||||
bot.chat(args.join(' '))
|
bot.chat(args.join(' '))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,10 @@ module.exports = {
|
||||||
description: 'Ends the bot\'s client',
|
description: 'Ends the bot\'s client',
|
||||||
usage: '<hash>',
|
usage: '<hash>',
|
||||||
trusted: 1,
|
trusted: 1,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
bot.end('end command')
|
bot.end('end command')
|
||||||
},
|
},
|
||||||
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
discordExecute (bot, username, sender, prefix, args, channeldc, message) {
|
||||||
bot.end('end command')
|
bot.end('end command')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ module.exports = {
|
||||||
description: 'Summon any entity!',
|
description: 'Summon any entity!',
|
||||||
usage: '[specific] <player>',
|
usage: '[specific] <player>',
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
const mcData = require('minecraft-data')(bot.version)
|
const mcData = require('minecraft-data')(bot.version)
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ module.exports = {
|
||||||
'reset',
|
'reset',
|
||||||
'server (eval server) <code>'
|
'server (eval server) <code>'
|
||||||
],
|
],
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
if (args[0] === 'run') {
|
if (args[0] === 'run') {
|
||||||
try {
|
try {
|
||||||
bot.tellraw(selector, { text: `${util.inspect(bot.vm.run(args.slice(1).join(' ')), { stylize })}`.substring(0, 32000) })
|
bot.tellraw(selector, { text: `${util.inspect(bot.vm.run(args.slice(1).join(' ')), { stylize })}`.substring(0, 32000) })
|
||||||
|
@ -39,7 +39,7 @@ module.exports = {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
|
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
|
||||||
if (args[0] === 'run') {
|
if (args[0] === 'run') {
|
||||||
const Embed = new MessageEmbed()
|
const Embed = new MessageEmbed()
|
||||||
.setColor(config.discord.embedsColors.normal)
|
.setColor(config.discord.embedsColors.normal)
|
||||||
|
|
|
@ -4,7 +4,7 @@ module.exports = {
|
||||||
description: 'Execute command bypassed',
|
description: 'Execute command bypassed',
|
||||||
usage: '<hash> <command>',
|
usage: '<hash> <command>',
|
||||||
trusted: 1,
|
trusted: 1,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
bot.core.run('minecraft:execute unless entity @s[name= run ] run ' + args.slice(1).join(' '))
|
bot.core.run('minecraft:execute unless entity @s[name= run ] run ' + args.slice(1).join(' '))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ module.exports = {
|
||||||
description: 'Gamemode everyone',
|
description: 'Gamemode everyone',
|
||||||
usage: '<hash> <gamemode>',
|
usage: '<hash> <gamemode>',
|
||||||
trusted: 1,
|
trusted: 1,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
bot.core.run(`minecraft:execute unless entity @s[name= run ] run gamemode ${args[1]} @a[name=!${bot.username}]`)
|
bot.core.run(`minecraft:execute unless entity @s[name= run ] run gamemode ${args[1]} @a[name=!${bot.username}]`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ module.exports = {
|
||||||
description: 'Shows the help',
|
description: 'Shows the help',
|
||||||
usage: '[command]',
|
usage: '[command]',
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
if (args[0]) {
|
if (args[0]) {
|
||||||
for (const command of bot.command_handler.commands) {
|
for (const command of bot.command_handler.commands) {
|
||||||
function run () {
|
function run () {
|
||||||
|
@ -96,7 +96,7 @@ module.exports = {
|
||||||
bot.tellraw(selector, [pre, generalCommands, trustedCommands, ownerCommands])
|
bot.tellraw(selector, [pre, generalCommands, trustedCommands, ownerCommands])
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
discordExecute: async function (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
|
discordExecute: async function (bot, username, sender, prefix, args, channeldc, message, config) {
|
||||||
if (args[0]) {
|
if (args[0]) {
|
||||||
for (const command of bot.command_handler.commands) {
|
for (const command of bot.command_handler.commands) {
|
||||||
function run () {
|
function run () {
|
||||||
|
|
|
@ -5,7 +5,7 @@ module.exports = {
|
||||||
description: 'List players',
|
description: 'List players',
|
||||||
usage: '',
|
usage: '',
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
execute: async function (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute: async function (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
try {
|
try {
|
||||||
const component = []
|
const component = []
|
||||||
component.push({ text: 'Players ', color: 'green' })
|
component.push({ text: 'Players ', color: 'green' })
|
||||||
|
@ -57,7 +57,7 @@ module.exports = {
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
|
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
|
||||||
try {
|
try {
|
||||||
let players = ''
|
let players = ''
|
||||||
for (const property of bot.players.list) {
|
for (const property of bot.players.list) {
|
||||||
|
|
|
@ -160,7 +160,7 @@ module.exports = {
|
||||||
'nowplaying',
|
'nowplaying',
|
||||||
'queue'
|
'queue'
|
||||||
],
|
],
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
switch (args[0]) {
|
switch (args[0]) {
|
||||||
case 'play':
|
case 'play':
|
||||||
play(bot, args.slice(1), false, null, selector, config)
|
play(bot, args.slice(1), false, null, selector, config)
|
||||||
|
@ -252,7 +252,7 @@ module.exports = {
|
||||||
throw new SyntaxError('Invalid argument')
|
throw new SyntaxError('Invalid argument')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
|
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
|
||||||
let Embed
|
let Embed
|
||||||
switch (args[0]) {
|
switch (args[0]) {
|
||||||
case 'play':
|
case 'play':
|
||||||
|
|
|
@ -4,7 +4,7 @@ module.exports = {
|
||||||
description: 'Broadcasts a message to all of the servers that the bot is connected',
|
description: 'Broadcasts a message to all of the servers that the bot is connected',
|
||||||
usage: '<message>',
|
usage: '<message>',
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
const component = [
|
const component = [
|
||||||
{
|
{
|
||||||
text: '[',
|
text: '[',
|
||||||
|
|
|
@ -4,7 +4,7 @@ module.exports = {
|
||||||
description: 'Resets the bot\'s command core',
|
description: 'Resets the bot\'s command core',
|
||||||
usage: '',
|
usage: '',
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
bot.core.fillCore()
|
bot.core.fillCore()
|
||||||
},
|
},
|
||||||
discordExecute (bot) {
|
discordExecute (bot) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ module.exports = {
|
||||||
description: 'Randomly teleports the player',
|
description: 'Randomly teleports the player',
|
||||||
usage: '',
|
usage: '',
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
const rtppos = `${between(20000000, 500000)} 100 ${between(20000000, 500000)}`
|
const rtppos = `${between(20000000, 500000)} 100 ${between(20000000, 500000)}`
|
||||||
bot.tellraw(selector, [{ text: 'Teleporting ', color: 'white' }, { text: username, color: 'aqua' }, { text: ' to ', color: 'white' }, { text: rtppos, color: 'green' }, { text: '...', color: 'white' }])
|
bot.tellraw(selector, [{ text: 'Teleporting ', color: 'white' }, { text: username, color: 'aqua' }, { text: ' to ', color: 'white' }, { text: rtppos, color: 'green' }, { text: '...', color: 'white' }])
|
||||||
bot.core.run(`essentials:teleport ${sender} ${rtppos}`)
|
bot.core.run(`essentials:teleport ${sender} ${rtppos}`)
|
||||||
|
|
|
@ -8,14 +8,14 @@ module.exports = {
|
||||||
description: 'Basically eval command but without vm2',
|
description: 'Basically eval command but without vm2',
|
||||||
trusted: 2,
|
trusted: 2,
|
||||||
usage: '<ownerhash> <code>',
|
usage: '<ownerhash> <code>',
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
try {
|
try {
|
||||||
bot.tellraw(selector, { text: util.inspect(eval(args.slice(1).join(' ')), { stylize }).substring(0, 32700) })
|
bot.tellraw(selector, { text: util.inspect(eval(args.slice(1).join(' ')), { stylize }).substring(0, 32700) })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
bot.tellraw(selector, { text: util.inspect(err).replaceAll('runner', 'chayapak1'), color: 'red' })
|
bot.tellraw(selector, { text: util.inspect(err).replaceAll('runner', 'chayapak1'), color: 'red' })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
|
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
|
||||||
try {
|
try {
|
||||||
const Embed = new MessageEmbed()
|
const Embed = new MessageEmbed()
|
||||||
.setColor(config.discord.embedsColors.normal)
|
.setColor(config.discord.embedsColors.normal)
|
||||||
|
|
|
@ -5,16 +5,12 @@ module.exports = {
|
||||||
description: 'Tests if the bot is working',
|
description: 'Tests if the bot is working',
|
||||||
usage: '',
|
usage: '',
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
bot.tellraw(selector, [
|
bot.tellraw(selector, [
|
||||||
{
|
{
|
||||||
text: `Username: ${username},`,
|
text: `Username: ${username},`,
|
||||||
color: 'green'
|
color: 'green'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
text: ` Raw username: ${usernameraw},`,
|
|
||||||
color: 'green'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
text: ` Sender UUID: ${sender},`,
|
text: ` Sender UUID: ${sender},`,
|
||||||
color: 'green'
|
color: 'green'
|
||||||
|
@ -29,7 +25,7 @@ module.exports = {
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
|
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
|
||||||
const Embed = new MessageEmbed()
|
const Embed = new MessageEmbed()
|
||||||
.setColor(config.discord.embedsColors.normal)
|
.setColor(config.discord.embedsColors.normal)
|
||||||
.setTitle('Hello!')
|
.setTitle('Hello!')
|
||||||
|
|
|
@ -6,7 +6,7 @@ module.exports = {
|
||||||
description: 'Shows the time',
|
description: 'Shows the time',
|
||||||
usage: '<timezone>',
|
usage: '<timezone>',
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
const timezone = args.join(' ')
|
const timezone = args.join(' ')
|
||||||
const momented = moment().tz(timezone).format('dddd, MMMM Do, YYYY, hh:mm:ss A')
|
const momented = moment().tz(timezone).format('dddd, MMMM Do, YYYY, hh:mm:ss A')
|
||||||
const component = [{ text: 'The current date and time for the timezone ', color: 'white' }, { text: timezone, color: 'aqua' }, { text: ' is: ', color: 'white' }, { text: `${momented}`, color: 'green' }]
|
const component = [{ text: 'The current date and time for the timezone ', color: 'white' }, { text: timezone, color: 'aqua' }, { text: ' is: ', color: 'white' }, { text: `${momented}`, color: 'green' }]
|
||||||
|
@ -18,7 +18,7 @@ module.exports = {
|
||||||
bot.tellraw(selector, component)
|
bot.tellraw(selector, component)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
|
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
|
||||||
const timezone = args.join(' ')
|
const timezone = args.join(' ')
|
||||||
const momented = moment().tz(timezone).format('dddd, MMMM Do, YYYY, hh:mm:ss A')
|
const momented = moment().tz(timezone).format('dddd, MMMM Do, YYYY, hh:mm:ss A')
|
||||||
const description = `The current date and time for the timezone ${timezone} is: ${momented}`
|
const description = `The current date and time for the timezone ${timezone} is: ${momented}`
|
||||||
|
|
|
@ -4,7 +4,7 @@ module.exports = {
|
||||||
description: 'Teleport everyone',
|
description: 'Teleport everyone',
|
||||||
usage: '<hash> <player>',
|
usage: '<hash> <player>',
|
||||||
trusted: 1,
|
trusted: 1,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
bot.core.run(`minecraft:execute unless entity @s[name= run ] run tp @a ${args.slice(1).join(' ')}`)
|
bot.core.run(`minecraft:execute unless entity @s[name= run ] run tp @a ${args.slice(1).join(' ')}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ module.exports = {
|
||||||
description: 'Translate a message from any language to any language using Google Translate',
|
description: 'Translate a message from any language to any language using Google Translate',
|
||||||
usage: '<language 1> <language 2> <message>',
|
usage: '<language 1> <language 2> <message>',
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
execute: async function (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute: async function (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
try {
|
try {
|
||||||
const res = await translate(args.slice(2).join(' '), { from: args[0], to: args[1] })
|
const res = await translate(args.slice(2).join(' '), { from: args[0], to: args[1] })
|
||||||
bot.tellraw(selector, [{ text: 'Result: ', color: 'gold' }, { text: res.text, color: 'green' }])
|
bot.tellraw(selector, [{ text: 'Result: ', color: 'gold' }, { text: res.text, color: 'green' }])
|
||||||
|
@ -14,7 +14,7 @@ module.exports = {
|
||||||
bot.tellraw(selector, { text: String(e), color: 'red' })
|
bot.tellraw(selector, { text: String(e), color: 'red' })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
discordExecute: async function (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
|
discordExecute: async function (bot, username, sender, prefix, args, channeldc, message, config) {
|
||||||
try {
|
try {
|
||||||
const res = await translate(args.slice(2).join(' '), { from: args[0], to: args[1] })
|
const res = await translate(args.slice(2).join(' '), { from: args[0], to: args[1] })
|
||||||
const Embed = new MessageEmbed()
|
const Embed = new MessageEmbed()
|
||||||
|
|
|
@ -6,11 +6,11 @@ module.exports = {
|
||||||
description: 'Shows the bot\'s uptime',
|
description: 'Shows the bot\'s uptime',
|
||||||
usage: '',
|
usage: '',
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
const time = moment.utc(Math.floor(performance.now())).format('H [hours], m [minutes], s [seconds]')
|
const time = moment.utc(Math.floor(performance.now())).format('H [hours], m [minutes], s [seconds]')
|
||||||
bot.tellraw(selector, [{ text: 'The bot\'s uptime is ', color: 'white' }, { text: time, color: 'green' }])
|
bot.tellraw(selector, [{ text: 'The bot\'s uptime is ', color: 'white' }, { text: time, color: 'green' }])
|
||||||
},
|
},
|
||||||
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
|
discordExecute (bot, username, sender, prefix, args, channeldc, message, config) {
|
||||||
const time = moment.utc(Math.floor(performance.now())).format('H [hours], m [minutes], s [seconds]')
|
const time = moment.utc(Math.floor(performance.now())).format('H [hours], m [minutes], s [seconds]')
|
||||||
const Embed = new MessageEmbed()
|
const Embed = new MessageEmbed()
|
||||||
.setColor(config.discord.embedsColors.normal)
|
.setColor(config.discord.embedsColors.normal)
|
||||||
|
|
|
@ -5,7 +5,7 @@ module.exports = {
|
||||||
description: 'Working Urban Dictionary',
|
description: 'Working Urban Dictionary',
|
||||||
usage: '<word>',
|
usage: '<word>',
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
urban.autocompleteExtra(args[0], (error, results) => {
|
urban.autocompleteExtra(args[0], (error, results) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
bot.tellraw(selector, [{ text: '[', color: 'dark_red' }, { text: 'Urban', color: 'red' }, { text: '] ', color: 'dark_red' }, { text: error.message, color: 'red' }])
|
bot.tellraw(selector, [{ text: '[', color: 'dark_red' }, { text: 'Urban', color: 'red' }, { text: '] ', color: 'dark_red' }, { text: error.message, color: 'red' }])
|
||||||
|
|
|
@ -5,7 +5,7 @@ module.exports = {
|
||||||
description: 'Gets the UUID of a player. If no player specified it will show your UUID instead',
|
description: 'Gets the UUID of a player. If no player specified it will show your UUID instead',
|
||||||
usage: '',
|
usage: '',
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
if (args[0]) {
|
if (args[0]) {
|
||||||
const playername = args.join(' ')
|
const playername = args.join(' ')
|
||||||
const player = bot.playersAddedPlayers[playername]
|
const player = bot.playersAddedPlayers[playername]
|
||||||
|
@ -61,7 +61,7 @@ module.exports = {
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
discordExecute (bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
discordExecute (bot, username, sender, prefix, args, channeldc, message) {
|
||||||
if (args[0]) {
|
if (args[0]) {
|
||||||
const playername = args.join(' ')
|
const playername = args.join(' ')
|
||||||
const player = bot.playersAddedPlayers[playername]
|
const player = bot.playersAddedPlayers[playername]
|
||||||
|
|
|
@ -4,7 +4,7 @@ module.exports = {
|
||||||
alias: [],
|
alias: [],
|
||||||
usage: '<hash>',
|
usage: '<hash>',
|
||||||
trusted: 1,
|
trusted: 1,
|
||||||
execute (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
if (args[0] === hash) {
|
if (args[0] === hash) {
|
||||||
bot.tellraw(selector, { text: 'Valid hash', color: 'green' })
|
bot.tellraw(selector, { text: 'Valid hash', color: 'green' })
|
||||||
} else if (args[0] === ownerhash) {
|
} else if (args[0] === ownerhash) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ module.exports = {
|
||||||
description: 'Working Wikipedia!',
|
description: 'Working Wikipedia!',
|
||||||
usage: '<page>',
|
usage: '<page>',
|
||||||
trusted: 0,
|
trusted: 0,
|
||||||
execute: async function (bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector) {
|
execute: async function (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
|
||||||
try {
|
try {
|
||||||
const page = await wiki.page(args.join(' '))
|
const page = await wiki.page(args.join(' '))
|
||||||
const summary = await page.summary()
|
const summary = await page.summary()
|
||||||
|
@ -16,7 +16,7 @@ module.exports = {
|
||||||
bot.tellraw(selector, { text: e.toString(), color: 'red' })
|
bot.tellraw(selector, { text: e.toString(), color: 'red' })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
discordExecute: async function (bot, username, usernameraw, sender, prefix, args, channeldc, message, config) {
|
discordExecute: async function (bot, username, sender, prefix, args, channeldc, message, config) {
|
||||||
try {
|
try {
|
||||||
const page = await wiki.page(args.join(' '))
|
const page = await wiki.page(args.join(' '))
|
||||||
const summary = await page.summary()
|
const summary = await page.summary()
|
||||||
|
|
|
@ -10,7 +10,7 @@ function inject (bot, dcclient, config) {
|
||||||
bot.command_handler.commands = await loadFiles(path.join(__dirname, config.commandsDir))
|
bot.command_handler.commands = await loadFiles(path.join(__dirname, config.commandsDir))
|
||||||
}
|
}
|
||||||
bot.command_handler.reload()
|
bot.command_handler.reload()
|
||||||
bot.command_handler.main = function (prefix, username, usernameraw, message, sender, channeldc, hash, ownerhash, selector, proxy) {
|
bot.command_handler.main = function (prefix, username, message, sender, channeldc, hash, ownerhash, selector, proxy) {
|
||||||
bot.command_handler.reload()
|
bot.command_handler.reload()
|
||||||
let raw
|
let raw
|
||||||
let command
|
let command
|
||||||
|
@ -39,9 +39,9 @@ function inject (bot, dcclient, config) {
|
||||||
|
|
||||||
if (prefix === config.discord.prefix) {
|
if (prefix === config.discord.prefix) {
|
||||||
if (!command.discordExecute) throw new Error('This command is not yet supported on discord!')
|
if (!command.discordExecute) throw new Error('This command is not yet supported on discord!')
|
||||||
command.discordExecute(bot, username, usernameraw, sender, prefix, args, channeldc, message, config)
|
command.discordExecute(bot, username, sender, prefix, args, channeldc, message, config)
|
||||||
} else {
|
} else {
|
||||||
command.execute(bot, username, usernameraw, sender, prefix, args, config, hash, ownerhash, selector, proxy)
|
command.execute(bot, username, sender, prefix, args, config, hash, ownerhash, selector, proxy)
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (prefix === config.discord.prefix) {
|
if (prefix === config.discord.prefix) {
|
||||||
|
@ -55,15 +55,15 @@ function inject (bot, dcclient, config) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bot.command_handler.run = function (username, usernameraw, message, sender, channeldc, hash, ownerhash, selector = '@a', proxy) {
|
bot.command_handler.run = function (username, message, sender, channeldc, hash, ownerhash, selector = '@a', proxy) {
|
||||||
for (const prefix of config.prefixes) {
|
for (const prefix of config.prefixes) {
|
||||||
if (!message.startsWith(prefix)) continue
|
if (!message.startsWith(prefix)) continue
|
||||||
bot.command_handler.main(prefix, username, usernameraw, message, sender, channeldc, hash, ownerhash, selector, proxy)
|
bot.command_handler.main(prefix, username, message, sender, channeldc, hash, ownerhash, selector, proxy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let previousMessage = { username: '', message: '' }
|
let previousMessage = { username: '', message: '' }
|
||||||
let ratelimit = 0
|
let ratelimit = 0
|
||||||
bot.on('chat', async (_username, _message, _sender) => {
|
bot.on('chat', async (_username, _message) => {
|
||||||
// try catch cuz TypeError: Cannot read properties of undefined (reading 'replace')
|
// try catch cuz TypeError: Cannot read properties of undefined (reading 'replace')
|
||||||
try {
|
try {
|
||||||
if (
|
if (
|
||||||
|
@ -77,13 +77,10 @@ function inject (bot, dcclient, config) {
|
||||||
|
|
||||||
previousMessage = { username: _username, _message }
|
previousMessage = { username: _username, _message }
|
||||||
|
|
||||||
const usernameraw = _username.replace(/§.?/g, '')
|
const username = _username.replace(/§.?/g, '')
|
||||||
const sender = _sender !== '00000000-0000-0000-0000-000000000000' ? _sender : bot.playersAddedPlayers[usernameraw]
|
const sender = bot.players.list.find((val) => val.name === username)?.UUID
|
||||||
let username
|
|
||||||
if (!bot.getplayerusername[sender]) username = usernameraw
|
|
||||||
else username = bot.getplayerusername[sender]
|
|
||||||
const message = _message.replace(/* /§r/g */ /§.?/g, '')/* .replace(/§/g, '') */
|
const message = _message.replace(/* /§r/g */ /§.?/g, '')/* .replace(/§/g, '') */
|
||||||
bot.command_handler.run(username, usernameraw, message, sender, channeldc, bot.hash, bot.ownerHash)
|
bot.command_handler.run(username, message, sender, channeldc, bot.hash, bot.ownerHash)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
bot.console.error(e)
|
bot.console.error(e)
|
||||||
}
|
}
|
||||||
|
|
10
util/chat.js
10
util/chat.js
|
@ -42,24 +42,24 @@ function parsePlayerMessages (message, packet, bot) {
|
||||||
if (raw.match(/.* .*: .*/g)) {
|
if (raw.match(/.* .*: .*/g)) {
|
||||||
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/:.*/g, '').replace(/§#....../gm, '')
|
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/:.*/g, '').replace(/§#....../gm, '')
|
||||||
const message = raw.split(': ').slice(1).join(' ').replace(/§#....../gm, '')
|
const message = raw.split(': ').slice(1).join(' ').replace(/§#....../gm, '')
|
||||||
bot.emit('chat', username, message, packet.sender)
|
bot.emit('chat', username, message)
|
||||||
} else if (raw.match(/.* .*\u203a .*/g)) {
|
} else if (raw.match(/.* .*\u203a .*/g)) {
|
||||||
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/\u203a.*/g, '').replace(/§#....../gm, '').split(' ')[0]
|
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/\u203a.*/g, '').replace(/§#....../gm, '').split(' ')[0]
|
||||||
const message = raw.split('\u203a ').slice(1).join(' ').substring(2)
|
const message = raw.split('\u203a ').slice(1).join(' ').substring(2)
|
||||||
bot.emit('chat', username, message, packet.sender)
|
bot.emit('chat', username, message)
|
||||||
} else if (raw.match(/.* .*\u00BB .*/g)) {
|
} else if (raw.match(/.* .*\u00BB .*/g)) {
|
||||||
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/\u00BB.*/g, '').replace(/§#....../gm, '').split(' ')[0]
|
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/\u00BB.*/g, '').replace(/§#....../gm, '').split(' ')[0]
|
||||||
const message = raw.split('\u00BB ').slice(1).join(' ').substring(2)
|
const message = raw.split('\u00BB ').slice(1).join(' ').substring(2)
|
||||||
bot.emit('chat', username, message, packet.sender)
|
bot.emit('chat', username, message)
|
||||||
} else if (raw.match(/.* .*> .*/g)) {
|
} else if (raw.match(/.* .*> .*/g)) {
|
||||||
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/>.*/g, '').replace(/§#....../gm, '').split(' ')[0]
|
const username = raw.replace(/.*?\[.*?\] /g, '').replace(/>.*/g, '').replace(/§#....../gm, '').split(' ')[0]
|
||||||
const message = raw.split('> ').slice(1).join(' ').substring(2)
|
const message = raw.split('> ').slice(1).join(' ').substring(2)
|
||||||
bot.emit('chat', username, message, packet.sender)
|
bot.emit('chat', username, message)
|
||||||
} else if (raw.match(/<.*> .*/g)) {
|
} else if (raw.match(/<.*> .*/g)) {
|
||||||
const username = raw.substring(1).split('>')[0]
|
const username = raw.substring(1).split('>')[0]
|
||||||
const message = raw.split('> ').slice(1).join(' ')
|
const message = raw.split('> ').slice(1).join(' ')
|
||||||
|
|
||||||
bot.emit('chat', username, message, packet.sender)
|
bot.emit('chat', username, message)
|
||||||
} else if (raw.match(/§.*§b: §b\/.*/g)) {
|
} else if (raw.match(/§.*§b: §b\/.*/g)) {
|
||||||
const username = raw.split('§b: §b')[0]
|
const username = raw.split('§b: §b')[0]
|
||||||
const command = raw.split('§b: §b')[1]
|
const command = raw.split('§b: §b')[1]
|
||||||
|
|
Loading…
Reference in a new issue