diff options
author | Featyre <twooter.0g179@simplelogin.co> | 2022-01-23 23:55:43 +0800 |
---|---|---|
committer | Featyre <twooter.0g179@simplelogin.co> | 2022-01-23 23:55:43 +0800 |
commit | a5e06cd02193afe24292a5ae21a9f7e663e2f176 (patch) | |
tree | ab5aa50b774c89e5667717a01c405413782aaa30 /util/src | |
parent | Branding updates (diff) | |
download | server-a5e06cd02193afe24292a5ae21a9f7e663e2f176.tar.xz |
Partial integration of categories and discovery
Diffstat (limited to 'util/src')
-rw-r--r-- | util/src/entities/Categories.ts | 36 | ||||
-rw-r--r-- | util/src/entities/Config.ts | 2 | ||||
-rw-r--r-- | util/src/entities/Guild.ts | 26 | ||||
-rw-r--r-- | util/src/entities/index.ts | 1 |
4 files changed, 43 insertions, 22 deletions
diff --git a/util/src/entities/Categories.ts b/util/src/entities/Categories.ts new file mode 100644 index 00000000..2cf89dbc --- /dev/null +++ b/util/src/entities/Categories.ts @@ -0,0 +1,36 @@ +import { PrimaryColumn, Column, Entity} from "typeorm"; +import { BaseClassWithoutId } from "./BaseClass"; + +// TODO: categories: +// [{ +// "id": 16, +// "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/true +// }] + +@Entity("categories") +export class Categories extends BaseClassWithoutId { // Not using snowflake + + @PrimaryColumn() + id: number; + + @Column() + default: string; + + @Column({ type: "simple-json", nullable: false }) + localizations: string; + + @Column() + is_primary: boolean; + +} + +export interface DefaultCategoryValue { // TODO: Load Default Discord Categories + +} \ No newline at end of file diff --git a/util/src/entities/Config.ts b/util/src/entities/Config.ts index 6993cc09..4da65b36 100644 --- a/util/src/entities/Config.ts +++ b/util/src/entities/Config.ts @@ -158,6 +158,7 @@ export interface ConfigValue { }; guild: { showAllGuildsInDiscovery: boolean; + homeDiscoveryUseRecommendation: boolean; // TODO: Recommendation, privacy concern? autoJoin: { enabled: boolean; guilds: string[]; @@ -354,6 +355,7 @@ export const DefaultConfigOptions: ConfigValue = { }, guild: { showAllGuildsInDiscovery: false, + homeDiscoveryUseRecommendation: false, autoJoin: { enabled: true, canLeave: true, diff --git a/util/src/entities/Guild.ts b/util/src/entities/Guild.ts index 6a1df4d6..65ba2ae2 100644 --- a/util/src/entities/Guild.ts +++ b/util/src/entities/Guild.ts @@ -17,28 +17,6 @@ import { Webhook } from "./Webhook"; // TODO: guild_scheduled_events // TODO: stage_instances // TODO: threads -// 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", @@ -108,6 +86,9 @@ export class Guild extends BaseClass { //TODO: https://discord.com/developers/docs/resources/guild#guild-object-guild-features @Column({ nullable: true }) + primary_category_id: number; + + @Column({ nullable: true }) icon?: string; @Column({ nullable: true }) @@ -306,6 +287,7 @@ export class Guild extends BaseClass { default_message_notifications: 1, // defaults effect: setting the push default at mentions-only will save a lot explicit_content_filter: 0, features: [], + primary_category_id: 0, id: guild_id, max_members: 250000, max_presences: 250000, diff --git a/util/src/entities/index.ts b/util/src/entities/index.ts index c1f979d4..fc18d422 100644 --- a/util/src/entities/index.ts +++ b/util/src/entities/index.ts @@ -3,6 +3,7 @@ export * from "./Attachment"; export * from "./AuditLog"; export * from "./Ban"; export * from "./BaseClass"; +export * from "./Categories"; export * from "./Channel"; export * from "./Config"; export * from "./ConnectedAccount"; |