summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-04 11:26:47 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-04 11:26:47 +0200
commite9a88852825fe3c6509456c2f7533889bd3c138c (patch)
tree732bd2cd6eacaa309800b764fb3b08003954065e
parent:bug: api member add roles -> make sure that roles exist (diff)
parentfixed /discoverable-guilds (diff)
downloadserver-e9a88852825fe3c6509456c2f7533889bd3c138c.tar.xz
Merge branch 'master' of https://github.com/fosscord/fosscord-api
-rw-r--r--api/src/index.ts1
-rw-r--r--api/src/middlewares/ErrorHandler.ts5
-rw-r--r--api/src/routes/channels/#channel_id/pins.ts2
-rw-r--r--api/src/routes/channels/#channel_id/webhooks.ts2
-rw-r--r--api/src/routes/discoverable-guilds.ts17
-rw-r--r--api/src/routes/guilds/#guild_id/members/#member_id/index.ts3
-rw-r--r--api/src/routes/guilds/#guild_id/roles.ts2
-rw-r--r--api/src/routes/guilds/index.ts2
-rw-r--r--api/src/routes/guilds/templates/index.ts2
-rw-r--r--api/src/routes/template.ts.disabled10
-rw-r--r--api/src/routes/users/@me/relationships.ts2
-rw-r--r--util/src/entities/Guild.ts37
-rw-r--r--util/src/entities/Member.ts8
-rw-r--r--util/src/util/ApiError.ts (renamed from api/src/util/ApiError.ts)0
-rw-r--r--util/src/util/Constants.ts (renamed from api/src/util/Constants.ts)127
-rw-r--r--util/src/util/index.ts9
16 files changed, 177 insertions, 52 deletions
diff --git a/api/src/index.ts b/api/src/index.ts
index 0bba7f5e..fe59310f 100644
--- a/api/src/index.ts
+++ b/api/src/index.ts
@@ -5,7 +5,6 @@ export * from "./schema/Channel";
 export * from "./schema/Guild";
 export * from "./schema/Invite";
 export * from "./schema/Message";
-export * from "./util/Constants";
 export * from "./util/instanceOf";
 export * from "./util/instanceOf";
 export * from "./util/RandomInviteID";
diff --git a/api/src/middlewares/ErrorHandler.ts b/api/src/middlewares/ErrorHandler.ts
index 179c5991..be2586cf 100644
--- a/api/src/middlewares/ErrorHandler.ts
+++ b/api/src/middlewares/ErrorHandler.ts
@@ -2,9 +2,8 @@ import { NextFunction, Request, Response } from "express";
 import { HTTPError } from "lambert-server";
 import { EntityNotFoundError } from "typeorm";
 import { FieldError } from "../util/instanceOf";
-import { ApiError } from "../util/ApiError";
+import { ApiError } from "@fosscord/util";
 
-// TODO: update with new body/typorm validation
 export function ErrorHandler(error: Error, req: Request, res: Response, next: NextFunction) {
 	if (!error) return next();
 
@@ -20,7 +19,7 @@ export function ErrorHandler(error: Error, req: Request, res: Response, next: Ne
 			message = error.message;
 			httpcode = error.httpStatus;
 		} else if (error instanceof EntityNotFoundError) {
-			message = `${(error as any).stringifyTarget} could not be found`;
+			message = `${(error as any).stringifyTarget || "Item"} could not be found`;
 			code = 404;
 		} else if (error instanceof FieldError) {
 			code = Number(error.code);
diff --git a/api/src/routes/channels/#channel_id/pins.ts b/api/src/routes/channels/#channel_id/pins.ts
index fafb789f..33309c86 100644
--- a/api/src/routes/channels/#channel_id/pins.ts
+++ b/api/src/routes/channels/#channel_id/pins.ts
@@ -1,7 +1,7 @@
 import { Channel, ChannelPinsUpdateEvent, Config, emitEvent, getPermission, Message, MessageUpdateEvent } from "@fosscord/util";
 import { Router, Request, Response } from "express";
 import { HTTPError } from "lambert-server";
-import { DiscordApiErrors } from "../../../util/Constants";
+import { DiscordApiErrors } from "@fosscord/util";
 
 const router: Router = Router();
 
diff --git a/api/src/routes/channels/#channel_id/webhooks.ts b/api/src/routes/channels/#channel_id/webhooks.ts
index d2a4b9a0..e4125879 100644
--- a/api/src/routes/channels/#channel_id/webhooks.ts
+++ b/api/src/routes/channels/#channel_id/webhooks.ts
@@ -3,7 +3,7 @@ import { check, Length } from "../../../util/instanceOf";
 import { Channel, Config, getPermission, trimSpecial, Webhook } from "@fosscord/util";
 import { HTTPError } from "lambert-server";
 import { isTextChannel } from "./messages/index";
-import { DiscordApiErrors } from "../../../util/Constants";
+import { DiscordApiErrors } from "@fosscord/util";
 
 const router: Router = Router();
 // TODO: webhooks
diff --git a/api/src/routes/discoverable-guilds.ts b/api/src/routes/discoverable-guilds.ts
new file mode 100644
index 00000000..0808727f
--- /dev/null
+++ b/api/src/routes/discoverable-guilds.ts
@@ -0,0 +1,17 @@
+import { Guild } from "@fosscord/util";
+import { Router, Request, Response } from "express";
+import { In } from "typeorm";
+
+const router = Router();
+
+router.get("/", async (req: Request, res: Response) => {
+	const { limit } = req.params;
+
+	// ! this only works using SQL querys
+	// TODO: implement this with default typeorm query
+	// const guilds = await Guild.find({ where: { features: "DISCOVERABLE" } }); //, take: Math.abs(Number(limit)) });
+	const guilds = await Guild.find({ where: `"features" LIKE 'COMMUNITY'`, take: Math.abs(Number(limit)) });
+	res.send({ guilds: guilds });
+});
+
+export default router;
diff --git a/api/src/routes/guilds/#guild_id/members/#member_id/index.ts b/api/src/routes/guilds/#guild_id/members/#member_id/index.ts
index 51bb010d..0d62e555 100644
--- a/api/src/routes/guilds/#guild_id/members/#member_id/index.ts
+++ b/api/src/routes/guilds/#guild_id/members/#member_id/index.ts
@@ -50,7 +50,8 @@ router.patch("/", check(MemberChangeSchema), async (req: Request, res: Response)
 });
 
 router.put("/", async (req: Request, res: Response) => {
-	const { guild_id, member_id } = req.params;
+	let { guild_id, member_id } = req.params;
+	if (member_id === "@me") member_id = req.user_id;
 
 	throw new HTTPError("Maintenance: Currently you can't add a member", 403);
 	// TODO: only for oauth2 applications
diff --git a/api/src/routes/guilds/#guild_id/roles.ts b/api/src/routes/guilds/#guild_id/roles.ts
index bdfc370e..6a318688 100644
--- a/api/src/routes/guilds/#guild_id/roles.ts
+++ b/api/src/routes/guilds/#guild_id/roles.ts
@@ -14,7 +14,7 @@ import { HTTPError } from "lambert-server";
 
 import { check } from "../../../util/instanceOf";
 import { RoleModifySchema, RolePositionUpdateSchema } from "../../../schema/Roles";
-import { DiscordApiErrors } from "../../../util/Constants";
+import { DiscordApiErrors } from "@fosscord/util";
 import { In } from "typeorm";
 
 const router: Router = Router();
diff --git a/api/src/routes/guilds/index.ts b/api/src/routes/guilds/index.ts
index 7c0b7abc..e5830647 100644
--- a/api/src/routes/guilds/index.ts
+++ b/api/src/routes/guilds/index.ts
@@ -3,7 +3,7 @@ import { Role, Guild, Snowflake, Config, User, Member, Channel } from "@fosscord
 import { HTTPError } from "lambert-server";
 import { check } from "./../../util/instanceOf";
 import { GuildCreateSchema } from "../../schema/Guild";
-import { DiscordApiErrors } from "../../util/Constants";
+import { DiscordApiErrors } from "@fosscord/util";
 
 const router: Router = Router();
 
diff --git a/api/src/routes/guilds/templates/index.ts b/api/src/routes/guilds/templates/index.ts
index 3a619278..58201f65 100644
--- a/api/src/routes/guilds/templates/index.ts
+++ b/api/src/routes/guilds/templates/index.ts
@@ -4,7 +4,7 @@ import { Template, Guild, Role, Snowflake, Config, User, Member } from "@fosscor
 import { HTTPError } from "lambert-server";
 import { GuildTemplateCreateSchema } from "../../../schema/Guild";
 import { check } from "../../../util/instanceOf";
-import { DiscordApiErrors } from "../../../util/Constants";
+import { DiscordApiErrors } from "@fosscord/util";
 
 router.get("/:code", async (req: Request, res: Response) => {
 	const { code } = req.params;
diff --git a/api/src/routes/template.ts.disabled b/api/src/routes/template.ts.disabled
new file mode 100644
index 00000000..ad785f10
--- /dev/null
+++ b/api/src/routes/template.ts.disabled
@@ -0,0 +1,10 @@
+//TODO: this is a template for a generic route
+
+import { Router, Request, Response } from "express";
+const router = Router();
+
+router.get("/", async (req: Request, res: Response) => {
+	res.send({});
+});
+
+export default router;
diff --git a/api/src/routes/users/@me/relationships.ts b/api/src/routes/users/@me/relationships.ts
index 2bd9c819..8d6d8c9e 100644
--- a/api/src/routes/users/@me/relationships.ts
+++ b/api/src/routes/users/@me/relationships.ts
@@ -10,7 +10,7 @@ import {
 } from "@fosscord/util";
 import { Router, Response, Request } from "express";
 import { HTTPError } from "lambert-server";
-import { DiscordApiErrors } from "../../../util/Constants";
+import { DiscordApiErrors } from "@fosscord/util";
 
 import { check, Length } from "../../../util/instanceOf";
 
diff --git a/util/src/entities/Guild.ts b/util/src/entities/Guild.ts
index c569d536..029a1b0b 100644
--- a/util/src/entities/Guild.ts
+++ b/util/src/entities/Guild.ts
@@ -16,6 +16,42 @@ import { Webhook } from "./Webhook";
 // TODO: guild_scheduled_events
 // TODO: stage_instances
 // TODO: threads
+// TODO: description
+// TODO: categories:
+// [{
+// 	"id": 16,
+// 	"name": {
+// 		"default": "Anime & Manga",
+// 		"localizations": {
+// 			"de": "Anime & Manga",
+// 			"fr": "Anim\u00e9s et mangas",
+// 			"ru": "\u0410\u043d\u0438\u043c\u0435 \u0438 \u043c\u0430\u043d\u0433\u0430"
+// 		}
+// 	},
+// 	"is_primary": false
+// }]
+// TODO:
+//  primary_category :{
+// 	id: 1,
+// 	name: {
+// 		default: "Gaming",
+// 		localizations: { de: "Gaming", fr: "Gaming", ru: "\u0418\u0433\u0440\u044b" },
+// 		is_primary: true,
+// 	},
+// };
+// TODO:
+// "keywords": [
+// 		"Genshin Impact",
+// 		"Paimon",
+// 		"Honkai Impact",
+// 		"ARPG",
+// 		"Open-World",
+// 		"Waifu",
+// 		"Anime",
+// 		"Genshin",
+// 		"miHoYo",
+// 		"Gacha"
+// 	],
 
 export const PublicGuildRelations = [
 	"channels",
@@ -66,6 +102,7 @@ export class Guild extends BaseClass {
 
 	@Column({ type: "simple-array" })
 	features: string[]; //TODO use enum
+	//TODO: https://discord.com/developers/docs/resources/guild#guild-object-guild-features
 
 	@Column({ nullable: true })
 	icon?: string;
diff --git a/util/src/entities/Member.ts b/util/src/entities/Member.ts
index 38352890..66f5d9a1 100644
--- a/util/src/entities/Member.ts
+++ b/util/src/entities/Member.ts
@@ -25,7 +25,8 @@ import {
 import { HTTPError } from "lambert-server";
 import { Role } from "./Role";
 import { BaseClassWithoutId } from "./BaseClass";
-import { PublicGuildRelations } from ".";
+import { Ban, PublicGuildRelations } from ".";
+import { DiscordApiErrors } from "../util/Constants";
 
 @Entity("members")
 @Index(["id", "guild_id"], { unique: true })
@@ -198,7 +199,10 @@ export class Member extends BaseClassWithoutId {
 
 	static async addToGuild(user_id: string, guild_id: string) {
 		const user = await User.getPublicUser(user_id);
-
+		const isBanned = await Ban.count({ where: { guild_id, user_id } });
+		if (isBanned) {
+			throw DiscordApiErrors.USER_BANNED;
+		}
 		const { maxGuilds } = Config.get().limits.user;
 		const guild_count = await Member.count({ id: user_id });
 		if (guild_count >= maxGuilds) {
diff --git a/api/src/util/ApiError.ts b/util/src/util/ApiError.ts
index c133e6e7..c133e6e7 100644
--- a/api/src/util/ApiError.ts
+++ b/util/src/util/ApiError.ts
diff --git a/api/src/util/Constants.ts b/util/src/util/Constants.ts
index f06b3d56..713d59da 100644
--- a/api/src/util/Constants.ts
+++ b/util/src/util/Constants.ts
@@ -6,7 +6,7 @@ export const WSCodes = {
 	4010: "SHARDING_INVALID",
 	4011: "SHARDING_REQUIRED",
 	4013: "INVALID_INTENTS",
-	4014: "DISALLOWED_INTENTS"
+	4014: "DISALLOWED_INTENTS",
 };
 
 /**
@@ -22,7 +22,7 @@ export const WSCodes = {
  * * RESUMING: 8
  * @typedef {number} Status
  */
-export const Status = {
+export const WsStatus = {
 	READY: 0,
 	CONNECTING: 1,
 	RECONNECTING: 2,
@@ -31,7 +31,7 @@ export const Status = {
 	DISCONNECTED: 5,
 	WAITING_FOR_GUILDS: 6,
 	IDENTIFYING: 7,
-	RESUMING: 8
+	RESUMING: 8,
 };
 
 /**
@@ -48,7 +48,7 @@ export const VoiceStatus = {
 	CONNECTING: 1,
 	AUTHENTICATING: 2,
 	RECONNECTING: 3,
-	DISCONNECTED: 4
+	DISCONNECTED: 4,
 };
 
 export const OPCodes = {
@@ -63,7 +63,7 @@ export const OPCodes = {
 	REQUEST_GUILD_MEMBERS: 8,
 	INVALID_SESSION: 9,
 	HELLO: 10,
-	HEARTBEAT_ACK: 11
+	HEARTBEAT_ACK: 11,
 };
 
 export const VoiceOPCodes = {
@@ -75,7 +75,7 @@ export const VoiceOPCodes = {
 	SPEAKING: 5,
 	HELLO: 8,
 	CLIENT_CONNECT: 12,
-	CLIENT_DISCONNECT: 13
+	CLIENT_DISCONNECT: 13,
 };
 
 export const Events = {
@@ -133,7 +133,7 @@ export const Events = {
 	SHARD_READY: "shardReady",
 	SHARD_RESUME: "shardResume",
 	INVALIDATED: "invalidated",
-	RAW: "raw"
+	RAW: "raw",
 };
 
 export const ShardEvents = {
@@ -142,7 +142,7 @@ export const ShardEvents = {
 	INVALID_SESSION: "invalidSession",
 	READY: "ready",
 	RESUMED: "resumed",
-	ALL_READY: "allReady"
+	ALL_READY: "allReady",
 };
 
 /**
@@ -234,7 +234,7 @@ export const WSEvents = keyMirror([
 	"TYPING_START",
 	"VOICE_STATE_UPDATE",
 	"VOICE_SERVER_UPDATE",
-	"WEBHOOKS_UPDATE"
+	"WEBHOOKS_UPDATE",
 ]);
 
 /**
@@ -277,7 +277,7 @@ export const MessageTypes = [
 	null,
 	null,
 	null,
-	"REPLY"
+	"REPLY",
 ];
 
 /**
@@ -286,7 +286,9 @@ export const MessageTypes = [
  * * REPLY
  * @typedef {string} SystemMessageType
  */
-export const SystemMessageTypes = MessageTypes.filter((type: string | null) => type && type !== "DEFAULT" && type !== "REPLY");
+export const SystemMessageTypes = MessageTypes.filter(
+	(type: string | null) => type && type !== "DEFAULT" && type !== "REPLY"
+);
 
 /**
  * <info>Bots cannot set a `CUSTOM_STATUS`, it is only for custom statuses received from users</info>
@@ -308,12 +310,12 @@ export const ChannelTypes = {
 	GROUP: 3,
 	CATEGORY: 4,
 	NEWS: 5,
-	STORE: 6
+	STORE: 6,
 };
 
 export const ClientApplicationAssetTypes = {
 	SMALL: 1,
-	BIG: 2
+	BIG: 2,
 };
 
 export const Colors = {
@@ -345,7 +347,7 @@ export const Colors = {
 	BLURPLE: 0x7289da,
 	GREYPLE: 0x99aab5,
 	DARK_BUT_NOT_BLACK: 0x2c2f33,
-	NOT_QUITE_BLACK: 0x23272a
+	NOT_QUITE_BLACK: 0x23272a,
 };
 
 /**
@@ -554,8 +556,14 @@ export const DiscordApiErrors = {
 	UNKNOWN_GUILD_SCHEDULED_EVENT_USER: new ApiError("Unknown Guild Scheduled Event User", 10071),
 	BOT_PROHIBITED_ENDPOINT: new ApiError("Bots cannot use this endpoint", 20001),
 	BOT_ONLY_ENDPOINT: new ApiError("Only bots can use this endpoint", 20002),
-	EXPLICIT_CONTENT_CANNOT_BE_SENT_TO_RECIPIENT: new ApiError("Explicit content cannot be sent to the desired recipient(s)", 20009),
-	ACTION_NOT_AUTHORIZED_ON_APPLICATION: new ApiError("You are not authorized to perform this action on this application", 20012),
+	EXPLICIT_CONTENT_CANNOT_BE_SENT_TO_RECIPIENT: new ApiError(
+		"Explicit content cannot be sent to the desired recipient(s)",
+		20009
+	),
+	ACTION_NOT_AUTHORIZED_ON_APPLICATION: new ApiError(
+		"You are not authorized to perform this action on this application",
+		20012
+	),
 	SLOWMODE_RATE_LIMIT: new ApiError("This action cannot be performed due to slowmode rate limit", 20016),
 	ONLY_OWNER: new ApiError("Only the owner of this account can perform this action", 20018),
 	ANNOUNCEMENT_RATE_LIMITS: new ApiError("This message cannot be edited due to announcement rate limits", 20022),
@@ -568,25 +576,40 @@ export const DiscordApiErrors = {
 	MAXIMUM_GUILDS: new ApiError("Maximum number of guilds reached ({})", 30001, undefined, ["100"]),
 	MAXIMUM_FRIENDS: new ApiError("Maximum number of friends reached ({})", 30002, undefined, ["1000"]),
 	MAXIMUM_PINS: new ApiError("Maximum number of pins reached for the channel ({})", 30003, undefined, ["50"]),
-	MAXIMUM_NUMBER_OF_RECIPIENTS_REACHED: new ApiError("Maximum number of recipients reached ({})", 30004, undefined, ["10"]),
+	MAXIMUM_NUMBER_OF_RECIPIENTS_REACHED: new ApiError("Maximum number of recipients reached ({})", 30004, undefined, [
+		"10",
+	]),
 	MAXIMUM_ROLES: new ApiError("Maximum number of guild roles reached ({})", 30005, undefined, ["250"]),
 	MAXIMUM_WEBHOOKS: new ApiError("Maximum number of webhooks reached ({})", 30007, undefined, ["10"]),
 	MAXIMUM_NUMBER_OF_EMOJIS_REACHED: new ApiError("Maximum number of emojis reached", 30008),
 	MAXIMUM_REACTIONS: new ApiError("Maximum number of reactions reached ({})", 30010, undefined, ["20"]),
 	MAXIMUM_CHANNELS: new ApiError("Maximum number of guild channels reached ({})", 30013, undefined, ["500"]),
-	MAXIMUM_ATTACHMENTS: new ApiError("Maximum number of attachments in a message reached ({})", 30015, undefined, ["10"]),
+	MAXIMUM_ATTACHMENTS: new ApiError("Maximum number of attachments in a message reached ({})", 30015, undefined, [
+		"10",
+	]),
 	MAXIMUM_INVITES: new ApiError("Maximum number of invites reached ({})", 30016, undefined, ["1000"]),
 	MAXIMUM_ANIMATED_EMOJIS: new ApiError("Maximum number of animated emojis reached", 30018),
 	MAXIMUM_SERVER_MEMBERS: new ApiError("Maximum number of server members reached", 30019),
-	MAXIMUM_SERVER_CATEGORIES: new ApiError("Maximum number of server categories has been reached ({})", 30030, undefined, ["5"]),
+	MAXIMUM_SERVER_CATEGORIES: new ApiError(
+		"Maximum number of server categories has been reached ({})",
+		30030,
+		undefined,
+		["5"]
+	),
 	GUILD_ALREADY_HAS_TEMPLATE: new ApiError("Guild already has a template", 30031),
 	MAXIMUM_THREAD_PARTICIPANTS: new ApiError("Max number of thread participants has been reached", 30033),
-	MAXIMUM_BANS_FOR_NON_GUILD_MEMBERS: new ApiError("Maximum number of bans for non-guild members have been exceeded", 30035),
+	MAXIMUM_BANS_FOR_NON_GUILD_MEMBERS: new ApiError(
+		"Maximum number of bans for non-guild members have been exceeded",
+		30035
+	),
 	MAXIMUM_BANS_FETCHES: new ApiError("Maximum number of bans fetches has been reached", 30037),
 	MAXIMUM_STICKERS: new ApiError("Maximum number of stickers reached", 30039),
 	MAXIMUM_PRUNE_REQUESTS: new ApiError("Maximum number of prune requests has been reached. Try again later", 30040),
 	UNAUTHORIZED: new ApiError("Unauthorized. Provide a valid token and try again", 40001),
-	ACCOUNT_VERIFICATION_REQUIRED: new ApiError("You need to verify your account in order to perform this action", 40002),
+	ACCOUNT_VERIFICATION_REQUIRED: new ApiError(
+		"You need to verify your account in order to perform this action",
+		40002
+	),
 	OPENING_DIRECT_MESSAGES_TOO_FAST: new ApiError("You are opening direct messages too fast", 40003),
 	REQUEST_ENTITY_TOO_LARGE: new ApiError("Request entity too large. Try sending something smaller in size", 40005),
 	FEATURE_TEMPORARILY_DISABLED: new ApiError("This feature has been temporarily disabled server-side", 40006),
@@ -602,7 +625,10 @@ export const DiscordApiErrors = {
 	CANNOT_SEND_EMPTY_MESSAGE: new ApiError("Cannot send an empty message", 50006),
 	CANNOT_MESSAGE_USER: new ApiError("Cannot send messages to this user", 50007),
 	CANNOT_SEND_MESSAGES_IN_VOICE_CHANNEL: new ApiError("Cannot send messages in a voice channel", 50008),
-	CHANNEL_VERIFICATION_LEVEL_TOO_HIGH: new ApiError("Channel verification level is too high for you to gain access", 50009),
+	CHANNEL_VERIFICATION_LEVEL_TOO_HIGH: new ApiError(
+		"Channel verification level is too high for you to gain access",
+		50009
+	),
 	OAUTH2_APPLICATION_BOT_ABSENT: new ApiError("OAuth2 application does not have a bot", 50010),
 	MAXIMUM_OAUTH2_APPLICATIONS: new ApiError("OAuth2 application limit reached", 50011),
 	INVALID_OAUTH_STATE: new ApiError("Invalid OAuth2 state", 50012),
@@ -615,7 +641,10 @@ export const DiscordApiErrors = {
 		undefined,
 		["2", "100"]
 	),
-	CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL: new ApiError("A message can only be pinned to the channel it was sent in", 50019),
+	CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL: new ApiError(
+		"A message can only be pinned to the channel it was sent in",
+		50019
+	),
 	INVALID_OR_TAKEN_INVITE_CODE: new ApiError("Invite code was either invalid or taken", 50020),
 	CANNOT_EXECUTE_ON_SYSTEM_MESSAGE: new ApiError("Cannot execute action on a system message", 50021),
 	CANNOT_EXECUTE_ON_THIS_CHANNEL_TYPE: new ApiError("Cannot execute action on this channel type", 50024),
@@ -629,22 +658,34 @@ export const DiscordApiErrors = {
 		"Invalid form body (returned for both application/json and multipart/form-data bodies), or invalid Content-Type provided",
 		50035
 	),
-	INVITE_ACCEPTED_TO_GUILD_NOT_CONTAINING_BOT: new ApiError("An invite was accepted to a guild the application's bot is not in", 50036),
+	INVITE_ACCEPTED_TO_GUILD_NOT_CONTAINING_BOT: new ApiError(
+		"An invite was accepted to a guild the application's bot is not in",
+		50036
+	),
 	INVALID_API_VERSION: new ApiError("Invalid API version provided", 50041),
 	FILE_EXCEEDS_MAXIMUM_SIZE: new ApiError("File uploaded exceeds the maximum size", 50045),
 	INVALID_FILE_UPLOADED: new ApiError("Invalid file uploaded", 50046),
 	CANNOT_SELF_REDEEM_GIFT: new ApiError("Cannot self-redeem this gift", 50054),
 	PAYMENT_SOURCE_REQUIRED: new ApiError("Payment source required to redeem gift", 50070),
-	CANNOT_DELETE_COMMUNITY_REQUIRED_CHANNEL: new ApiError("Cannot delete a channel required for Community guilds", 50074),
+	CANNOT_DELETE_COMMUNITY_REQUIRED_CHANNEL: new ApiError(
+		"Cannot delete a channel required for Community guilds",
+		50074
+	),
 	INVALID_STICKER_SENT: new ApiError("Invalid sticker sent", 50081),
 	CANNOT_EDIT_ARCHIVED_THREAD: new ApiError(
 		"Tried to perform an operation on an archived thread, such as editing a message or adding a user to the thread",
 		50083
 	),
 	INVALID_THREAD_NOTIFICATION_SETTINGS: new ApiError("Invalid thread notification settings", 50084),
-	BEFORE_EARLIER_THAN_THREAD_CREATION_DATE: new ApiError("before value is earlier than the thread creation date", 50085),
+	BEFORE_EARLIER_THAN_THREAD_CREATION_DATE: new ApiError(
+		"before value is earlier than the thread creation date",
+		50085
+	),
 	SERVER_NOT_AVAILABLE_IN_YOUR_LOCATION: new ApiError("This server is not available in your location", 50095),
-	SERVER_NEEDS_MONETIZATION_ENABLED: new ApiError("This server needs monetization enabled in order to perform this action", 50097),
+	SERVER_NEEDS_MONETIZATION_ENABLED: new ApiError(
+		"This server needs monetization enabled in order to perform this action",
+		50097
+	),
 	TWO_FACTOR_REQUIRED: new ApiError("Two factor is required for this operation", 60003),
 	NO_USERS_WITH_DISCORDTAG_EXIST: new ApiError("No users with DiscordTag exist", 80004),
 	REACTION_BLOCKED: new ApiError("Reaction was blocked", 90001),
@@ -653,17 +694,33 @@ export const DiscordApiErrors = {
 	THREAD_ALREADY_CREATED_FOR_THIS_MESSAGE: new ApiError("A thread has already been created for this message", 160004),
 	THREAD_IS_LOCKED: new ApiError("Thread is locked", 160005),
 	MAXIMUM_NUMBER_OF_ACTIVE_THREADS: new ApiError("Maximum number of active threads reached", 160006),
-	MAXIMUM_NUMBER_OF_ACTIVE_ANNOUNCEMENT_THREADS: new ApiError("Maximum number of active announcement threads reached", 160007),
+	MAXIMUM_NUMBER_OF_ACTIVE_ANNOUNCEMENT_THREADS: new ApiError(
+		"Maximum number of active announcement threads reached",
+		160007
+	),
 	INVALID_JSON_FOR_UPLOADED_LOTTIE_FILE: new ApiError("Invalid JSON for uploaded Lottie file", 170001),
-	LOTTIES_CANNOT_CONTAIN_RASTERIZED_IMAGES: new ApiError("Uploaded Lotties cannot contain rasterized images such as PNG or JPEG", 170002),
+	LOTTIES_CANNOT_CONTAIN_RASTERIZED_IMAGES: new ApiError(
+		"Uploaded Lotties cannot contain rasterized images such as PNG or JPEG",
+		170002
+	),
 	STICKER_MAXIMUM_FRAMERATE: new ApiError("Sticker maximum framerate exceeded", 170003),
-	STICKER_MAXIMUM_FRAME_COUNT: new ApiError("Sticker frame count exceeds maximum of {} frames", 170004, undefined, ["1000"]),
+	STICKER_MAXIMUM_FRAME_COUNT: new ApiError("Sticker frame count exceeds maximum of {} frames", 170004, undefined, [
+		"1000",
+	]),
 	LOTTIE_ANIMATION_MAXIMUM_DIMENSIONS: new ApiError("Lottie animation maximum dimensions exceeded", 170005),
-	STICKER_FRAME_RATE_TOO_SMALL_OR_TOO_LARGE: new ApiError("Sticker frame rate is either too small or too large", 170006),
-	STICKER_ANIMATION_DURATION_MAXIMUM: new ApiError("Sticker animation duration exceeds maximum of {} seconds", 170007, undefined, ["5"]),
+	STICKER_FRAME_RATE_TOO_SMALL_OR_TOO_LARGE: new ApiError(
+		"Sticker frame rate is either too small or too large",
+		170006
+	),
+	STICKER_ANIMATION_DURATION_MAXIMUM: new ApiError(
+		"Sticker animation duration exceeds maximum of {} seconds",
+		170007,
+		undefined,
+		["5"]
+	),
 
 	//Other errors
-	UNKNOWN_VOICE_STATE: new ApiError("Unknown Voice State", 10065, 404)
+	UNKNOWN_VOICE_STATE: new ApiError("Unknown Voice State", 10065, 404),
 };
 
 /**
@@ -689,7 +746,7 @@ export const MembershipStates = [
 	// They start at 1
 	null,
 	"INVITED",
-	"ACCEPTED"
+	"ACCEPTED",
 ];
 
 /**
@@ -702,7 +759,7 @@ export const WebhookTypes = [
 	// They start at 1
 	null,
 	"Incoming",
-	"Channel Follower"
+	"Channel Follower",
 ];
 
 function keyMirror(arr: string[]) {
diff --git a/util/src/util/index.ts b/util/src/util/index.ts
index 16b98ca3..4e92f017 100644
--- a/util/src/util/index.ts
+++ b/util/src/util/index.ts
@@ -1,13 +1,14 @@
-export * from "./Database";
-
+export * from "./ApiError";
 export * from "./BitField";
-export * from "./Config";
 export * from "./checkToken";
+export * from "./Config";
+export * from "./Constants";
+export * from "./Database";
 export * from "./Event";
 export * from "./Intents";
 export * from "./MessageFlags";
 export * from "./Permissions";
-export * from "./Snowflake";
 export * from "./RabbitMQ";
 export * from "./Regex";
+export * from "./Snowflake";
 export * from "./String";