mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-20 08:50:52 +08:00
feat: add status reactions across messaging channels
This commit is contained in:
parent
aa8fd71b93
commit
da01e3acee
30 changed files with 1853 additions and 274 deletions
|
|
@ -231,6 +231,10 @@ export function normalizeDiscordMessage(message, botId, { fetchImpl = fetch } =
|
|||
channelId: String(message.channel_id),
|
||||
replyToMessageId: String(message.id),
|
||||
},
|
||||
reactionTarget: {
|
||||
channelId: String(message.channel_id),
|
||||
messageId: String(message.id),
|
||||
},
|
||||
connectionTestTarget: { channelId: String(message.channel_id) },
|
||||
};
|
||||
}
|
||||
|
|
@ -350,6 +354,24 @@ export class DiscordBotClient {
|
|||
});
|
||||
}
|
||||
|
||||
addReaction(target, emoji, { signal } = {}) {
|
||||
return this.#api.addOwnReaction({
|
||||
channelId: target.channelId,
|
||||
messageId: target.messageId,
|
||||
emoji,
|
||||
signal: this.#operationSignal(signal),
|
||||
});
|
||||
}
|
||||
|
||||
removeReaction(target, reactionKey, { signal } = {}) {
|
||||
return this.#api.removeOwnReaction({
|
||||
channelId: target.channelId,
|
||||
messageId: target.messageId,
|
||||
emoji: reactionKey,
|
||||
signal: this.#operationSignal(signal),
|
||||
});
|
||||
}
|
||||
|
||||
async openStream(target) {
|
||||
const notice = !this.#deliveredNotices.has(target) && target?.notice
|
||||
? String(target.notice) : null;
|
||||
|
|
@ -381,6 +403,10 @@ export class DiscordBotClient {
|
|||
});
|
||||
return stream.start();
|
||||
}
|
||||
|
||||
#operationSignal(signal) {
|
||||
return signal ?? this.#signal;
|
||||
}
|
||||
}
|
||||
|
||||
export function createDiscordRuntimeStatus() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue