starboard: localized timestamps; add link to original message again
This commit is contained in:
parent
c7103ac432
commit
5ab6f59593
2 changed files with 7 additions and 2 deletions
|
@ -11,6 +11,7 @@ import {
|
|||
tNullable,
|
||||
tDeepPartial,
|
||||
UnknownUser,
|
||||
EMPTY_CHAR,
|
||||
} from "../utils";
|
||||
import path from "path";
|
||||
import moment from "moment-timezone";
|
||||
|
@ -247,12 +248,12 @@ export class StarboardPlugin extends ZeppelinPlugin<TConfigSchema> {
|
|||
|
||||
const embed: EmbedBase = {
|
||||
footer: {
|
||||
text: `#${(msg.channel as GuildChannel).name} - ${time}`,
|
||||
text: `#${(msg.channel as GuildChannel).name}`,
|
||||
},
|
||||
author: {
|
||||
name: `${msg.author.username}#${msg.author.discriminator}`,
|
||||
},
|
||||
url: messageLink(msg),
|
||||
timestamp: new Date(msg.timestamp).toISOString(),
|
||||
};
|
||||
|
||||
if (msg.author.avatarURL) {
|
||||
|
@ -280,6 +281,8 @@ export class StarboardPlugin extends ZeppelinPlugin<TConfigSchema> {
|
|||
embed.image = msg.embeds[0].image;
|
||||
}
|
||||
|
||||
embed.fields = [{ name: EMPTY_CHAR, value: `[Jump to message](${messageLink(msg)})` }];
|
||||
|
||||
const starboardMessage = await (channel as TextChannel).createMessage({ embed });
|
||||
await this.starboardMessages.createStarboardMessage(channel.id, msg.id, starboardMessage.id);
|
||||
}
|
||||
|
|
|
@ -49,6 +49,8 @@ export const HOURS = 60 * MINUTES;
|
|||
export const DAYS = 24 * HOURS;
|
||||
export const WEEKS = 7 * 24 * HOURS;
|
||||
|
||||
export const EMPTY_CHAR = "\u200b";
|
||||
|
||||
export function tNullable<T extends t.Type<any, any>>(type: T) {
|
||||
return t.union([type, t.undefined, t.null], `Nullable<${type.name}>`);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue