🎨 use discord-server-util

This commit is contained in:
Flam3rboy 2021-02-05 16:25:27 +01:00
parent f5a723d9b4
commit 43ce48e7c6
3 changed files with 56 additions and 5 deletions

View File

@ -1,5 +0,0 @@
import { MongoDatabase } from "lambert-db";
const db = new MongoDatabase();
export default db;

19
src/util/Config.ts Normal file
View File

@ -0,0 +1,19 @@
import { Config } from "discord-server-util";
export default {
init() {
return Config.init({ gateway: DefaultOptions });
},
get() {
return Config.getAll().gateway;
},
set(val: any) {
return Config.setAll({ gateway: val });
},
getAll: Config.getAll,
setAll: Config.setAll,
};
export interface DefaultOptions {}
export const DefaultOptions: DefaultOptions = {};

37
src/util/Constants.ts Normal file
View File

@ -0,0 +1,37 @@
export enum OPCODES {
Dispatch,
Heartbeat,
Identify,
Presence_Update,
Voice_State_Update,
Resume,
Reconnect,
Request_Guild_Members,
Invalid_Session,
Hello,
Heartbeat_ACK,
}
export enum CLOSECODES {
Unknown_error = 4000,
Unknown_opcode,
Decode_error,
Not_authenticated,
Authentication_failed,
Already_authenticated,
Invalid_session,
Invalid_seq,
Rate_limited,
Session_timed_out,
Invalid_shard,
Sharding_required,
Invalid_API_version,
Invalid_intent,
Disallowed_intent,
}
export interface Payload {
op: OPCODES;
d?: any;
s?: number;
t?: string;
}