mirror of
https://github.com/ChomeNS/chomens-bot-mc.git
synced 2024-11-14 10:44:55 -05:00
show vanished + list improve + UUID not uuid
This commit is contained in:
parent
c69835327a
commit
f252dab0b7
3 changed files with 58 additions and 15 deletions
|
@ -7,7 +7,7 @@ module.exports = {
|
|||
usage: '',
|
||||
trusted: 0,
|
||||
execute: function(bot) {
|
||||
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'}]}}]);
|
||||
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()
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/* eslint-disable max-len */
|
||||
const sleep = require('sleep-promise');
|
||||
const {MessageEmbed} = require('discord.js');
|
||||
module.exports = {
|
||||
name: 'list',
|
||||
|
@ -9,12 +8,52 @@ module.exports = {
|
|||
trusted: 0,
|
||||
execute: async function(bot) {
|
||||
try {
|
||||
bot.tellraw('@a', [{text: 'Players:', color: 'green'}]);
|
||||
await sleep(60);
|
||||
const component = [];
|
||||
component.push({text: 'Players ', color: 'green'});
|
||||
component.push({text: '(', color: 'dark_gray'});
|
||||
component.push({text: bot.players.list.length, color: 'gray'});
|
||||
component.push({text: ')', color: 'dark_gray'});
|
||||
component.push('\n');
|
||||
for (const property of bot.players.list) {
|
||||
// if (property.match.startsWith('@')) continue;
|
||||
bot.tellraw('@a', [{text: `${property.name}`, color: 'yellow'}, {text: ' › ', color: 'aqua'}, {text: `${property.UUID}`, color: 'aqua'}]);
|
||||
component.push({
|
||||
text: property.name,
|
||||
color: 'yellow',
|
||||
clickEvent: {
|
||||
action: 'copy_to_clipboard',
|
||||
value: property.name,
|
||||
},
|
||||
hoverEvent: {
|
||||
action: 'show_text',
|
||||
contents: [{
|
||||
text: 'Click here to copy the username to your clipboard',
|
||||
color: 'green',
|
||||
}],
|
||||
},
|
||||
});
|
||||
component.push({
|
||||
text: ' › ',
|
||||
color: 'dark_gray',
|
||||
});
|
||||
component.push({
|
||||
text: property.UUID,
|
||||
color: 'aqua',
|
||||
clickEvent: {
|
||||
action: 'copy_to_clipboard',
|
||||
value: property.UUID,
|
||||
},
|
||||
hoverEvent: {
|
||||
action: 'show_text',
|
||||
contents: [{
|
||||
text: 'Click here to copy the UUID to your clipboard',
|
||||
color: 'green',
|
||||
}],
|
||||
},
|
||||
});
|
||||
component.push('\n');
|
||||
}
|
||||
component.pop();
|
||||
bot.tellraw('@a', component);
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
|
@ -28,7 +67,7 @@ module.exports = {
|
|||
}
|
||||
const Embed = new MessageEmbed()
|
||||
.setColor('#FFFF00')
|
||||
.setTitle('Players')
|
||||
.setTitle(`Players (${bot.players.list.length})`)
|
||||
.setDescription(players.substring(0, 4096));
|
||||
channeldc.send({embeds: [Embed]});
|
||||
} catch (e) {
|
||||
|
|
|
@ -80,7 +80,7 @@ class TabCompletePlayerRequester {
|
|||
}
|
||||
}
|
||||
|
||||
function inject(bot) {
|
||||
function inject(bot, dcclient, config) {
|
||||
bot.players = new PlayerList();
|
||||
bot.requester = new TabCompletePlayerRequester(bot);
|
||||
|
||||
|
@ -107,8 +107,10 @@ function inject(bot) {
|
|||
});
|
||||
|
||||
function addPlayer(player, packet) {
|
||||
// if (bot.players.getPlayer(player)) bot.emit('player_unvanished', player, packet);
|
||||
/* else */bot.emit('player_added', player, packet);
|
||||
if (bot.options.host !== 'sus.shhnowisnottheti.me') {
|
||||
if (bot.players.getPlayer(player)) bot.emit('player_unvanished', player, packet);
|
||||
else bot.emit('player_added', player, packet);
|
||||
}
|
||||
|
||||
bot.players.addPlayer(player);
|
||||
}
|
||||
|
@ -144,15 +146,17 @@ function inject(bot) {
|
|||
}
|
||||
|
||||
async function removePlayer(player, packet) {
|
||||
/* const fullPlayer = bot.players.getPlayer(player);
|
||||
if (bot.options.host !== 'sus.shhnowisnottheti.me') {
|
||||
const fullPlayer = bot.players.getPlayer(player);
|
||||
|
||||
const players = await bot.requester.getPlayerList();
|
||||
const players = await bot.requester.getPlayerList();
|
||||
|
||||
if (fullPlayer && players.some((name) => name === fullPlayer.name)) {
|
||||
bot.emit('player_vanished', player);
|
||||
if (fullPlayer && players.some((name) => name === fullPlayer.name)) {
|
||||
bot.emit('player_vanished', player);
|
||||
|
||||
return;
|
||||
} */
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bot.emit('player_removed', player, packet);
|
||||
|
||||
|
|
Loading…
Reference in a new issue