Move schemas to /src/util/schemas

This commit is contained in:
Madeline
2022-09-26 22:08:14 +10:00
parent 186f28516c
commit 849b257db7
94 changed files with 18692 additions and 18808 deletions
+1 -1
View File
@@ -20,12 +20,12 @@ import {
PresenceUpdateEvent,
DefaultUserGuildSettings,
UserGuildSettings,
IdentifySchema,
} from "@fosscord/util";
import { Send } from "../util/Send";
import { CLOSECODES, OPCODES } from "../util/Constants";
import { genSessionId } from "../util/SessionUtils";
import { setupListener } from "../listener/listener";
import { IdentifySchema } from "../schema/Identify";
// import experiments from "./experiments.json";
const experiments: any = [];
import { check } from "./instanceOf";
+3 -4
View File
@@ -1,6 +1,5 @@
import { getDatabase, getPermission, listenEvent, Member, Role, Session } from "@fosscord/util";
import { getDatabase, getPermission, listenEvent, Member, Role, Session, LazyRequestSchema } from "@fosscord/util";
import { WebSocket, Payload, handlePresenceUpdate, OPCODES, Send } from "@fosscord/gateway";
import { LazyRequest } from "../schema/LazyRequest";
import { check } from "./instanceOf";
// TODO: only show roles/members that have access to this channel
@@ -137,8 +136,8 @@ async function getMembers(guild_id: string, range: [number, number]) {
export async function onLazyRequest(this: WebSocket, { d }: Payload) {
// TODO: check data
check.call(this, LazyRequest, d);
const { guild_id, typing, channels, activities } = d as LazyRequest;
check.call(this, LazyRequestSchema, d);
const { guild_id, typing, channels, activities } = d as LazyRequestSchema;
const channel_id = Object.keys(channels || {}).first();
if (!channel_id) return;
+1 -2
View File
@@ -1,6 +1,5 @@
import { WebSocket, Payload } from "@fosscord/gateway";
import { emitEvent, PresenceUpdateEvent, Session, User } from "@fosscord/util";
import { ActivitySchema } from "../schema/Activity";
import { emitEvent, PresenceUpdateEvent, Session, User, ActivitySchema } from "@fosscord/util";
import { check } from "./instanceOf";
export async function onPresenceUpdate(this: WebSocket, { d }: Payload) {
+1 -1
View File
@@ -1,4 +1,3 @@
import { VoiceStateUpdateSchema } from "../schema/VoiceStateUpdateSchema";
import { Payload, WebSocket } from "@fosscord/gateway";
import { genVoiceToken } from "../util/SessionUtils";
import { check } from "./instanceOf";
@@ -11,6 +10,7 @@ import {
VoiceServerUpdateEvent,
VoiceState,
VoiceStateUpdateEvent,
VoiceStateUpdateSchema,
} from "@fosscord/util";
// TODO: check if a voice server is setup
// Notice: Bot users respect the voice channel's user limit, if set. When the voice channel is full, you will not receive the Voice State Update or Voice Server Update events in response to your own Voice State Update. Having MANAGE_CHANNELS permission bypasses this limit and allows you to join regardless of the channel being full or not.