From e78cda6373bc5b8a910389d6e578f4104d06bc36 Mon Sep 17 00:00:00 2001 From: ChomeNS Date: Fri, 30 Dec 2022 15:05:48 +0700 Subject: [PATCH] use "value" instead of `${value}` + improve rtp --- commands/botuser.js | 2 +- commands/clearchat.js | 8 ++++---- commands/cloop.js | 2 +- commands/entity.js | 5 ++--- commands/eval.js | 8 ++++---- commands/rtp.js | 6 +++--- commands/time.js | 2 +- plugins/discord.js | 2 +- 8 files changed, 17 insertions(+), 18 deletions(-) diff --git a/commands/botuser.js b/commands/botuser.js index 6968eb6..68e6fe5 100644 --- a/commands/botuser.js +++ b/commands/botuser.js @@ -6,7 +6,7 @@ module.exports = { usage: '', trusted: 0, 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, sender, prefix, args, channeldc, message, config) { const Embed = new EmbedBuilder() diff --git a/commands/clearchat.js b/commands/clearchat.js index d6e90d4..91f5255 100644 --- a/commands/clearchat.js +++ b/commands/clearchat.js @@ -7,16 +7,16 @@ module.exports = { trusted: 0, execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) { if (args[0]) { - bot.tellraw(args.join(' '), [{ text: `${'\n'.repeat(100)}`, color: 'white' }, { text: `Your chat has been cleared by ${username}.`, color: 'dark_green' }]) + bot.tellraw(args.join(' '), [{ text: '\n'.repeat(100), color: 'white' }, { text: `Your chat has been cleared by ${username}.`, color: 'dark_green' }]) } 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, sender, prefix, args, channeldc, message) { if (args[0]) { - bot.tellraw(args.join(' '), [{ text: `${'\n'.repeat(100)}`, color: 'white' }, { text: `Your chat has been cleared by ${username} (on Discord).`, color: 'dark_green' }]) + bot.tellraw(args.join(' '), [{ text: '\n'.repeat(100), color: 'white' }, { text: `Your chat has been cleared by ${username} (on Discord).`, color: 'dark_green' }]) } 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' }]) } } } diff --git a/commands/cloop.js b/commands/cloop.js index 9519b0e..b7ebb76 100644 --- a/commands/cloop.js +++ b/commands/cloop.js @@ -57,7 +57,7 @@ module.exports = { if (args[1] === 'add' && args[3]) { if (!Number(args[2]) && Number(args[2]) !== 0) throw new SyntaxError('Invalid interval') bot.cloop.add(args.slice(3).join(' '), args[2]) - bot.tellraw(selector, [{ text: 'Added command ', color: 'white' }, { text: `${args.slice(3).join(' ')}`, color: 'aqua' }, { text: ' with interval ', color: 'white' }, { text: `${args[2]}`, color: 'green' }, { text: ' to the cloops', color: 'white' }]) + bot.tellraw(selector, [{ text: 'Added command ', color: 'white' }, { text: args.slice(3).join(' '), color: 'aqua' }, { text: ' with interval ', color: 'white' }, { text: args[2], color: 'green' }, { text: ' to the cloops', color: 'white' }]) } else if (args[1] === 'list') { list(bot, false, null, selector) } else if (args[1] === 'remove') { diff --git a/commands/entity.js b/commands/entity.js index 966f1ba..a1720bb 100644 --- a/commands/entity.js +++ b/commands/entity.js @@ -5,8 +5,7 @@ module.exports = { usage: '[specific] ', trusted: 0, execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) { - // eslint-disable-next-line no-unused-vars - const mcData = require('minecraft-data')(bot.version) + // const mcData = require('minecraft-data')(bot.version) throw new Error('Execute Bypass is patched so this command will be broken for now!') // if (!args[0]) return; @@ -17,7 +16,7 @@ module.exports = { // bot.tellraw(selector, [{text: 'Entity ', color: 'white'}, {text: entity.displayName, color: 'green'}, {text: ' spawning at everyone...', color: 'white'}]); // } else if (args[1] === 'specific' && args[2]) { // bot.core.run('minecraft:execute unless entity @s[name= run ] run execute as @a at ' + args[2] + ' run summon minecraft:' + entity.name); - // bot.tellraw(selector, [{text: `Entity `, color: 'white'}, {text: entity.displayName, color: 'green'}, {text: ' spawning at ', color: 'white'}, {text: `${args[2]}`, color: 'aqua'}]); + // bot.tellraw(selector, [{text: `Entity `, color: 'white'}, {text: entity.displayName, color: 'green'}, {text: ' spawning at ', color: 'white'}, {text: args[2], color: 'aqua'}]); // } } } diff --git a/commands/eval.js b/commands/eval.js index f4b59b7..d9a389c 100644 --- a/commands/eval.js +++ b/commands/eval.js @@ -17,9 +17,9 @@ module.exports = { execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) { if (args[0] === 'run') { 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) }) } 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' }) } } if (args[0] === 'reset') { @@ -33,9 +33,9 @@ module.exports = { colors: 'minecraft', code: args[1] })).then((res) => { - bot.tellraw(selector, { text: `${res.data}` }) + bot.tellraw(selector, { text: res.data }) }).catch((err) => { - bot.tellraw(selector, { text: `${err}`, color: 'red' }) + bot.tellraw(selector, { text: err, color: 'red' }) }) } }, diff --git a/commands/rtp.js b/commands/rtp.js index 70a9a82..a6eca97 100644 --- a/commands/rtp.js +++ b/commands/rtp.js @@ -6,8 +6,8 @@ module.exports = { usage: '', trusted: 0, execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) { - 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.core.run(`essentials:teleport ${sender} ${rtppos}`) + const pos = `${between(1000, 10000)} 100 ${between(1000, 10000)}` + bot.tellraw(selector, [{ text: 'Teleporting ', color: 'white' }, { text: username, color: 'aqua' }, { text: ' to ', color: 'white' }, { text: pos, color: 'green' }, { text: '...', color: 'white' }]) + bot.core.run(`essentials:teleport ${sender} ${pos}`) } } diff --git a/commands/time.js b/commands/time.js index 875eb90..5db8b18 100644 --- a/commands/time.js +++ b/commands/time.js @@ -9,7 +9,7 @@ module.exports = { execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) { const timezone = args.join(' ') 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' }] if (timezone.toLowerCase() === 'asia/bangkok' || timezone.toLowerCase() === 'utc') { bot.tellraw(selector, component) } else if (momented === moment().format('dddd, MMMM Do, YYYY, hh:mm:ss A')) { diff --git a/plugins/discord.js b/plugins/discord.js index 4ccc77c..7c318b7 100644 --- a/plugins/discord.js +++ b/plugins/discord.js @@ -70,7 +70,7 @@ async function inject (bot, dcclient, config) { }, { text: '] ', color: 'dark_gray' }, { - text: `${message.member.displayName}`, + text: message.member.displayName, color: 'red', clickEvent: { action: 'copy_to_clipboard',