generated from nhcarrigan/template
feat: helper to generate proper syntax for everyone ping
This commit is contained in:
@@ -12,15 +12,15 @@ const channelIds: Record<AnnouncementType, string> = {
|
|||||||
company: "1422472775695728661",
|
company: "1422472775695728661",
|
||||||
products: "1386105452881776661",
|
products: "1386105452881776661",
|
||||||
};
|
};
|
||||||
const roleIds: Record<AnnouncementType, string> = {
|
const roleIds: Record<Exclude<AnnouncementType, "company">, string> = {
|
||||||
community: "1386107941224054895",
|
community: "1386107941224054895",
|
||||||
|
products: "1386107909699666121",
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
const getAnnouncementPing = (type: AnnouncementType): string => {
|
||||||
* Note that this is not a role ID, but the server ID.
|
return type === "company"
|
||||||
* Company announcements ping everyone.
|
? "@everyone"
|
||||||
*/
|
: `<@&${roleIds[type]}>`;
|
||||||
company: "1354624415861833870",
|
|
||||||
products: "1386107909699666121",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,7 +40,7 @@ export const announceOnDiscord = async(
|
|||||||
{
|
{
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
allowed_mentions: { parse: [ "users", "roles" ] },
|
allowed_mentions: { parse: [ "users", "roles" ] },
|
||||||
content: `# ${title}\n\n${content}\n-# <@&${roleIds[type]}>`,
|
content: `# ${title}\n\n${content}\n-# ${getAnnouncementPing(type)}`,
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
"Authorization": `Bot ${process.env.DISCORD_TOKEN ?? ""}`,
|
"Authorization": `Bot ${process.env.DISCORD_TOKEN ?? ""}`,
|
||||||
|
|||||||
Reference in New Issue
Block a user