Skip to content

Commit

Permalink
feat(bolt-matrix): deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
austinhuang0131 committed Feb 4, 2024
1 parent 3bf7ac6 commit 8d6dc72
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions packages/bolt-matrix/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,13 @@ export default class MatrixPlugin extends BoltPlugin {
return channelId;
}
async bridgeMessage(data: BoltBridgeMessageArgs) {
const intent = this.bot.getIntent(
`@${data.data.platform.name}_${
'author' in data.data ? data.data.author.id : 'deletion'
}:${this.config.domain}`
);
const room = data.data.bridgePlatform.senddata as string;
switch (data.type) {
case 'create':
case 'update': {
const intent = this.bot.getIntent(
`@${data.data.platform.name}_${data.data.author.id}:${this.config.domain}`
);
const message = coreToMessage(
data.data as unknown as BoltMessage<unknown>
);
Expand All @@ -94,15 +92,13 @@ export default class MatrixPlugin extends BoltPlugin {
};
}
case 'delete': {
await intent.sendEvent(room, 'm.room.redaction', {
content: {
reason: 'bridge message deletion'
},
redacts: data.data.id
});
const intent = this.bot.getIntent();
await intent.botSdkIntent.underlyingClient.redactEvent(
room, data.data.id, 'bridge message deletion'
);
return {
channel: room,
id: data.data.id,
id: data.data.id,
plugin: 'bolt-matrix',
senddata: room
};
Expand Down

0 comments on commit 8d6dc72

Please sign in to comment.