Skip to content

Commit

Permalink
1760002018-v2.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
CE1CECL committed Feb 28, 2024
1 parent 6be669a commit 25a76bf
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/api/routes/users/@me/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ router.patch(
relations: ["settings"],
});

user.settings.assign(body);
user.settings?.assign(body);

await user.settings.save();
await user.settings?.save();

res.json({ ...user.settings, index: undefined });
},
Expand Down
2 changes: 1 addition & 1 deletion src/gateway/opcodes/LazyRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export async function onLazyRequest(this: WebSocket, { d }: Payload) {
if (!channels) return;
}

if (!channels) throw new Error("Must provide channel ranges");
if (!channels) return;

const channel_id = Object.keys(channels || {}).first();
if (!channel_id) return;
Expand Down
26 changes: 20 additions & 6 deletions src/util/dtos/ReadyGuildDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import { Channel, Emoji, Guild, Member, Role, Sticker } from "../entities";
import {
Channel,
Emoji,
Guild,
Member,
Role,
Sticker,
VoiceState,
} from "../entities";

export interface IReadyGuildDTO {
application_command_counts?: { 1: number; 2: number; 3: number }; // ????????????
Expand All @@ -30,6 +38,7 @@ export interface IReadyGuildDTO {
member_count: number | undefined;
members: Member[];
premium_subscription_count: number | undefined;
presences: unknown[];
properties: {
name: string;
description?: string | null;
Expand Down Expand Up @@ -63,6 +72,7 @@ export interface IReadyGuildDTO {
stage_instances: unknown[];
stickers: Sticker[];
threads: unknown[];
voice_states: VoiceState[];
version: string;
}

Expand All @@ -78,6 +88,7 @@ export class ReadyGuildDTO implements IReadyGuildDTO {
member_count: number | undefined;
members: Member[];
premium_subscription_count: number | undefined;
presences: unknown[];
properties: {
name: string;
description?: string | null;
Expand Down Expand Up @@ -111,6 +122,7 @@ export class ReadyGuildDTO implements IReadyGuildDTO {
stage_instances: unknown[];
stickers: Sticker[];
threads: unknown[];
voice_states: VoiceState[];
version: string;

constructor(guild: Guild) {
Expand All @@ -119,16 +131,17 @@ export class ReadyGuildDTO implements IReadyGuildDTO {
2: 2,
3: 2,
}; // ?????
this.channels = guild.channels;
this.channels = guild.channels ?? [];
this.data_mode = "full";
this.emojis = guild.emojis;
this.emojis = guild.emojis ?? [];
this.guild_scheduled_events = [];
this.id = guild.id;
this.large = guild.large;
this.lazy = true; // ??????????
this.member_count = guild.member_count;
this.members = guild.members;
this.members = guild.members ?? [];
this.premium_subscription_count = guild.premium_subscription_count;
this.presences = [];
this.properties = {
name: guild.name,
description: guild.description,
Expand Down Expand Up @@ -158,10 +171,11 @@ export class ReadyGuildDTO implements IReadyGuildDTO {
nsfw_level: guild.nsfw_level,
hub_type: null,
};
this.roles = guild.roles;
this.roles = guild.roles ?? [];
this.stage_instances = [];
this.stickers = guild.stickers;
this.stickers = guild.stickers ?? [];
this.threads = [];
this.voice_states = guild.voice_states ?? [];
this.version = "1"; // ??????
}

Expand Down

0 comments on commit 25a76bf

Please sign in to comment.