I have no idea what I am going

This commit is contained in:
ayntee
2020-11-22 20:13:56 +04:00
parent 56535d1236
commit 98774971b1
2 changed files with 24 additions and 6 deletions

View File

@@ -55,12 +55,17 @@ export async function createShard(
// TODO: do something about this
// TODO(ayntee): check if the readyState of the websocket is OPEN (not sure if this is the solution)
if (!resuming) {
// Intial identify with the gateway
await identify(basicShard, identifyPayload);
} else {
await resume(basicShard, identifyPayload);
}
socket.onopen = async () => {
if (!resuming) {
// Intial identify with the gateway
await identify(basicShard, identifyPayload);
} else {
await resume(basicShard, identifyPayload);
}
};
// TODO: handle the WebSocket#error event
socket.onerror = () => {};
socket.onmessage = ({ data: message }) => {
if (message instanceof Uint8Array) {

13
test.ts Normal file
View File

@@ -0,0 +1,13 @@
import { startBot } from "./mod.ts";
import { Intents } from "./src/types/options.ts";
const token = "NzcxMDU2NzQzNTI1Nzc3NDM4.X5mkjQ.KhrhSnfw4fs1VfgRdg0cLxRrDkA";
await startBot({
intents: [Intents.GUILDS, Intents.GUILD_MESSAGES],
token,
eventHandlers: {
ready: () => console.log("hello :)"),
debug: console.log,
},
});