mirror of
https://github.com/stoatchat/javascript-client-sdk.git
synced 2026-07-19 17:13:31 -04:00
fix: permissions calculation for user should consider their ID not ours
This commit is contained in:
+8
-10
@@ -145,16 +145,14 @@ export class User {
|
||||
}
|
||||
|
||||
if (
|
||||
this.#collection.client.channels
|
||||
.toList()
|
||||
.find(
|
||||
(channel) =>
|
||||
(channel.type === "Group" || channel.type === "DirectMessage") &&
|
||||
channel.recipientIds.has(this.#collection.client.user!.id)
|
||||
) ||
|
||||
this.#collection.client.serverMembers
|
||||
.toList()
|
||||
.find((member) => member.id.user === this.#collection.client.user!.id)
|
||||
this.#collection.client.channels.find(
|
||||
(channel) =>
|
||||
(channel.type === "Group" || channel.type === "DirectMessage") &&
|
||||
channel.recipientIds.has(this.id)
|
||||
) ||
|
||||
this.#collection.client.serverMembers.find(
|
||||
(member) => member.id.user === this.id
|
||||
)
|
||||
) {
|
||||
if (this.#collection.client.user?.bot || this.bot) {
|
||||
permissions |= UserPermission.SendMessage;
|
||||
|
||||
Reference in New Issue
Block a user