starboard: add star count to embed, update automatically
This commit is contained in:
parent
5ec33848b4
commit
9883610a3b
6 changed files with 155 additions and 77 deletions
|
@ -0,0 +1,27 @@
|
|||
import { EmbedField, EmojiOptions, GuildChannel, Message } from "eris";
|
||||
import { EMPTY_CHAR, messageLink } from "../../../utils";
|
||||
import { TStarboardOpts } from "../types";
|
||||
|
||||
export function createStarboardPseudoFooterForMessage(
|
||||
starboard: TStarboardOpts,
|
||||
msg: Message,
|
||||
starEmoji: string,
|
||||
starCount: number,
|
||||
): EmbedField {
|
||||
const jumpLink = `[Jump to message](${messageLink(msg)})`;
|
||||
|
||||
let content;
|
||||
if (starboard.show_star_count) {
|
||||
content =
|
||||
starCount > 1
|
||||
? `${starEmoji} **${starCount}** \u200B \u200B \u200B ${jumpLink}`
|
||||
: `${starEmoji} \u200B ${jumpLink}`;
|
||||
} else {
|
||||
content = jumpLink;
|
||||
}
|
||||
|
||||
return {
|
||||
name: EMPTY_CHAR,
|
||||
value: content,
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue