@devchitchat/chat 4.3.0 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devchitchat/chat",
3
- "version": "4.3.0",
3
+ "version": "4.3.1",
4
4
  "description": "A small chat app. p2p video and screenshare.",
5
5
  "scripts": {
6
6
  "dev": "bun --watch index.js",
@@ -145,8 +145,15 @@ export function handleAdminBotTokenRevoke(ws, msg, ctx) {
145
145
  }
146
146
 
147
147
  export function handleAdminBotSetChannels(ws, msg, ctx) {
148
- const { botService, sendWs } = ctx
148
+ const { botService, sendWs, connections } = ctx
149
149
  const { user_id, channel_ids } = msg.body || {}
150
150
  botService.setBotChannels({ userId: user_id, channelIds: channel_ids, requestingUserId: ws.data.userId })
151
151
  sendWs(ws, { t: 'admin.bot_updated', reply_to: msg.id, ok: true, body: { user_id } })
152
+
153
+ // Notify the bot's active WebSocket connection so it can re-join channels.
154
+ for (const [, conn] of connections) {
155
+ if (conn.data.userId === user_id) {
156
+ sendWs(conn, { t: 'bot.channels_updated', body: { user_id } })
157
+ }
158
+ }
152
159
  }