1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-22 10:22:39 +01:00

allow all role props through ready

This commit is contained in:
Madeline 2023-04-01 19:49:54 +11:00
parent 13dedb6d25
commit d944dd4ef4
No known key found for this signature in database
GPG Key ID: 1958E017C36F2E47
2 changed files with 6 additions and 11 deletions

View File

@ -249,21 +249,14 @@ export async function onIdentify(this: WebSocket, data: Payload) {
// Generate guilds list ( make them unavailable if user is bot )
const guilds: GuildOrUnavailable[] = members.map((member) => {
// Some Discord libraries do `'blah' in object` instead of
// checking if the type is correct
member.guild.roles.forEach((role) => {
for (const key in role) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore
if (!role[key]) role[key] = undefined;
}
});
// filter guild channels we don't have permission to view
// TODO: check if this causes issues when the user is granted other roles?
member.guild.channels = member.guild.channels.filter((channel) => {
const perms = Permissions.finalPermission({
user: { id: member.id, roles: member.roles.map((x) => x.id) },
user: {
id: member.id,
roles: member.roles.map((x) => x.id),
},
guild: member.guild,
channel,
});
@ -422,6 +415,7 @@ export async function onIdentify(this: WebSocket, data: Payload) {
Config.get().gateway.endpointPublic ||
"ws://127.0.0.1:3001",
session_type: "normal", // TODO
auth_session_id_hash: "", // TODO
// lol hack whatever
required_action:

View File

@ -121,6 +121,7 @@ export interface ReadyEventData {
tutorial: number | null;
resume_gateway_url: string;
session_type: string;
auth_session_id_hash: string;
required_action?:
| "REQUIRE_VERIFIED_EMAIL"
| "REQUIRE_VERIFIED_PHONE"