cringe sfx
This commit is contained in:
16
server/utils/fetch-sockets.ts
Normal file
16
server/utils/fetch-sockets.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { SocketServer } from '../types/socket.ts'
|
||||
|
||||
export async function fetchSockets(io: SocketServer, excludeId?: string, channelId?: string) {
|
||||
let sockets: Awaited<ReturnType<typeof io.fetchSockets>>
|
||||
|
||||
if (channelId) {
|
||||
sockets = await io.in(channelId).fetchSockets()
|
||||
}
|
||||
else {
|
||||
sockets = await io.fetchSockets()
|
||||
}
|
||||
|
||||
return sockets.filter((socket) => {
|
||||
return !(excludeId && socket.id === excludeId)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user