Skip to content

Commit

Permalink
Fix message edits, plan userinfo updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
retrixe committed Jul 5, 2021
1 parent 84587d2 commit 2461bd7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions server/bot/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ export default class CommandParser {
async onMessageUpdate (message: Message, oldMessage?: Message) {
// We won't bother with a lot of messages..
if (message.content && !message.content.startsWith('/')) return
else if (!message.editedTimestamp) return
else if (this.evaluatedMessages.includes(message.id)) return
else if (!oldMessage || Date.now() - message.timestamp > 30000) return
else if (message.editedTimestamp - message.timestamp > 30000) return
Expand Down
8 changes: 5 additions & 3 deletions server/bot/commands/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export const handleUserinfo: Command = {
if (!user) return { content: `Specify a valid member of this guild, ${getInsult()}.`, error: true }
// Display information.
const member = message.member.guild.members.get(user.id)
// TODO: Add publicFlags, game and premiumSince.
const color = member ? (member.roles.map(i => member.guild.roles.get(i)).sort(
(a, b) => a.position > b.position ? -1 : 1
).find(i => i.color !== 0) || { color: 0 }).color : 0
Expand All @@ -113,14 +114,12 @@ export const handleUserinfo: Command = {
embed: {
author: { name: `User info`, icon_url: user.avatarURL },
title: `${user.username}#${user.discriminator}` + (user.bot ? ' (Bot account)' : ''),
description: user.mention,
description: user.mention + (member && member.pending ? ' (pending guild screening)' : ''),
thumbnail: { url: user.dynamicAvatarURL('png', 2048) },
color,
fields: [
{ name: 'Status', value: member && member.status ? member.status : 'N/A', inline: true },
// { name: 'Join Position }
// { name: 'Name', value: user.username, inline: true },
// { name: 'Discriminator', value: user.discriminator, inline: true },
{
name: 'Joined server at',
value: member ? moment(member.joinedAt).format('DD/MM/YYYY, hh:mm:ss A') : 'N/A',
Expand All @@ -131,6 +130,9 @@ export const handleUserinfo: Command = {
value: moment(user.createdAt).format('DD/MM/YYYY, hh:mm:ss A'),
inline: true
},
// Game...
// Badges...
// Boosting since..
{
name: `Roles (${member ? member.roles.length : 'N/A'})`,
value: member ? member.roles.map(i => member.guild.roles.get(i)).sort(
Expand Down

0 comments on commit 2461bd7

Please sign in to comment.