🎨 rewrite imports

This commit is contained in:
Flam3rboy
2021-09-20 23:34:54 +02:00
parent 16a3d1b334
commit 912d1c31d8
26 changed files with 2636 additions and 398 deletions
+1 -4
View File
@@ -1,7 +1,4 @@
import { CLOSECODES, Payload } from "@fosscord/gateway/util/Constants";
import { Send } from "@fosscord/gateway/util/Send";
import { setHeartbeat } from "@fosscord/gateway/util/setHeartbeat";
import WebSocket from "@fosscord/gateway/util/WebSocket";
import { Payload, Send, setHeartbeat, WebSocket } from "@fosscord/gateway";
export async function onHeartbeat(this: WebSocket, data: Payload) {
// TODO: validate payload
+11 -5
View File
@@ -1,5 +1,10 @@
import { CLOSECODES, Payload, OPCODES } from "@fosscord/gateway/util/Constants";
import WebSocket from "@fosscord/gateway/util/WebSocket";
import {
WebSocket,
CLOSECODES,
Payload,
OPCODES,
genSessionId,
} from "@fosscord/gateway";
import {
Channel,
checkToken,
@@ -24,7 +29,6 @@ import { Send } from "@fosscord/gateway/util/Send";
const experiments: any = [];
import { check } from "./instanceOf";
import { Recipient } from "@fosscord/util";
import { genSessionId } from "@fosscord/gateway/util/SessionUtils";
// TODO: bot sharding
// TODO: check priviliged intents
@@ -98,7 +102,9 @@ export async function onIdentify(this: WebSocket, data: Payload) {
//TODO is this needed? check if users in group dm that are not friends are sent in the READY event
//users = users.concat(x.channel.recipients);
if (x.channel.isDm()) {
x.channel.recipients = x.channel.recipients!.filter((x) => x.id !== this.user_id);
x.channel.recipients = x.channel.recipients!.filter(
(x) => x.id !== this.user_id
);
}
return x.channel;
});
@@ -109,7 +115,7 @@ export async function onIdentify(this: WebSocket, data: Payload) {
if (!user) return this.close(CLOSECODES.Authentication_failed);
for (let relation of user.relationships) {
const related_user = relation.to
const related_user = relation.to;
const public_related_user = {
username: related_user.username,
discriminator: related_user.discriminator,
+1 -4
View File
@@ -2,13 +2,10 @@ import {
getPermission,
Member,
PublicMemberProjection,
PublicUserProjection,
Role,
} from "@fosscord/util";
import { LazyRequest } from "../schema/LazyRequest";
import { OPCODES, Payload } from "@fosscord/gateway/util/Constants";
import { Send } from "@fosscord/gateway/util/Send";
import WebSocket from "@fosscord/gateway/util/WebSocket";
import { WebSocket, Send, OPCODES, Payload } from "@fosscord/gateway";
import { check } from "./instanceOf";
import "missing-native-js-functions";
+1 -2
View File
@@ -1,5 +1,4 @@
import { CLOSECODES, Payload } from "@fosscord/gateway/util/Constants";
import WebSocket from "@fosscord/gateway/util/WebSocket";
import { WebSocket, Payload } from "@fosscord/gateway";
export function onPresenceUpdate(this: WebSocket, data: Payload) {
// return this.close(CLOSECODES.Unknown_error);
+1 -3
View File
@@ -1,6 +1,4 @@
import { CLOSECODES, Payload } from "@fosscord/gateway/util/Constants";
import WebSocket from "@fosscord/gateway/util/WebSocket";
import { Payload, WebSocket } from "@fosscord/gateway";
export function onRequestGuildMembers(this: WebSocket, data: Payload) {
// return this.close(CLOSECODES.Unknown_error);
+1 -4
View File
@@ -1,7 +1,4 @@
import { CLOSECODES, Payload } from "@fosscord/gateway/util/Constants";
import { Send } from "@fosscord/gateway/util/Send";
import WebSocket from "@fosscord/gateway/util/WebSocket";
import { WebSocket, Payload, Send } from "@fosscord/gateway";
export async function onResume(this: WebSocket, data: Payload) {
console.log("Got Resume -> cancel not implemented");
+1 -3
View File
@@ -1,6 +1,5 @@
import { VoiceStateUpdateSchema } from "../schema/VoiceStateUpdateSchema";
import { Payload } from "@fosscord/gateway/util/Constants";
import WebSocket from "@fosscord/gateway/util/WebSocket";
import { Payload, WebSocket, genVoiceToken } from "@fosscord/gateway";
import { check } from "./instanceOf";
import {
Config,
@@ -12,7 +11,6 @@ import {
VoiceState,
VoiceStateUpdateEvent,
} from "@fosscord/util";
import { genVoiceToken } from "@fosscord/gateway/util/SessionUtils";
// 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.
+1 -2
View File
@@ -1,5 +1,4 @@
import { Payload } from "@fosscord/gateway/util/Constants";
import WebSocket from "@fosscord/gateway/util/WebSocket";
import { WebSocket, Payload } from "@fosscord/gateway";
import { onHeartbeat } from "./Heartbeat";
import { onIdentify } from "./Identify";
import { onLazyRequest } from "./LazyRequest";
+1 -2
View File
@@ -1,6 +1,5 @@
import { instanceOf } from "lambert-server";
import { CLOSECODES } from "@fosscord/gateway/util/Constants";
import WebSocket from "@fosscord/gateway/util/WebSocket";
import { WebSocket, CLOSECODES } from "@fosscord/gateway";
export function check(this: WebSocket, schema: any, data: any) {
try {