summary refs log tree commit diff
path: root/src/gateway/opcodes
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-09-26 22:08:14 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-09-26 22:08:14 +1000
commit1f416b972c6aa0cd4fc43a5790da56f8da21e82c (patch)
tree8222a04cc63c595bc8b236ceeec89ed2fc2b7580 /src/gateway/opcodes
parentFix scripts/benchmark/connections.js (diff)
downloadserver-1f416b972c6aa0cd4fc43a5790da56f8da21e82c.tar.xz
Move schemas to /src/util/schemas
Diffstat (limited to 'src/gateway/opcodes')
-rw-r--r--src/gateway/opcodes/Identify.ts2
-rw-r--r--src/gateway/opcodes/LazyRequest.ts7
-rw-r--r--src/gateway/opcodes/PresenceUpdate.ts3
-rw-r--r--src/gateway/opcodes/VoiceStateUpdate.ts2
4 files changed, 6 insertions, 8 deletions
diff --git a/src/gateway/opcodes/Identify.ts b/src/gateway/opcodes/Identify.ts
index 3c40962c..b4b36075 100644
--- a/src/gateway/opcodes/Identify.ts
+++ b/src/gateway/opcodes/Identify.ts
@@ -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";
diff --git a/src/gateway/opcodes/LazyRequest.ts b/src/gateway/opcodes/LazyRequest.ts
index 82342224..0f21d087 100644
--- a/src/gateway/opcodes/LazyRequest.ts
+++ b/src/gateway/opcodes/LazyRequest.ts
@@ -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;
diff --git a/src/gateway/opcodes/PresenceUpdate.ts b/src/gateway/opcodes/PresenceUpdate.ts
index 415df6ee..d17b7dd7 100644
--- a/src/gateway/opcodes/PresenceUpdate.ts
+++ b/src/gateway/opcodes/PresenceUpdate.ts
@@ -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) {
diff --git a/src/gateway/opcodes/VoiceStateUpdate.ts b/src/gateway/opcodes/VoiceStateUpdate.ts
index fa63f7fc..8e1585ec 100644
--- a/src/gateway/opcodes/VoiceStateUpdate.ts
+++ b/src/gateway/opcodes/VoiceStateUpdate.ts
@@ -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.