mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-14 05:50:47 +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
|
|
@ -127,6 +127,10 @@ export function normalizeSlackEvent(payload, botUserId, {
|
|||
? event.files.map((file) => slackFileSource(file, loadFileStream, loadFileInfo)).filter(Boolean)
|
||||
: [],
|
||||
addressed: direct || mentioned,
|
||||
reactionTarget: {
|
||||
channelId: String(event.channel),
|
||||
messageTs: String(event.ts),
|
||||
},
|
||||
replyTarget: {
|
||||
channelId: String(event.channel),
|
||||
threadTs,
|
||||
|
|
@ -284,6 +288,26 @@ export class SlackBotClient {
|
|||
return { providerMessageIds };
|
||||
}
|
||||
|
||||
async addReaction(target, emoji, { signal } = {}) {
|
||||
const reactionKey = String(emoji ?? '').trim();
|
||||
await this.#api.addReaction({
|
||||
channelId: target.channelId,
|
||||
messageTs: target.messageTs,
|
||||
emojiName: reactionKey,
|
||||
signal: signal ?? this.#signal,
|
||||
});
|
||||
return reactionKey;
|
||||
}
|
||||
|
||||
removeReaction(target, reactionKey, { signal } = {}) {
|
||||
return this.#api.removeReaction({
|
||||
channelId: target.channelId,
|
||||
messageTs: target.messageTs,
|
||||
emojiName: reactionKey,
|
||||
signal: signal ?? this.#signal,
|
||||
});
|
||||
}
|
||||
|
||||
openStream(target) {
|
||||
return createSlackMessageStream({
|
||||
api: this.#api,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue