mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 14:11:50 +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),
|
copy_full_embed: tNullable(t.boolean),
|
||||||
enabled: tNullable(t.boolean),
|
enabled: tNullable(t.boolean),
|
||||||
show_star_count: t.boolean,
|
show_star_count: t.boolean,
|
||||||
color: t.number,
|
color: tNullable(t.number),
|
||||||
});
|
});
|
||||||
export type TStarboardOpts = t.TypeOf<typeof StarboardOpts>;
|
export type TStarboardOpts = t.TypeOf<typeof StarboardOpts>;
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ export const defaultStarboardOpts: Partial<TStarboardOpts> = {
|
||||||
star_emoji: ["⭐"],
|
star_emoji: ["⭐"],
|
||||||
enabled: true,
|
enabled: true,
|
||||||
show_star_count: true,
|
show_star_count: true,
|
||||||
color: 0,
|
color: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface StarboardPluginType extends BasePluginType {
|
export interface StarboardPluginType extends BasePluginType {
|
||||||
|
|
|
@ -8,7 +8,11 @@ const videoAttachmentExtensions = ["mp4", "mkv", "mov"];
|
||||||
|
|
||||||
type StarboardEmbed = EmbedWith<"footer" | "author" | "fields" | "timestamp">;
|
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 = {
|
const embed: StarboardEmbed = {
|
||||||
footer: {
|
footer: {
|
||||||
text: `#${(msg.channel as GuildChannel).name}`,
|
text: `#${(msg.channel as GuildChannel).name}`,
|
||||||
|
@ -18,9 +22,12 @@ export function createStarboardEmbedFromMessage(msg: Message, copyFullEmbed: boo
|
||||||
},
|
},
|
||||||
fields: [],
|
fields: [],
|
||||||
timestamp: new Date(msg.timestamp).toISOString(),
|
timestamp: new Date(msg.timestamp).toISOString(),
|
||||||
color,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (color != null) {
|
||||||
|
embed.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
if (msg.author.avatarURL) {
|
if (msg.author.avatarURL) {
|
||||||
embed.author.icon_url = msg.author.avatarURL;
|
embed.author.icon_url = msg.author.avatarURL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue