DiscordNotifications
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:273
The Discord implementation of the notifications capability: sends messages through webhooks and provisions the server’s channels, roles and webhooks with the bot.
Implements
Section titled “Implements”Notifications
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new DiscordNotifications(
client,opts,defaultWebhookUrl,bot?,oauth?,fetchImage?):DiscordNotifications
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:279
Parameters
Section titled “Parameters”client
Section titled “client”webhooks
Section titled “webhooks”{ deleteMessage: (id, token, messageId) => Promise<void>; editMessage: (id, token, messageId, body) => Promise<void>; execute: (id, token, content) => Promise<void>; executeAndWait: (id, token, content, options?) => Promise<{ channel_id: string; id: string; }>; get: (id, token) => Promise<DiscordWebhookInfo>; }
webhooks.deleteMessage
Section titled “webhooks.deleteMessage”(id, token, messageId) => Promise<void>
webhooks.editMessage
Section titled “webhooks.editMessage”(id, token, messageId, body) => Promise<void>
webhooks.execute
Section titled “webhooks.execute”(id, token, content) => Promise<void>
webhooks.executeAndWait
Section titled “webhooks.executeAndWait”(id, token, content, options?) => Promise<{ channel_id: string; id: string; }>
webhooks.get
Section titled “webhooks.get”(id, token) => Promise<DiscordWebhookInfo>
defaultWebhookUrl
Section titled “defaultWebhookUrl”() => string
Memoized thunk — resolves the default webhook URL on the first send().
() => object
Memoized thunk — resolves the bot token on first provisioning call, never on send().
oauth?
Section titled “oauth?”(redirectUri) => Promise<{ authorizeUrl: (input) => string; connections: (accessToken) => Promise<DiscordConnection[]>; exchangeCode: (code) => Promise<DiscordOAuthToken>; refresh: (refreshToken) => Promise<DiscordOAuthToken>; revoke: (token) => Promise<void>; user: (accessToken) => Promise<DiscordOAuthUser>; }>
Builds the OAuth client for one redirect URI; needs the application’s client secret.
fetchImage?
Section titled “fetchImage?”(url) => Promise<Uint8Array<ArrayBufferLike>>
Reads the bytes at a public URL (an emoji on Discord’s CDN). Tests pass their own.
Returns
Section titled “Returns”DiscordNotifications
Properties
Section titled “Properties”
readonlykey:"notifications"
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:275
The capability this class provides, always "notifications".
Implementation of
Section titled “Implementation of”Notifications.key
providerName
Section titled “providerName”
readonlyproviderName:"discord"="discord"
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:277
The provider name, "discord".
Implementation of
Section titled “Implementation of”Notifications.providerName
Accessors
Section titled “Accessors”layout
Section titled “layout”Get Signature
Section titled “Get Signature”get layout():
NotificationsLayout|undefined
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:326
The server layout the owner declared for this provider, if any. Read by
holocron setup notifications; the provider just carries it from its options.
Returns
Section titled “Returns”NotificationsLayout | undefined
Implementation of
Section titled “Implementation of”Notifications.layout
Methods
Section titled “Methods”addRoleMember()
Section titled “addRoleMember()”addRoleMember(
roleName,memberId):Promise<void>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:2860
Give a member the role; one who has it already is left alone.
Parameters
Section titled “Parameters”roleName
Section titled “roleName”string
memberId
Section titled “memberId”string
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”Notifications.addRoleMember
checkDelivery()
Section titled “checkDelivery()”checkDelivery(
input):Promise<NotificationsDelivery>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:2653
Proves a channel’s webhook delivers: posts text through it, reads the post back from the channel and
removes it again, unless keep is true, in which case the post is left in the channel (and the result
has kept instead of removed). Never throws for a failed step; the result says which one failed.
Posts a visible message, so callers choose the channel with care.
Parameters
Section titled “Parameters”category?
Section titled “category?”string
channel
Section titled “channel”string
boolean
string
string
Returns
Section titled “Returns”Promise<NotificationsDelivery>
Implementation of
Section titled “Implementation of”Notifications.checkDelivery
checkEmoji()
Section titled “checkEmoji()”checkEmoji(
input):Promise<EmojiCheck>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:2529
Whether the server emoji with this name shows image. Discord returns no hash of an emoji’s picture, so the copy
on its CDN (cdn.discordapp.com/emojis/<id>.png, the lossless size of the upload) is read and both pictures are
decoded and compared pixel by pixel with a small tolerance, which also absorbs Discord re-encoding the upload.
Read-only. Anything that stops the comparison (the layout’s image is not a PNG, the CDN does not answer, a
picture that cannot be decoded) is unknown with the reason, never different.
Parameters
Section titled “Parameters”string
string
Returns
Section titled “Returns”Promise<EmojiCheck>
Implementation of
Section titled “Implementation of”Notifications.checkEmoji
createServer()
Section titled “createServer()”createServer(
input):Promise<{id:string;name:string; }>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:2756
Creates the server the layout describes, empty, owned by the provider’s own bot, and makes it the server
every other call in this run works on. Refuses when the config already names a server unless force.
Parameters
Section titled “Parameters”force?
Section titled “force?”boolean
string
Returns
Section titled “Returns”Promise<{ id: string; name: string; }>
Implementation of
Section titled “Implementation of”Notifications.createServer
dedupeDiscussion()
Section titled “dedupeDiscussion()”dedupeDiscussion(
channel,key,opts?):Promise<number>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:1324
Keeps the oldest post for key and deletes the others; returns how many it deleted. refresh reads the forum again first.
Parameters
Section titled “Parameters”channel
Section titled “channel”string
string
refresh?
Section titled “refresh?”boolean
Returns
Section titled “Returns”Promise<number>
Implementation of
Section titled “Implementation of”Notifications.dedupeDiscussion
deleteDiscussion()
Section titled “deleteDiscussion()”deleteDiscussion(
channel,key):Promise<boolean>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:1339
Deletes a discussion post unless a person has written in it; returns whether it did.
Parameters
Section titled “Parameters”channel
Section titled “channel”string
string
Returns
Section titled “Returns”Promise<boolean>
Implementation of
Section titled “Implementation of”Notifications.deleteDiscussion
deleteWebhook()
Section titled “deleteWebhook()”deleteWebhook(
id):Promise<void>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:2649
Deletes a webhook by id (a 404 counts as done); used to undo one this run created.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”Notifications.deleteWebhook
duplicateDiscussions()
Section titled “duplicateDiscussions()”duplicateDiscussions(
channel):Promise<DuplicateDiscussion[]>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:1329
The keys with more than one post in a forum, with how many are beyond the oldest. Deletes nothing.
Parameters
Section titled “Parameters”channel
Section titled “channel”string
Returns
Section titled “Returns”Promise<DuplicateDiscussion[]>
Implementation of
Section titled “Implementation of”Notifications.duplicateDiscussions
ensureApplication()
Section titled “ensureApplication()”ensureApplication(
app):Promise<{todo?:string[];updated:string[]; }>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:1814
Bring the bot’s application settings in line with the layout, changing only what differs. Returns what it changed.
Parameters
Section titled “Parameters”NotificationsApplicationLayout
Returns
Section titled “Returns”Promise<{ todo?: string[]; updated: string[]; }>
Implementation of
Section titled “Implementation of”Notifications.ensureApplication
ensureCategory()
Section titled “ensureCategory()”ensureCategory(
name,opts?):Promise<EnsuredResource>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:2216
Provisioning. All optional, all idempotent (look up by name, create only what is missing), and all need provider credentials beyond the posting URL — so a provider that only posts simply omits them.
Parameters
Section titled “Parameters”string
access?
Section titled “access?”NotificationsAccess
Returns
Section titled “Returns”Promise<EnsuredResource>
Implementation of
Section titled “Implementation of”Notifications.ensureCategory
ensureChannel()
Section titled “ensureChannel()”ensureChannel(
input):Promise<EnsuredResource>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:2376
Finds the text or announcement channel with this name (under the category, when given), or creates it; reports
whether it was created. With kind: "forum" it is a forum channel with the layout’s tags. Discord cannot turn one
kind into the other and this never deletes, so a channel of the other kind with the name stops the run with the fix.
Parameters
Section titled “Parameters”access?
Section titled “access?”NotificationsAccess
autoArchiveMinutes?
Section titled “autoArchiveMinutes?”number
category?
Section titled “category?”string
defaultReaction?
Section titled “defaultReaction?”NotificationsReaction
"text" | "forum"
string
NotificationsForumTag[]
topic?
Section titled “topic?”string
Returns
Section titled “Returns”Promise<EnsuredResource>
Implementation of
Section titled “Implementation of”Notifications.ensureChannel
ensureDiscussion()
Section titled “ensureDiscussion()”ensureDiscussion(
input):Promise<EnsuredDiscussion>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:1299
Finds the post for a document in a forum channel, or makes it. See DiscordDiscussions.
Parameters
Section titled “Parameters”EnsureDiscussionInput
Returns
Section titled “Returns”Promise<EnsuredDiscussion>
Implementation of
Section titled “Implementation of”Notifications.ensureDiscussion
ensureEmoji()
Section titled “ensureEmoji()”ensureEmoji(
input):Promise<EnsuredResource>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:2473
Finds the server emoji with this name or makes it from image (a data: URI). One that exists is left exactly as it
is (not replaced, renamed or deleted, and the image is not compared with it) unless replace is set, which setup
does only for an emoji DiscordNotifications.checkEmoji found different. Making one
needs Create Guild Expressions; without it the error says so and carries the link that invites the bot again asking
for it.
With replace, Discord has no way to change an emoji’s image, so a new one is made. Names are unique per server, so
the new emoji is made first under a temporary name (<name>_new), the old one deleted, and the new one renamed: a
failure before the delete leaves the old emoji as it was (the new one is removed again), and one after it leaves the
new emoji under the temporary name, which the error gives. The new emoji has a new id, so the caller must read ids
again (forum default reactions and starter reactions are looked up by name each time, so setup’s channel step
does). Reactions made with the old emoji disappear with it. Deleting an emoji the bot did not make needs Manage
Guild Expressions; a 403 says so with the invite link.
Parameters
Section titled “Parameters”string
string
replace?
Section titled “replace?”boolean
Returns
Section titled “Returns”Promise<EnsuredResource>
Implementation of
Section titled “Implementation of”Notifications.ensureEmoji
ensureEveryone()
Section titled “ensureEveryone()”ensureEveryone(
everyone):Promise<{updated:string[]; }>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:1792
Grant or take away the named permissions from everyone, changing only what differs. Returns what it changed.
Parameters
Section titled “Parameters”everyone
Section titled “everyone”NotificationsEveryoneLayout
Returns
Section titled “Returns”Promise<{ updated: string[]; }>
Implementation of
Section titled “Implementation of”Notifications.ensureEveryone
ensureOnboarding()
Section titled “ensureOnboarding()”ensureOnboarding(
onboarding):Promise<{updated:string[]; }>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:1711
Bring onboarding in line with the layout, changing only what differs. Returns what it changed.
Parameters
Section titled “Parameters”onboarding
Section titled “onboarding”NotificationsOnboardingLayout
Returns
Section titled “Returns”Promise<{ updated: string[]; }>
Implementation of
Section titled “Implementation of”Notifications.ensureOnboarding
ensurePinned()
Section titled “ensurePinned()”ensurePinned(
pinned):Promise<{updated:string[]; }>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:1498
Post and pin the layout’s messages, replacing any that differ. Returns the channels it changed.
Parameters
Section titled “Parameters”pinned
Section titled “pinned”NotificationsPinnedLayout[]
Returns
Section titled “Returns”Promise<{ updated: string[]; }>
Implementation of
Section titled “Implementation of”Notifications.ensurePinned
ensureRole()
Section titled “ensureRole()”ensureRole(
input):Promise<EnsuredResource>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:2869
Finds the role with this name, or creates it with the given mentionable, color, hoist and permissions settings; reports whether it was created.
Parameters
Section titled “Parameters”color?
Section titled “color?”string
hoist?
Section titled “hoist?”boolean
mentionable?
Section titled “mentionable?”boolean
string
permissions?
Section titled “permissions?”string[]
Returns
Section titled “Returns”Promise<EnsuredResource>
Implementation of
Section titled “Implementation of”Notifications.ensureRole
ensureServer()
Section titled “ensureServer()”ensureServer(
settings):Promise<{updated:string[]; }>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:888
Bring the server’s own settings in line with the layout, changing only what differs. Returns the names of what it changed, empty when the server already matched.
Parameters
Section titled “Parameters”settings
Section titled “settings”NotificationsServerLayout
Returns
Section titled “Returns”Promise<{ updated: string[]; }>
Implementation of
Section titled “Implementation of”Notifications.ensureServer
ensureWebhook()
Section titled “ensureWebhook()”ensureWebhook(
input):Promise<EnsureWebhookResult>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:2611
Finds the webhook with this name on the channel, or creates it; the optional avatar is the picture it posts with.
Parameters
Section titled “Parameters”avatar?
Section titled “avatar?”string
category?
Section titled “category?”string
channel
Section titled “channel”string
string
Returns
Section titled “Returns”Promise<EnsureWebhookResult>
Implementation of
Section titled “Implementation of”Notifications.ensureWebhook
ensureWelcome()
Section titled “ensureWelcome()”ensureWelcome(
welcome):Promise<{updated:string[]; }>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:1612
Bring the welcome screen in line with the layout, changing only what differs. Returns what it changed.
Parameters
Section titled “Parameters”welcome
Section titled “welcome”NotificationsWelcomeLayout
Returns
Section titled “Returns”Promise<{ updated: string[]; }>
Implementation of
Section titled “Implementation of”Notifications.ensureWelcome
findMessage()
Section titled “findMessage()”findMessage(
channel,marker):Promise<NotificationsPostedMessage|undefined>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:380
The newest message whose text contains marker among the last 1,000 of the named channel (read a page of 100 at
a time), with the thread started on it. Read with the bot (a webhook cannot read), so it needs the bot token and the server id.
Parameters
Section titled “Parameters”channel
Section titled “channel”string
marker
Section titled “marker”string
Returns
Section titled “Returns”Promise<NotificationsPostedMessage | undefined>
Implementation of
Section titled “Implementation of”Notifications.findMessage
hasMember()
Section titled “hasMember()”hasMember(
memberId):Promise<boolean>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:2801
Whether a person is in the server.
Parameters
Section titled “Parameters”memberId
Section titled “memberId”string
Returns
Section titled “Returns”Promise<boolean>
Implementation of
Section titled “Implementation of”Notifications.hasMember
hideLinkPreviews()
Section titled “hideLinkPreviews()”hideLinkPreviews(
input):Promise<HideLinkPreviewsResult>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:1369
Hides the link-preview cards under the newest messages of a text channel by setting Suppress Embeds on each one
(see previewAction for which). Who may edit a message depends on who wrote it: a webhook’s message is edited
through that webhook (Discord refuses a bot any edit of another author’s message, 50005, whatever its permissions),
which works only for a webhook this application made (the channel’s webhooks are read once; one made by another app
is counted in foreign and left alone), and a message written by a person or by the bot itself is edited by the
bot, which needs Manage Messages for a person’s (a 403 of that kind ends the channel’s run with the permission named
and an invite link that carries it; any other 403 is reported in Discord’s own words). A 429 ends the run with the
count left, a message that is gone (404 through its webhook) is counted in gone. Edits go one at a time through the
client, which waits out a short rate limit itself. Reads pages of at most 100, never more than the limit.
Parameters
Section titled “Parameters”HideLinkPreviewsInput
Returns
Section titled “Returns”Promise<HideLinkPreviewsResult>
Implementation of
Section titled “Implementation of”Notifications.hideLinkPreviews
holdsPermission()
Section titled “holdsPermission()”holdsPermission(
permission):Promise<boolean>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:1082
Whether the bot holds the permission right now (the owner holds every one). Used to prove an elevation was taken back.
Parameters
Section titled “Parameters”permission
Section titled “permission”string
Returns
Section titled “Returns”Promise<boolean>
Implementation of
Section titled “Implementation of”Notifications.holdsPermission
inspect()
Section titled “inspect()”inspect(
layout):Promise<ServerInspection>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:452
Read-only: what is on the server, for the parts of layout we will compare. Webhooks are
listed only for channels the layout gives one (one request each), so the cost scales with
the layout, not with the server.
Parameters
Section titled “Parameters”layout
Section titled “layout”NotificationsLayout
Returns
Section titled “Returns”Promise<ServerInspection>
Implementation of
Section titled “Implementation of”Notifications.inspect
inviteLink()
Section titled “inviteLink()”inviteLink(
channelName):Promise<string>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:2789
A single-use link, valid for a day, that lets one person join the server through the named channel.
Parameters
Section titled “Parameters”channelName
Section titled “channelName”string
Returns
Section titled “Returns”Promise<string>
Implementation of
Section titled “Implementation of”Notifications.inviteLink
listDiscussions()
Section titled “listDiscussions()”listDiscussions(
channel):Promise<DiscussionPost[]>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:1334
Every discussion post of a forum, read afresh.
Parameters
Section titled “Parameters”channel
Section titled “channel”string
Returns
Section titled “Returns”Promise<DiscussionPost[]>
Implementation of
Section titled “Implementation of”Notifications.listDiscussions
postDiscussionMessage()
Section titled “postDiscussionMessage()”postDiscussionMessage(
channel,key,content,opts?):Promise<void>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:1314
Appends a message to a document’s post, reopening and closing it again if it was closed.
Parameters
Section titled “Parameters”channel
Section titled “channel”string
string
content
Section titled “content”string
quiet?
Section titled “quiet?”boolean
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”Notifications.postDiscussionMessage
postMessage()
Section titled “postMessage()”postMessage(
channel,content):Promise<void>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:1347
Posts content (up to 2000 characters) in a text channel as the bot, without letting it mention anyone. A #name
that is one of the server’s channels is linked.
Parameters
Section titled “Parameters”channel
Section titled “channel”string
content
Section titled “content”string
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”Notifications.postMessage
postToThread()
Section titled “postToThread()”postToThread(
threadId,lines):Promise<void>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:415
Posts lines in a thread as the bot, packed into messages under 2,000 characters without splitting a line. Embeds
are suppressed: a thread of links (a release’s packages, each linking to npm) would otherwise unfurl every one of
them into a preview card.
Parameters
Section titled “Parameters”threadId
Section titled “threadId”string
string[]
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”Notifications.postToThread
preflight()
Section titled “preflight()”preflight(
layout):Promise<void>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:758
Changing server settings needs Manage Server; an empty edit proves the bot has it without changing anything.
Parameters
Section titled “Parameters”layout
Section titled “layout”NotificationsLayout
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”Notifications.preflight
readDiscussion()
Section titled “readDiscussion()”readDiscussion(
channel,key,url?):Promise<DiscussionPost|undefined>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:1304
The post for a document in a forum channel, or undefined.
Parameters
Section titled “Parameters”channel
Section titled “channel”string
string
string
Returns
Section titled “Returns”Promise<DiscussionPost | undefined>
Implementation of
Section titled “Implementation of”Notifications.readDiscussion
readDiscussionMessages()
Section titled “readDiscussionMessages()”readDiscussionMessages(
channel,key,limit?):Promise<string[]>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:1319
The text of a post’s recent messages, newest first.
Parameters
Section titled “Parameters”channel
Section titled “channel”string
string
limit?
Section titled “limit?”number
Returns
Section titled “Returns”Promise<string[]>
Implementation of
Section titled “Implementation of”Notifications.readDiscussionMessages
readThread()
Section titled “readThread()”readThread(
threadId):Promise<string[]>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:422
The text of every message in a thread, oldest first.
Parameters
Section titled “Parameters”threadId
Section titled “threadId”string
Returns
Section titled “Returns”Promise<string[]>
Implementation of
Section titled “Implementation of”Notifications.readThread
removeRoleMember()
Section titled “removeRoleMember()”removeRoleMember(
roleName,memberId):Promise<void>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:2864
Take the role from a member; one who lacks it is left alone.
Parameters
Section titled “Parameters”roleName
Section titled “roleName”string
memberId
Section titled “memberId”string
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”Notifications.removeRoleMember
roleMembers()
Section titled “roleMembers()”roleMembers(
roleName):Promise<NotificationsMember[]>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:2842
Who holds a role, by the provider’s member id. Needs whatever permission the provider asks for to list members (for Discord, the privileged Server Members Intent). Throws if the role does not exist.
Parameters
Section titled “Parameters”roleName
Section titled “roleName”string
Returns
Section titled “Returns”Promise<NotificationsMember[]>
Implementation of
Section titled “Implementation of”Notifications.roleMembers
send()
Section titled “send()”send(
channel,message):Promise<void>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:330
Send a message. channel is provider-specific (Slack channel id,
Discord webhook url-name, etc.); adapters resolve from config.
Parameters
Section titled “Parameters”channel
Section titled “channel”string
message
Section titled “message”string
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”Notifications.send
sendWithId()
Section titled “sendWithId()”sendWithId(
channel,message,options?):Promise<NotificationsPostedMessage>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:344
Like send, but waits for Discord (?wait=true) and returns the message, so a thread can be started on it.
It posts through the channel’s webhook, resolved as send does. When no webhook can be found for it (no alias, no
URL, no defaultChannel and no default webhook: the AuthError the default webhook throws), it posts as the bot in
the server’s channel of that name instead, which is what a machine without the channel’s webhook (a GitHub secret
cannot be read back) has. Any other failure is not caught. The message carries the suppress-embeds flag unless
options.suppressEmbeds is false.
Parameters
Section titled “Parameters”channel
Section titled “channel”string
message
Section titled “message”string
options?
Section titled “options?”NotificationsSendOptions
Returns
Section titled “Returns”Promise<NotificationsPostedMessage>
Implementation of
Section titled “Implementation of”Notifications.sendWithId
serverOwner()
Section titled “serverOwner()”serverOwner():
Promise<{id:string;isBot:boolean;name?:string; }>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:2816
Who owns the server, and whether that is the provider’s own bot.
Returns
Section titled “Returns”Promise<{ id: string; isBot: boolean; name?: string; }>
Implementation of
Section titled “Implementation of”Notifications.serverOwner
signIn()
Section titled “signIn()”signIn():
NotificationsSignIn
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:301
Sign a member in with Discord to learn which GitHub account they own. Asks only for identify and
connections, reads the account Discord has verified, and revokes the token before returning: nothing
about the sign-in is kept.
Returns
Section titled “Returns”NotificationsSignIn
Implementation of
Section titled “Implementation of”Notifications.signIn
startThread()
Section titled “startThread()”startThread(
message,name):Promise<{id:string; }>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:403
Starts a public thread on a message, as the bot. A 403 says the bot needs Create Public Threads in the channel.
Parameters
Section titled “Parameters”message
Section titled “message”NotificationsPostedMessage
string
Returns
Section titled “Returns”Promise<{ id: string; }>
Implementation of
Section titled “Implementation of”Notifications.startThread
transferServer()
Section titled “transferServer()”transferServer(
memberId):Promise<void>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:2812
Hands the server to a member who has joined, so the bot no longer owns it.
Parameters
Section titled “Parameters”memberId
Section titled “memberId”string
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”Notifications.transferServer
updateDiscussion()
Section titled “updateDiscussion()”updateDiscussion(
channel,key,patch):Promise<void>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:1309
Changes a document’s post: its title, its tag, the state last synced, the pull request line.
Parameters
Section titled “Parameters”channel
Section titled “channel”string
string
DiscussionPatch
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”Notifications.updateDiscussion
validateLayout()
Section titled “validateLayout()”validateLayout(
layout):string|undefined
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:1941
Check the provider-specific parts of the layout (colours, permission names, …) without
touching the server, so setup can refuse a bad layout before it creates anything.
Returns the first problem, or undefined when the layout is fine.
Parameters
Section titled “Parameters”layout
Section titled “layout”NotificationsLayout
Returns
Section titled “Returns”string | undefined
Implementation of
Section titled “Implementation of”Notifications.validateLayout
whoami()
Section titled “whoami()”whoami():
Promise<{target:string; } |null>
Defined in: plugins/holocron-plugin-discord/src/capabilities/notifications.ts:432
holocron doctor: the bot token is valid and can see the configured server.
Null when no guildId is set – a post-only config has no bot to check. A
layout without a guildId is a half-written provisioning config, so that
fails instead of passing as post-only.
Returns
Section titled “Returns”Promise<{ target: string; } | null>
Implementation of
Section titled “Implementation of”Notifications.whoami