From 11e4d4c1c536d32acaba87677191910836be65c4 Mon Sep 17 00:00:00 2001 From: Ibrahim Ansari Date: Wed, 29 May 2019 01:22:36 +0530 Subject: [PATCH] Fix images to be 2048 size and update remoteexec and ping. --- server/bot/commands/tools.ts | 16 ++++++++++++++-- server/bot/commands/utilities.ts | 6 +++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/server/bot/commands/tools.ts b/server/bot/commands/tools.ts index 622bc80..6aa9fd6 100644 --- a/server/bot/commands/tools.ts +++ b/server/bot/commands/tools.ts @@ -103,7 +103,13 @@ export const handleRemoteexec: Command = { userIDs: [host] } }, - generator: (message, args) => execSync(args.join(' '), { encoding: 'utf8' }) + generator: (message, args) => { + try { + return execSync(args.join(' '), { encoding: 'utf8' }) + } catch (e) { + return e.toString() + } + } } export const handlePing: Command = { @@ -115,7 +121,13 @@ export const handlePing: Command = { example: '/ping', argsRequired: false }, - generator: async (message) => { + generator: async (message, args) => { + // Special stuff. + if (args.length === 1 && testPilots.includes(message.author.id)) { + try { + return execSync('ping -c 1 ' + args[0], { encoding: 'utf8' }).split('\n')[1] + } catch (e) { return 'Looks like pinging the website failed. Don\'t ping subdomains.' } + } // Get the time before sending the message. const startTime = new Date().getTime() // Send the message. diff --git a/server/bot/commands/utilities.ts b/server/bot/commands/utilities.ts index d81d8fc..4af85d1 100644 --- a/server/bot/commands/utilities.ts +++ b/server/bot/commands/utilities.ts @@ -102,7 +102,7 @@ export const handleUserinfo: Command = { author: { name: `User info`, icon_url: user.avatarURL }, title: `${user.username}#${user.discriminator}` + (user.bot ? ' (Bot account)' : ''), description: user.mention, - thumbnail: { url: user.dynamicAvatarURL('png', 2048) }, + thumbnail: { url: user.dynamicAvatarURL('png', 2048).split('128').join('2048') }, color, fields: [ { name: 'Status', value: member ? member.status : 'N/A', inline: true }, @@ -291,8 +291,8 @@ export const handleAvatar: Command = { content: '**Avatar:**', embed: { author: { name: `${user.username}#${user.discriminator}`, icon_url: user.avatarURL }, - image: { url: user.dynamicAvatarURL('png', 2048) }, - description: `**[Link](${user.dynamicAvatarURL('png', 2048)})**`, + image: { url: user.dynamicAvatarURL('png', 2048).split('128').join('2048') }, + description: `**[Link](${user.dynamicAvatarURL('png', 2048).split('128').join('2048')})**`, color: member.roles.map(i => member.guild.roles.get(i)).sort( (a, b) => a.position > b.position ? -1 : 1 ).shift().color