mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
bot.tellraw()
i totally did not used the search icon thing in vscode
This commit is contained in:
parent
766cf10267
commit
6895a37104
29 changed files with 81 additions and 73 deletions
|
@ -7,7 +7,7 @@ module.exports = {
|
|||
usage: '',
|
||||
trusted: 0,
|
||||
execute: function(bot) {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {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('@a', ['', {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: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
||||
const Embed = new MessageEmbed()
|
||||
|
|
|
@ -11,11 +11,11 @@ module.exports = {
|
|||
if (args[1]==='true') {
|
||||
bot.visibility = true;
|
||||
bot.chat('/essentials:vanish disable');
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: 'The bot\'s visibility is now ', color: 'white'}, {text: 'visible', color: 'green'}]));
|
||||
bot.tellraw('@a', ['', {text: 'The bot\'s visibility is now ', color: 'white'}, {text: 'visible', color: 'green'}]);
|
||||
} else if (args[1]==='false') {
|
||||
bot.visibility = false;
|
||||
bot.chat('/essentials:vanish enable');
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: 'The bot\'s visibility is now ', color: 'white'}, {text: 'invisible', color: 'gold'}]));
|
||||
bot.tellraw('@a', ['', {text: 'The bot\'s visibility is now ', color: 'white'}, {text: 'invisible', color: 'gold'}]);
|
||||
} else {
|
||||
throw new SyntaxError('Invalid argument');
|
||||
}
|
||||
|
|
|
@ -8,10 +8,10 @@ module.exports = {
|
|||
usage: '',
|
||||
trusted: 0,
|
||||
execute: function(bot) {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{text: 'Changelogs:', color: 'green'}]));
|
||||
bot.tellraw('@a', [{text: 'Changelogs:', color: 'green'}]);
|
||||
changelog.forEach((message, number) => {
|
||||
number += 1;
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{text: `${number}`, color: 'gray'}, {text: ' - ', color: 'dark_gray'}, {text: message, color: 'gray'}]));
|
||||
bot.tellraw('@a', [{text: `${number}`, color: 'gray'}, {text: ' - ', color: 'dark_gray'}, {text: message, color: 'gray'}]);
|
||||
});
|
||||
},
|
||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc) {
|
||||
|
|
|
@ -8,18 +8,18 @@ module.exports = {
|
|||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args) {
|
||||
if (args[0]==='specific') {
|
||||
bot.core.run(`minecraft:tellraw ${args[1]} ` + JSON.stringify([{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'}]);
|
||||
return;
|
||||
} else {
|
||||
bot.core.run(`minecraft:tellraw @a ` + JSON.stringify([{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: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
||||
if (args[0]==='specific') {
|
||||
bot.core.run(`minecraft:tellraw ${args[1]} ` + JSON.stringify([{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'}]);
|
||||
return;
|
||||
} else {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{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'}]);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -52,7 +52,7 @@ function list(bot, discord, channeldc) {
|
|||
|
||||
message.pop();
|
||||
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(message));
|
||||
bot.tellraw('@a', message);
|
||||
}
|
||||
module.exports = {
|
||||
name: 'cloop',
|
||||
|
@ -68,7 +68,7 @@ module.exports = {
|
|||
if (args[3]) {
|
||||
if (!Number(args[2]) && Number(args[2]) !== 0) throw new SyntaxError('Invalid interval');
|
||||
add(args.slice(3).join(' '), args[2], bot);
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{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('@a', [{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 {
|
||||
throw new Error('Invalid hash');
|
||||
|
@ -86,7 +86,7 @@ module.exports = {
|
|||
if (args[1]==='remove') {
|
||||
if (args[0]===bot.hash) {
|
||||
remove(args[2]);
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: 'Removed cloop '}, {text: args[2], color: 'aqua'}]));
|
||||
bot.tellraw('@a', ['', {text: 'Removed cloop '}, {text: args[2], color: 'aqua'}]);
|
||||
} else {
|
||||
throw new Error('Invalid hash');
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ module.exports = {
|
|||
if (args[1]==='removeall') {
|
||||
if (args[0]===bot.hash) {
|
||||
clear();
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: 'Removed all looped commands', color: 'white'}]));
|
||||
bot.tellraw('@a', ['', {text: 'Removed all looped commands', color: 'white'}]);
|
||||
} else {
|
||||
throw new Error('Invalid hash');
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ module.exports = {
|
|||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args) {
|
||||
if (args[0]!=='list') {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: `${cowsay.say(args.slice(1).join(' '), {cow: cows[args[0]]})}`}));
|
||||
bot.tellraw('@a', {text: `${cowsay.say(args.slice(1).join(' '), {cow: cows[args[0]]})}`});
|
||||
} else {
|
||||
let color = '§6';
|
||||
let message = '';
|
||||
|
@ -22,7 +22,7 @@ module.exports = {
|
|||
};
|
||||
message += color + value + ' ';
|
||||
});
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{text: 'Cows: ', color: 'green'}, '\n', {text: message, color: 'red'}]));
|
||||
bot.tellraw('@a', [{text: 'Cows: ', color: 'green'}, '\n', {text: message, color: 'red'}]);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@ module.exports = {
|
|||
usage: '',
|
||||
trusted: 0,
|
||||
execute: function(bot) {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{text: 'ChomeNS Bot ', color: 'yellow'}, {text: 'was created by ', color: 'white'}, {text: 'chayapak', color: 'gold'}]));
|
||||
bot.tellraw('@a', [{text: 'ChomeNS Bot ', color: 'yellow'}, {text: 'was created by ', color: 'white'}, {text: 'chayapak', color: 'gold'}]);
|
||||
},
|
||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
||||
const Embed = new MessageEmbed()
|
||||
|
|
|
@ -5,7 +5,7 @@ module.exports = {
|
|||
usage: '',
|
||||
trusted: 0,
|
||||
execute: function(bot) {
|
||||
bot.core.run('minecraft:tellraw @a' + JSON.stringify([
|
||||
bot.tellraw('@a', [
|
||||
{
|
||||
text: 'The Discord invite is ',
|
||||
color: 'white',
|
||||
|
@ -18,6 +18,6 @@ module.exports = {
|
|||
value: 'https://discord.gg/xdgCkUyaA4',
|
||||
},
|
||||
},
|
||||
]));
|
||||
]);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -34,7 +34,7 @@ module.exports = {
|
|||
|
||||
bot.draw(data, info);
|
||||
} catch (e) {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: 'SyntaxError: Invalid URL', color: 'red'}));
|
||||
bot.tellraw('@a', {text: 'SyntaxError: Invalid URL', color: 'red'});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -15,10 +15,10 @@ module.exports = {
|
|||
// if (!entity) throw new SyntaxError('Invalid entity');
|
||||
// if (!args[1]) {
|
||||
// bot.core.run('minecraft:execute unless entity @s[name= run ] run execute as @a at @r[\'limit\'=10] run summon minecraft:' + entity.name);
|
||||
// bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: 'Entity ', color: 'white'}, {text: entity.displayName, color: 'green'}, {text: ' spawning at everyone...', color: 'white'}]));
|
||||
// bot.tellraw('@a', ['', {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.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: `Entity `, color: 'white'}, {text: entity.displayName, color: 'green'}, {text: ' spawning at ', color: 'white'}, {text: `${args[2]}`, color: 'aqua'}]));
|
||||
// bot.tellraw('@a', ['', {text: `Entity `, color: 'white'}, {text: entity.displayName, color: 'green'}, {text: ' spawning at ', color: 'white'}, {text: `${args[2]}`, color: 'aqua'}]);
|
||||
// }
|
||||
},
|
||||
};
|
||||
|
|
|
@ -14,9 +14,9 @@ module.exports = {
|
|||
execute: function(bot, username, usernameraw, sender, prefix, args, config) {
|
||||
if (args[0]==='run') {
|
||||
try {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: `${util.inspect(bot.vm.run(args.slice(1).join(' ')), {stylize: stylize})}`.substring(0, 1900)}));
|
||||
bot.tellraw('@a', {text: `${util.inspect(bot.vm.run(args.slice(1).join(' ')), {stylize: stylize})}`.substring(0, 1900)});
|
||||
} catch (err) {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: `${util.inspect(err).replaceAll('runner', 'chayapak1')}`, color: 'red'}));
|
||||
bot.tellraw('@a', {text: `${util.inspect(err).replaceAll('runner', 'chayapak1')}`, color: 'red'});
|
||||
}
|
||||
}
|
||||
if (args[0]==='reset') {
|
||||
|
@ -30,9 +30,9 @@ module.exports = {
|
|||
colors: 'minecraft',
|
||||
code: args[1],
|
||||
})).then((res) => {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: `${res.data}`}));
|
||||
bot.tellraw('@a', {text: `${res.data}`});
|
||||
}).catch((err) => {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: `${err}`, color: 'red'}));
|
||||
bot.tellraw('@a', {text: `${err}`, color: 'red'});
|
||||
});
|
||||
}
|
||||
// if (args[0]==='dineval') {
|
||||
|
@ -43,9 +43,9 @@ module.exports = {
|
|||
// colors: 'minecraft',
|
||||
// },
|
||||
// }).then((res) => {
|
||||
// bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: `${res.data}`}));
|
||||
// bot.tellraw('@a', {text: `${res.data}`}));
|
||||
// }).catch((e) => {
|
||||
// bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: `${e}`, color: 'red'}));
|
||||
// bot.tellraw('@a', {text: `${e}`, color: 'red'});
|
||||
// });
|
||||
// }
|
||||
},
|
||||
|
|
|
@ -36,10 +36,10 @@ module.exports = {
|
|||
if (command.alias.toString()!=='') {
|
||||
alias = command.alias.join(', ');
|
||||
}
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{text: prefix + command.name, color: 'gold'}, {text: ` (${alias})`, color: 'white'}, {text: ' - ', color: 'gray'}, {text: command.description, color: 'gray'}]));
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{text: 'Trust level: ', color: 'green'}, {text: command.trusted, color: 'yellow'}]));
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{text: 'Supported on Discord: ', color: 'green'}, {text: discordSupported, color: 'gold'}]));
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{text: prefix + command.name, color: 'gold'}, {text: ' ' + command.usage, color: 'aqua'}]));
|
||||
bot.tellraw('@a', [{text: prefix + command.name, color: 'gold'}, {text: ` (${alias})`, color: 'white'}, {text: ' - ', color: 'gray'}, {text: command.description, color: 'gray'}]);
|
||||
bot.tellraw('@a', [{text: 'Trust level: ', color: 'green'}, {text: command.trusted, color: 'yellow'}]);
|
||||
bot.tellraw('@a', [{text: 'Supported on Discord: ', color: 'green'}, {text: discordSupported, color: 'gold'}]);
|
||||
bot.tellraw('@a', [{text: prefix + command.name, color: 'gold'}, {text: ' ' + command.usage, color: 'aqua'}]);
|
||||
}
|
||||
|
||||
if (command.name === args[0]) m();
|
||||
|
@ -49,7 +49,7 @@ module.exports = {
|
|||
};
|
||||
} else {
|
||||
const pre = [{'text': 'Commands ', 'color': 'gray'}, {'text': '(', 'color': 'gray'}, {'text': '⬤ Public', 'color': 'green'}, {'text': ' ⬤ Trusted', 'color': 'red'}, {'text': ' ⬤ Owner', 'color': 'dark_red'}, {'text': ') -', 'color': 'gray'}];
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify([pre, {text: generalCommands, color: 'green'}, {text: trustedCommands, color: 'red'}, {text: ownerCommands, color: 'dark_red'}]));
|
||||
bot.tellraw('@a', [pre, {text: generalCommands, color: 'green'}, {text: trustedCommands, color: 'red'}, {text: ownerCommands, color: 'dark_red'}]);
|
||||
}
|
||||
},
|
||||
discordExecute: async function(bot, username, usernameraw, sender, prefix, args, channeldc) {
|
||||
|
|
|
@ -9,11 +9,11 @@ module.exports = {
|
|||
trusted: 0,
|
||||
execute: async function(bot) {
|
||||
try {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: 'Players:', color: 'green'}]));
|
||||
bot.tellraw('@a', ['', {text: 'Players:', color: 'green'}]);
|
||||
await sleep(60);
|
||||
for (const property of bot.players.list) {
|
||||
// if (property.match.startsWith('@')) continue;
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: `${property.name}`, color: 'yellow'}, {text: ' › ', color: 'aqua'}, {text: `${property.UUID}`, color: 'aqua'}]));
|
||||
bot.tellraw('@a', ['', {text: `${property.name}`, color: 'yellow'}, {text: ' › ', color: 'aqua'}, {text: `${property.UUID}`, color: 'aqua'}]);
|
||||
}
|
||||
} catch (e) {
|
||||
return;
|
||||
|
|
|
@ -29,7 +29,7 @@ async function play(bot, values, discord, channeldc) {
|
|||
.setDescription(`Added ${song.name} to the song queue`);
|
||||
channeldc.send({embeds: [Embed]});
|
||||
} else {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{text: 'Added ', color: 'white'}, {text: song.name, color: 'gold'}, {text: ' to the song queue', color: 'white'}]));
|
||||
bot.tellraw('@a', [{text: 'Added ', color: 'white'}, {text: song.name, color: 'gold'}, {text: ' to the song queue', color: 'white'}]);
|
||||
}
|
||||
} catch (e) {
|
||||
if (discord) {
|
||||
|
@ -39,7 +39,7 @@ async function play(bot, values, discord, channeldc) {
|
|||
.setDescription(`\`\`\`SyntaxError: Invalid file\`\`\``);
|
||||
channeldc.send({embeds: [Embed]});
|
||||
} else {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: 'SyntaxError: Invalid file', color: 'red'}));
|
||||
bot.tellraw('@a', {text: 'SyntaxError: Invalid file', color: 'red'});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ async function playUrl(bot, values, discord, channeldc) {
|
|||
.setDescription(`Added ${song.name} to the song queue`);
|
||||
channeldc.send({embeds: [Embed]});
|
||||
} else {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{text: 'Added ', color: 'white'}, {text: song.name, color: 'gold'}, {text: ' to the song queue', color: 'white'}]));
|
||||
bot.tellraw('@a', [{text: 'Added ', color: 'white'}, {text: song.name, color: 'gold'}, {text: ' to the song queue', color: 'white'}]);
|
||||
}
|
||||
} catch (e) {
|
||||
if (discord) {
|
||||
|
@ -73,7 +73,7 @@ async function playUrl(bot, values, discord, channeldc) {
|
|||
.setDescription(`\`\`\`SyntaxError: Invalid URL\`\`\``);
|
||||
channeldc.send({embeds: [Embed]});
|
||||
} else {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: 'SyntaxError: Invalid URL', color: 'red'}));
|
||||
bot.tellraw('@a', {text: 'SyntaxError: Invalid URL', color: 'red'});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ async function list(bot, discord, channeldc) {
|
|||
}});
|
||||
});
|
||||
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(message));
|
||||
bot.tellraw('@a', message);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
@ -142,7 +142,7 @@ module.exports = {
|
|||
}
|
||||
if (args[0]==='stop') {
|
||||
try {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: 'Cleared the song queue'}));
|
||||
bot.tellraw('@a', {text: 'Cleared the song queue'});
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ module.exports = {
|
|||
}
|
||||
if (args[0]==='skip') {
|
||||
try {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{text: 'Skipping '}, {text: bot.music.song.name, color: 'gold'}]));
|
||||
bot.tellraw('@a', [{text: 'Skipping '}, {text: bot.music.song.name, color: 'gold'}]);
|
||||
bot.music.skip();
|
||||
} catch (e) {
|
||||
throw new Error('No music is currently playing!');
|
||||
|
@ -159,22 +159,22 @@ module.exports = {
|
|||
if (args[0]==='loop') {
|
||||
if (args[1] === 'off') {
|
||||
bot.music.loop = 0;
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{text: 'Looping is now '}, {text: 'disabled', color: 'red'}]));
|
||||
bot.tellraw('@a', [{text: 'Looping is now '}, {text: 'disabled', color: 'red'}]);
|
||||
}
|
||||
if (args[1] === 'current') {
|
||||
bot.music.loop = 1;
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{text: 'Now Looping '}, {text: song.name, color: 'gold'}]));
|
||||
bot.tellraw('@a', [{text: 'Now Looping '}, {text: song.name, color: 'gold'}]);
|
||||
}
|
||||
if (args[1] === 'all') {
|
||||
bot.music.loop = 2;
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: 'Now looping every song in the queue'}));
|
||||
bot.tellraw('@a', {text: 'Now looping every song in the queue'});
|
||||
}
|
||||
}
|
||||
if (args[0]==='list') {
|
||||
list(bot);
|
||||
}
|
||||
if (args[0]==='nowplaying') {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{text: 'Now playing '}, {text: bot.music.song.name, color: 'gold'}]));
|
||||
bot.tellraw('@a', [{text: 'Now playing '}, {text: bot.music.song.name, color: 'gold'}]);
|
||||
}
|
||||
},
|
||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
||||
|
|
|
@ -6,7 +6,7 @@ module.exports = {
|
|||
usage: '',
|
||||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args) {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(
|
||||
bot.tellraw('@a',
|
||||
[
|
||||
{
|
||||
text: 'Your username is: ',
|
||||
|
@ -29,6 +29,6 @@ module.exports = {
|
|||
],
|
||||
},
|
||||
},
|
||||
]));
|
||||
]);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@ module.exports = {
|
|||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args) {
|
||||
const rtppos = `${between(20000000, 500000)} 100 ${between(20000000, 500000)}`;
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{text: 'Teleporting ', color: 'white'}, {text: username, color: 'aqua'}, {text: ' to ', color: 'white'}, {text: rtppos, color: 'green'}, {text: '...', color: 'white'}]));
|
||||
bot.tellraw('@a', [{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}`);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -10,9 +10,9 @@ module.exports = {
|
|||
execute: function(bot, username, usernameraw, sender, prefix, args) {
|
||||
if (args[0]===bot.ownerHash) {
|
||||
try {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: `${util.inspect(eval(args.slice(1).join(' ')), {stylize: stylize})}`.substring(0, 1900)}));
|
||||
bot.tellraw('@a', {text: `${util.inspect(eval(args.slice(1).join(' ')), {stylize: stylize})}`.substring(0, 1900)});
|
||||
} catch (err) {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: `${util.inspect(err).replaceAll('runner', 'chayapak1')}`, color: 'red'}));
|
||||
bot.tellraw('@a', {text: `${util.inspect(err).replaceAll('runner', 'chayapak1')}`, color: 'red'});
|
||||
}
|
||||
} else {
|
||||
throw new Error('Invalid OwnerHash');
|
||||
|
|
|
@ -7,7 +7,7 @@ module.exports = {
|
|||
usage: '',
|
||||
trusted: 0,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args) {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {'text': `Username: ${username},`, 'color': 'green'}, {'text': ` Raw username: ${usernameraw},`, 'color': 'green'}, {'text': ` Sender UUID: ${sender},`, 'color': 'green'}, {'text': ` Prefix: ${prefix},`, 'color': 'green'}, {'text': ` Args: ${args.join(', ').toString()}`, 'color': 'green'}]));
|
||||
bot.tellraw('@a', ['', {'text': `Username: ${username},`, 'color': 'green'}, {'text': ` Raw username: ${usernameraw},`, 'color': 'green'}, {'text': ` Sender UUID: ${sender},`, 'color': 'green'}, {'text': ` Prefix: ${prefix},`, 'color': 'green'}, {'text': ` Args: ${args.join(', ').toString()}`, 'color': 'green'}]);
|
||||
},
|
||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc) {
|
||||
const Embed = new MessageEmbed()
|
||||
|
|
|
@ -10,9 +10,9 @@ module.exports = {
|
|||
execute: async function(bot, username, usernameraw, sender, prefix, args) {
|
||||
try {
|
||||
const res = await translate(args.slice(2).join(' '), {from: args[0], to: args[1]});
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: 'Result: ', color: 'gold'}, {text: res.text, color: 'green'}]));
|
||||
bot.tellraw('@a', ['', {text: 'Result: ', color: 'gold'}, {text: res.text, color: 'green'}]);
|
||||
} catch (e) {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: String(e), color: 'red'}));
|
||||
bot.tellraw('@a', {text: String(e), color: 'red'});
|
||||
}
|
||||
},
|
||||
discordExecute: async function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
||||
|
|
|
@ -8,7 +8,7 @@ module.exports = {
|
|||
usage: '',
|
||||
trusted: 0,
|
||||
execute: function(bot) {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: 'The bot\'s uptime is ', color: 'white'}, {text: `${secondsToHms(Math.floor(performance.now() / 1000))}`, color: 'green'}]));
|
||||
bot.tellraw('@a', ['', {text: 'The bot\'s uptime is ', color: 'white'}, {text: `${secondsToHms(Math.floor(performance.now() / 1000))}`, color: 'green'}]);
|
||||
},
|
||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
||||
const Embed = new MessageEmbed()
|
||||
|
|
|
@ -9,11 +9,11 @@ module.exports = {
|
|||
execute: function(bot, username, usernameraw, sender, prefix, args) {
|
||||
urban.autocompleteExtra(args[0], (error, results) => {
|
||||
if (error) {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: '[', color: 'dark_red'}, {text: 'Urban', color: 'red'}, {text: '] ', color: 'dark_red'}, {text: error.message, color: 'red'}]));
|
||||
bot.tellraw('@a', ['', {text: '[', color: 'dark_red'}, {text: 'Urban', color: 'red'}, {text: '] ', color: 'dark_red'}, {text: error.message, color: 'red'}]);
|
||||
return;
|
||||
}
|
||||
results.forEach(({preview, term}) => {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {text: '[', color: 'dark_red'}, {text: 'Urban', color: 'red'}, {text: '] ', color: 'dark_red'}, {text: term, color: 'white'}, {text: ' - ', color: 'white'}, {text: preview, color: 'white'}]));
|
||||
bot.tellraw('@a', ['', {text: '[', color: 'dark_red'}, {text: 'Urban', color: 'red'}, {text: '] ', color: 'dark_red'}, {text: term, color: 'white'}, {text: ' - ', color: 'white'}, {text: preview, color: 'white'}]);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
|
|
@ -11,7 +11,7 @@ module.exports = {
|
|||
const playername = args.join(' ');
|
||||
const player = bot.playersAddedPlayers[playername];
|
||||
if (player === undefined) throw new SyntaxError('Invalid Username');
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(
|
||||
bot.tellraw('@a',
|
||||
[
|
||||
{
|
||||
text: `${playername}'s UUID: `,
|
||||
|
@ -34,9 +34,9 @@ module.exports = {
|
|||
],
|
||||
},
|
||||
},
|
||||
]));
|
||||
]);
|
||||
} else {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(
|
||||
bot.tellraw('@a',
|
||||
[
|
||||
{
|
||||
text: `Your UUID: `,
|
||||
|
@ -59,7 +59,7 @@ module.exports = {
|
|||
],
|
||||
},
|
||||
},
|
||||
]));
|
||||
]);
|
||||
}
|
||||
},
|
||||
discordExecute: function(bot, username, usernameraw, sender, prefix, args, channeldc, message) {
|
||||
|
|
|
@ -7,11 +7,11 @@ module.exports = {
|
|||
trusted: 1,
|
||||
execute: function(bot, username, usernameraw, sender, prefix, args) {
|
||||
if (args[0]===bot.hash) {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: 'Valid hash', color: 'green'}));
|
||||
bot.tellraw('@a', {text: 'Valid hash', color: 'green'});
|
||||
} else if (args[0]===bot.ownerHash) {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: 'Valid OwnerHash', color: 'green'}));
|
||||
bot.tellraw('@a', {text: 'Valid OwnerHash', color: 'green'});
|
||||
} else {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: 'Invalid hash', color: 'red'}));
|
||||
bot.tellraw('@a', {text: 'Invalid hash', color: 'red'});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -12,9 +12,9 @@ module.exports = {
|
|||
try {
|
||||
const page = await wiki.page(args.join(' '));
|
||||
const summary = await page.summary();
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: summary.extract, color: 'green'}));
|
||||
bot.tellraw('@a', {text: summary.extract, color: 'green'});
|
||||
} catch (e) {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: e.toString(), color: 'red'}));
|
||||
bot.tellraw('@a', {text: e.toString(), color: 'red'});
|
||||
}
|
||||
},
|
||||
discordExecute: async function(bot, username, usernameraw, sender, prefix, args, channeldc) {
|
||||
|
|
10
index.js
10
index.js
|
@ -246,7 +246,7 @@ function main() {
|
|||
|
||||
loginfinish = true;
|
||||
await sleep(1400);
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify([{text: 'ChomeNS Bot', color: 'yellow'}, {text: ' - ', color: 'dark_gray'}, {text: 'made by ', color: 'gray'}, {text: 'chayapak', color: 'gold'}]));
|
||||
bot.tellraw('@a', [{text: 'ChomeNS Bot', color: 'yellow'}, {text: ' - ', color: 'dark_gray'}, {text: 'made by ', color: 'gray'}, {text: 'chayapak', color: 'gold'}]);
|
||||
});
|
||||
|
||||
bot.on('parsed_chat', async function(message, data) {
|
||||
|
@ -353,10 +353,10 @@ dcclient.on('ready', async () => {
|
|||
}
|
||||
if (line.toLowerCase().startsWith('.servereval ')) {
|
||||
try {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: `${util.inspect(eval(`${line.substring(12)}`))}`, color: 'green'}));
|
||||
bot.tellraw('@a', {text: `${util.inspect(eval(`${line.substring(12)}`))}`, color: 'green'});
|
||||
return;
|
||||
} catch (err) {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: `${util.inspect(err)}`, color: 'red'}));
|
||||
bot.tellraw('@a', {text: `${util.inspect(err)}`, color: 'red'});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -374,7 +374,7 @@ dcclient.on('ready', async () => {
|
|||
}
|
||||
if (line==='.kill') process.exit();
|
||||
if (line.startsWith('.')) return bot.command_handler.run('Console', '§a§lConsole§r', '*' + line.substring(1), 'c0ns0le-uuid');
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(['', {'text': '[', 'color': 'dark_gray'}, {'text': `${bot.username} Console`, 'color': 'gray'}, {'text': '] ', 'color': 'dark_gray'}, {'text': 'chayapak ', 'color': 'green'}, {'text': '› ', 'color': 'dark_gray'}, chatMessage.MessageBuilder.fromString('&7' + line)]));
|
||||
bot.tellraw('@a', ['', {'text': '[', 'color': 'dark_gray'}, {'text': `${bot.username} Console`, 'color': 'gray'}, {'text': '] ', 'color': 'dark_gray'}, {'text': 'chayapak ', 'color': 'green'}, {'text': '› ', 'color': 'dark_gray'}, chatMessage.MessageBuilder.fromString('&7' + line)]);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
|
@ -439,7 +439,7 @@ dcclient.on('messageCreate', async (message) => {
|
|||
chatMessage.MessageBuilder.fromString('&7' + message.content),
|
||||
attachmentsComponent.length === 0 ? '' : attachmentsComponent,
|
||||
];
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify(component));
|
||||
bot.tellraw('@a', component);
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ function inject(bot, dcclient, config) {
|
|||
.setDescription(`\`\`\`${e}\`\`\``);
|
||||
channeldc.send({embeds: [Embed]});
|
||||
} else {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: String(e), color: 'red'}));
|
||||
bot.tellraw('@a', {text: String(e), color: 'red'});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -38,7 +38,7 @@ function inject(bot) {
|
|||
messages.push(message);
|
||||
}
|
||||
|
||||
for (const message of messages) bot.core.run(`minecraft:tellraw @a ${JSON.stringify(message)}`);
|
||||
for (const message of messages) bot.tellraw('@a', message);
|
||||
}
|
||||
|
||||
bot.draw = draw;
|
||||
|
|
|
@ -58,7 +58,7 @@ function inject(bot) {
|
|||
}
|
||||
bot.music.queue.shift();
|
||||
if (!bot.music.queue[0]) {
|
||||
bot.core.run('minecraft:tellraw @a ' + JSON.stringify({text: 'Finished playing every song in the queue'}));
|
||||
bot.tellraw('@a', {text: 'Finished playing every song in the queue'});
|
||||
bot.music.stop();
|
||||
return;
|
||||
}
|
||||
|
|
8
plugins/tellraw.js
Normal file
8
plugins/tellraw.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
/* eslint-disable max-len */
|
||||
function inject(bot) {
|
||||
bot.tellraw = function(selector, message) {
|
||||
bot.core.run(`minecraft:tellraw ${selector} ${typeof message === 'string' ? message : JSON.stringify(message)}`);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = {inject};
|
Loading…
Reference in a new issue