mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 14:11:50 +00:00
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,
|
tNullable,
|
||||||
tDeepPartial,
|
tDeepPartial,
|
||||||
UnknownUser,
|
UnknownUser,
|
||||||
|
EMPTY_CHAR,
|
||||||
} from "../utils";
|
} from "../utils";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
|
@ -247,12 +248,12 @@ export class StarboardPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
|
|
||||||
const embed: EmbedBase = {
|
const embed: EmbedBase = {
|
||||||
footer: {
|
footer: {
|
||||||
text: `#${(msg.channel as GuildChannel).name} - ${time}`,
|
text: `#${(msg.channel as GuildChannel).name}`,
|
||||||
},
|
},
|
||||||
author: {
|
author: {
|
||||||
name: `${msg.author.username}#${msg.author.discriminator}`,
|
name: `${msg.author.username}#${msg.author.discriminator}`,
|
||||||
},
|
},
|
||||||
url: messageLink(msg),
|
timestamp: new Date(msg.timestamp).toISOString(),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (msg.author.avatarURL) {
|
if (msg.author.avatarURL) {
|
||||||
|
@ -280,6 +281,8 @@ export class StarboardPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
embed.image = msg.embeds[0].image;
|
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 });
|
const starboardMessage = await (channel as TextChannel).createMessage({ embed });
|
||||||
await this.starboardMessages.createStarboardMessage(channel.id, msg.id, starboardMessage.id);
|
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 DAYS = 24 * HOURS;
|
||||||
export const WEEKS = 7 * 24 * HOURS;
|
export const WEEKS = 7 * 24 * HOURS;
|
||||||
|
|
||||||
|
export const EMPTY_CHAR = "\u200b";
|
||||||
|
|
||||||
export function tNullable<T extends t.Type<any, any>>(type: T) {
|
export function tNullable<T extends t.Type<any, any>>(type: T) {
|
||||||
return t.union([type, t.undefined, t.null], `Nullable<${type.name}>`);
|
return t.union([type, t.undefined, t.null], `Nullable<${type.name}>`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue