mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
starboard: use default embed color by default instead of black
This commit is contained in:
parent
5e77976dec
commit
5f3c94d064
2 changed files with 11 additions and 4 deletions
|
@ -12,7 +12,7 @@ const StarboardOpts = t.type({
|
|||
copy_full_embed: tNullable(t.boolean),
|
||||
enabled: tNullable(t.boolean),
|
||||
show_star_count: t.boolean,
|
||||
color: t.number,
|
||||
color: tNullable(t.number),
|
||||
});
|
||||
export type TStarboardOpts = t.TypeOf<typeof StarboardOpts>;
|
||||
|
||||
|
@ -28,7 +28,7 @@ export const defaultStarboardOpts: Partial<TStarboardOpts> = {
|
|||
star_emoji: ["⭐"],
|
||||
enabled: true,
|
||||
show_star_count: true,
|
||||
color: 0,
|
||||
color: null,
|
||||
};
|
||||
|
||||
export interface StarboardPluginType extends BasePluginType {
|
||||
|
|
|
@ -8,7 +8,11 @@ const videoAttachmentExtensions = ["mp4", "mkv", "mov"];
|
|||
|
||||
type StarboardEmbed = EmbedWith<"footer" | "author" | "fields" | "timestamp">;
|
||||
|
||||
export function createStarboardEmbedFromMessage(msg: Message, copyFullEmbed: boolean, color: number): StarboardEmbed {
|
||||
export function createStarboardEmbedFromMessage(
|
||||
msg: Message,
|
||||
copyFullEmbed: boolean,
|
||||
color?: number | null,
|
||||
): StarboardEmbed {
|
||||
const embed: StarboardEmbed = {
|
||||
footer: {
|
||||
text: `#${(msg.channel as GuildChannel).name}`,
|
||||
|
@ -18,9 +22,12 @@ export function createStarboardEmbedFromMessage(msg: Message, copyFullEmbed: boo
|
|||
},
|
||||
fields: [],
|
||||
timestamp: new Date(msg.timestamp).toISOString(),
|
||||
color,
|
||||
};
|
||||
|
||||
if (color != null) {
|
||||
embed.color = color;
|
||||
}
|
||||
|
||||
if (msg.author.avatarURL) {
|
||||
embed.author.icon_url = msg.author.avatarURL;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue