summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-10-15 00:03:19 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-10-15 00:03:19 +0200
commitc1d786b6e1a9b8562e7ea05ae08934d92abff270 (patch)
tree9ef4378a0061f4155f24242dd85364779583d8b3
parent:bug: fix message sticker sending (diff)
downloadserver-c1d786b6e1a9b8562e7ea05ae08934d92abff270.tar.xz
:bug: fix sticker packs
-rw-r--r--api/src/routes/sticker-packs/index.ts6
-rw-r--r--gateway/src/opcodes/Identify.ts2
-rw-r--r--util/src/entities/StickerPack.ts8
3 files changed, 10 insertions, 6 deletions
diff --git a/api/src/routes/sticker-packs/index.ts b/api/src/routes/sticker-packs/index.ts
index 89b91bdb..e6560d12 100644
--- a/api/src/routes/sticker-packs/index.ts
+++ b/api/src/routes/sticker-packs/index.ts
@@ -1,11 +1,13 @@
 import { Request, Response, Router } from "express";
 import { route } from "@fosscord/api";
-import { StickerPack } from "@fosscord/util/src/entities/StickerPack";
+import { StickerPack } from "@fosscord/util";
 
 const router: Router = Router();
 
 router.get("/", route({}), async (req: Request, res: Response) => {
-	res.json(await StickerPack.find({}));
+	const sticker_packs = await StickerPack.find({ relations: ["stickers"] });
+
+	res.json({ sticker_packs });
 });
 
 export default router;
diff --git a/gateway/src/opcodes/Identify.ts b/gateway/src/opcodes/Identify.ts
index c91ca5dd..2f9d4632 100644
--- a/gateway/src/opcodes/Identify.ts
+++ b/gateway/src/opcodes/Identify.ts
@@ -179,6 +179,8 @@ export async function onIdentify(this: WebSocket, data: Payload) {
 			x.guild_hashes = {}; // @ts-ignore
 			x.guild_scheduled_events = []; // @ts-ignore
 			x.threads = [];
+			x.premium_subscription_count = 30;
+			x.premium_tier = 3;
 			return x;
 		}),
 		guild_experiments: [], // TODO
diff --git a/util/src/entities/StickerPack.ts b/util/src/entities/StickerPack.ts
index b80fa9c7..ec8c69a2 100644
--- a/util/src/entities/StickerPack.ts
+++ b/util/src/entities/StickerPack.ts
@@ -1,8 +1,8 @@
-import { Column, Entity, JoinColumn, OneToMany, OneToOne, RelationId } from "typeorm";
+import { Column, Entity, JoinColumn, ManyToOne, OneToMany, OneToOne, RelationId } from "typeorm";
 import { Sticker } from ".";
 import { BaseClass } from "./BaseClass";
 
-@Entity("stickers")
+@Entity("sticker_packs")
 export class StickerPack extends BaseClass {
 	@Column()
 	name: string;
@@ -13,7 +13,7 @@ export class StickerPack extends BaseClass {
 	@Column({ nullable: true })
 	banner_asset_id?: string;
 
-	@OneToMany(() => Sticker, (sticker: Sticker) => sticker.pack_id, {
+	@OneToMany(() => Sticker, (sticker: Sticker) => sticker.pack, {
 		cascade: true,
 		orphanedRowAction: "delete",
 	})
@@ -25,7 +25,7 @@ export class StickerPack extends BaseClass {
 	@RelationId((pack: StickerPack) => pack.cover_sticker)
 	cover_sticker_id?: string;
 
-	@OneToOne(() => Sticker, { nullable: true })
+	@ManyToOne(() => Sticker, { nullable: true })
 	@JoinColumn()
 	cover_sticker?: Sticker;
 }