im breaking the bot

This commit is contained in:
jane 2021-05-25 14:36:27 -04:00
parent 79cd4e8935
commit 0e827d1c85
2 changed files with 2 additions and 11 deletions

View file

@ -82,7 +82,7 @@ class Purge extends Command {
guild.leave(); guild.leave();
purged++; purged++;
} else { } else {
this.log.info(`keeping guild ${guild.name} (${guild.id})`); this.log.debug(`keeping guild ${guild.name} (${guild.id})`);
} }
}); });
msg.channel.createMessage(`purged ${purged} guilds.`); msg.channel.createMessage(`purged ${purged} guilds.`);

View file

@ -7,11 +7,6 @@ function getBinarySize(string) {
return Buffer.byteLength(string, 'utf8'); return Buffer.byteLength(string, 'utf8');
} }
function padLeft(size = 4, str = '') {
let remaining = size - str.length;
return '0'.repeat(remaining) + str;
}
export default function req(data, callback, errorCallback) { export default function req(data, callback, errorCallback) {
let string_data = JSON.stringify(data); let string_data = JSON.stringify(data);
let size = getBinarySize(string_data); let size = getBinarySize(string_data);
@ -22,11 +17,7 @@ export default function req(data, callback, errorCallback) {
let client = new net.Socket(); let client = new net.Socket();
client.connect(port, hostname, () => { client.connect(port, hostname, () => {
let res = client.write(padLeft(4, `${size}`));
if (res) {
client.write(string_data); client.write(string_data);
}
client.destroy(); client.destroy();
callback('success.'); callback('success.');
}); });