Skip to content

Commit

Permalink
Fix images to be 2048 size and update remoteexec and ping.
Browse files Browse the repository at this point in the history
  • Loading branch information
retrixe committed May 28, 2019
1 parent 2a428c3 commit 11e4d4c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
16 changes: 14 additions & 2 deletions server/bot/commands/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions server/bot/commands/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 11e4d4c

Please sign in to comment.