From 68f6fe58d5266af4a38e86ed2f817df3638f2323 Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Sun, 6 Mar 2022 17:18:35 +1100 Subject: Tsnode support (#580) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ts-node support. debugging is slightly wonky as vscode will not allow breakpoints in modules that aren't bundle, yet. * apparently ts-node compilerOptions.path wasn't needed? on windows I could've sworn it was. * Cleaned up tsconfig.json a bit ( moved tsnode config to own file ). Fixed breakpoints for all modules under tsnode * Removed Microsoft Corp advert * Remove one more Microsoft Corp. ad Signed-off-by: Erkin Alp Güney * Added `tsnode` npm script * Added `typescript-cached-transpile` package to help improve performance Co-authored-by: Erkin Alp Güney --- util/src/util/TraverseDirectory.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'util/src') diff --git a/util/src/util/TraverseDirectory.ts b/util/src/util/TraverseDirectory.ts index 275b7dcc..3d0d6279 100644 --- a/util/src/util/TraverseDirectory.ts +++ b/util/src/util/TraverseDirectory.ts @@ -1,6 +1,9 @@ import { Server, traverseDirectory } from "lambert-server"; -const DEFAULT_FILTER = /^([^\.].*)(? Date: Mon, 7 Mar 2022 21:40:24 +0330 Subject: Type change Changed type for column "content" to "longtext" (you might want to get a back up from your database before updating) --- util/src/entities/Message.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/src') diff --git a/util/src/entities/Message.ts b/util/src/entities/Message.ts index e577d5df..384355f9 100644 --- a/util/src/entities/Message.ts +++ b/util/src/entities/Message.ts @@ -106,7 +106,7 @@ export class Message extends BaseClass { @ManyToOne(() => Application) application?: Application; - @Column({ nullable: true }) + @Column({ type: "longtext", nullable: true }) content?: string; @Column() -- cgit 1.5.1 From 39a3eee45dc16a6e0a1332054ef75daaf9bf8d07 Mon Sep 17 00:00:00 2001 From: RealMANI <96433859+ImAaronFR@users.noreply.github.com> Date: Mon, 7 Mar 2022 21:40:24 +0330 Subject: Revert "Type change" This reverts commit de8b83f7b9bf9f418b49c4221bec35417de219d8. --- util/src/entities/Message.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/src') diff --git a/util/src/entities/Message.ts b/util/src/entities/Message.ts index 384355f9..e577d5df 100644 --- a/util/src/entities/Message.ts +++ b/util/src/entities/Message.ts @@ -106,7 +106,7 @@ export class Message extends BaseClass { @ManyToOne(() => Application) application?: Application; - @Column({ type: "longtext", nullable: true }) + @Column({ nullable: true }) content?: string; @Column() -- cgit 1.5.1 From 4dc7ab3fde1d66861548cf5a5cc55ad169083612 Mon Sep 17 00:00:00 2001 From: Nobody Date: Tue, 8 Mar 2022 10:52:54 -0300 Subject: fix(util): working invisible status type --- util/src/entities/User.ts | 2 +- util/src/interfaces/Status.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'util/src') diff --git a/util/src/entities/User.ts b/util/src/entities/User.ts index 1d18c838..ed7bd4ce 100644 --- a/util/src/entities/User.ts +++ b/util/src/entities/User.ts @@ -360,7 +360,7 @@ export interface UserSettings { render_reactions: boolean; restricted_guilds: string[]; show_current_game: boolean; - status: "online" | "offline" | "dnd" | "idle"; + status: "online" | "offline" | "dnd" | "idle" | "invisible"; stream_notifications_enabled: boolean; theme: "dark" | "white"; // dark timezone_offset: number; // e.g -60 diff --git a/util/src/interfaces/Status.ts b/util/src/interfaces/Status.ts index c4dab586..5d2e1bba 100644 --- a/util/src/interfaces/Status.ts +++ b/util/src/interfaces/Status.ts @@ -1,4 +1,4 @@ -export type Status = "idle" | "dnd" | "online" | "offline"; +export type Status = "idle" | "dnd" | "online" | "offline" | "invisible"; export interface ClientStatus { desktop?: string; // e.g. Windows/Linux/Mac -- cgit 1.5.1 From 4059a00044fd3236d1e86cead24b09ff52893a18 Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Wed, 9 Mar 2022 02:10:23 +1100 Subject: Changing Member.premium_since back from Date to number fixes an error in the Discord electron client related to rendering premium status. (#669) Client throws "Invalid time value", so I'm guessing it's something to do with premium_since not being the date format they want ( allegedly ISO8601, but works with a plain number, so wtf ) --- util/src/entities/Member.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/src') diff --git a/util/src/entities/Member.ts b/util/src/entities/Member.ts index 3c5f9db0..b7406881 100644 --- a/util/src/entities/Member.ts +++ b/util/src/entities/Member.ts @@ -86,7 +86,7 @@ export class Member extends BaseClassWithoutId { joined_at: Date; @Column({ nullable: true }) - premium_since?: Date; + premium_since?: number; @Column() deaf: boolean; -- cgit 1.5.1 From 7d8b4b00cee517404c85010d56eb05cf3967104d Mon Sep 17 00:00:00 2001 From: Xenorio Date: Tue, 8 Mar 2022 19:06:58 +0100 Subject: Change premium_since to bigint --- util/src/entities/Member.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'util/src') diff --git a/util/src/entities/Member.ts b/util/src/entities/Member.ts index b7406881..a246b891 100644 --- a/util/src/entities/Member.ts +++ b/util/src/entities/Member.ts @@ -85,7 +85,7 @@ export class Member extends BaseClassWithoutId { @Column() joined_at: Date; - @Column({ nullable: true }) + @Column({ type: "bigint", nullable: true }) premium_since?: number; @Column() @@ -245,7 +245,7 @@ export class Member extends BaseClassWithoutId { nick: undefined, roles: [guild_id], // @everyone role joined_at: new Date(), - premium_since: new Date(), + premium_since: (new Date()).getTime(), deaf: false, mute: false, pending: false, -- cgit 1.5.1 From 771e9c1cae0d59f5e443c38cbbb88eaa6cab25e5 Mon Sep 17 00:00:00 2001 From: Erkin Alp Güney Date: Wed, 9 Mar 2022 17:41:34 +0300 Subject: Update Rights.ts --- util/src/util/Rights.ts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'util/src') diff --git a/util/src/util/Rights.ts b/util/src/util/Rights.ts index 9a99d393..db5384d0 100644 --- a/util/src/util/Rights.ts +++ b/util/src/util/Rights.ts @@ -65,6 +65,8 @@ export class Rights extends BitField { // inverts the presence confidentiality default (OPERATOR's presence is not routed by default, others' are) for a given user SELF_ADD_DISCOVERABLE: BitFlag(36), // can mark discoverable guilds that they have permissions to mark as discoverable MANAGE_GUILD_DIRECTORY: BitFlag(37), // can change anything in the primary guild directory + POGGERS: BitFlag(38), // can send confetti, screenshake, random user mention (@someone) + USE_ACHIEVEMENTS: BitFlag(39), // can use achievements and cheers INITIATE_INTERACTIONS: BitFlag(40), // can initiate interactions RESPOND_TO_INTERACTIONS: BitFlag(41), // can respond to interactions SEND_BACKDATED_EVENTS: BitFlag(42), // can send backdated events -- cgit 1.5.1 From aa7a5b126be9e23a230d3ec8315ff5fb663df4de Mon Sep 17 00:00:00 2001 From: Erkin Alp Güney Date: Mon, 14 Mar 2022 19:45:25 +0300 Subject: close issue #684 --- api/assets/openapi.json | 4 ++-- api/assets/schemas.json | 4 ++-- util/src/entities/ConnectedAccount.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'util/src') diff --git a/api/assets/openapi.json b/api/assets/openapi.json index 03550323..8e2a54cf 100644 --- a/api/assets/openapi.json +++ b/api/assets/openapi.json @@ -2960,7 +2960,7 @@ "type": { "type": "string" }, - "verifie": { + "verified": { "type": "boolean" }, "visibility": { @@ -2980,7 +2980,7 @@ "type", "user", "user_id", - "verifie", + "verified", "visibility" ] }, diff --git a/api/assets/schemas.json b/api/assets/schemas.json index d531df21..441752ad 100644 --- a/api/assets/schemas.json +++ b/api/assets/schemas.json @@ -355,11 +355,11 @@ "type": { "type": "string" }, - "verifie": { + "verified": { "type": "boolean" } }, - "required": ["name", "type", "verifie"] + "required": ["name", "type", "verified"] } }, "$schema": "http://json-schema.org/draft-07/schema#" diff --git a/util/src/entities/ConnectedAccount.ts b/util/src/entities/ConnectedAccount.ts index b8aa2889..09ae30ab 100644 --- a/util/src/entities/ConnectedAccount.ts +++ b/util/src/entities/ConnectedAccount.ts @@ -2,7 +2,7 @@ import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm"; import { BaseClass } from "./BaseClass"; import { User } from "./User"; -export interface PublicConnectedAccount extends Pick {} +export interface PublicConnectedAccount extends Pick {} @Entity("connected_accounts") export class ConnectedAccount extends BaseClass { @@ -35,7 +35,7 @@ export class ConnectedAccount extends BaseClass { type: string; @Column() - verifie: boolean; + verified: boolean; @Column({ select: false }) visibility: number; -- cgit 1.5.1 From 44ddb97e088c08b799ac27c70d1f0418bb59d4df Mon Sep 17 00:00:00 2001 From: Erkin Alp Güney Date: Sat, 19 Mar 2022 15:17:11 +0300 Subject: add the necessary types for server assisted selfbotting --- util/src/interfaces/Interaction.ts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'util/src') diff --git a/util/src/interfaces/Interaction.ts b/util/src/interfaces/Interaction.ts index 3cafb2d5..5d3aae24 100644 --- a/util/src/interfaces/Interaction.ts +++ b/util/src/interfaces/Interaction.ts @@ -12,11 +12,13 @@ export interface Interaction { } export enum InteractionType { + SelfCommand = 0, Ping = 1, ApplicationCommand = 2, } export enum InteractionResponseType { + SelfCommandResponse = 0, Pong = 1, Acknowledge = 2, ChannelMessage = 3, -- cgit 1.5.1 From 1b087b134afce22d97ed694fa15d1f684b16378e Mon Sep 17 00:00:00 2001 From: Erkin Alp Güney Date: Wed, 23 Mar 2022 22:18:04 +0300 Subject: A few channels on channels - Added a field for retention policies (progress towards #164) - Allowed note to self channels - Added the UNHANDLED type --- util/src/entities/Channel.ts | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'util/src') diff --git a/util/src/entities/Channel.ts b/util/src/entities/Channel.ts index 1cc4a538..f6b1a6b4 100644 --- a/util/src/entities/Channel.ts +++ b/util/src/entities/Channel.ts @@ -14,12 +14,12 @@ import { Webhook } from "./Webhook"; import { DmChannelDTO } from "../dtos"; export enum ChannelType { - GUILD_TEXT = 0, // a text channel within a server + GUILD_TEXT = 0, // a text channel within a guild DM = 1, // a direct message between users - GUILD_VOICE = 2, // a voice channel within a server + GUILD_VOICE = 2, // a voice channel within a guild GROUP_DM = 3, // a direct message between multiple users - GUILD_CATEGORY = 4, // an organizational category that contains up to 50 channels - GUILD_NEWS = 5, // a channel that users can follow and crosspost into their own server + GUILD_CATEGORY = 4, // an organizational category that contains zero or more channels + GUILD_NEWS = 5, // a channel that users can follow and crosspost into a guild or route GUILD_STORE = 6, // a channel in which game developers can sell their game on Discord ENCRYPTED = 7, // end-to-end encrypted channel ENCRYPTED_THREAD = 8, // end-to-end encrypted thread channel @@ -72,7 +72,7 @@ export class Channel extends BaseClass { @ManyToOne(() => Channel) parent?: Channel; - // only for group dms + // for group DMs and owned custom channel types @Column({ nullable: true }) @RelationId((channel: Channel) => channel.owner) owner_id: string; @@ -117,6 +117,9 @@ export class Channel extends BaseClass { }) invites?: Invite[]; + @Column({ nullable: true }) + retention_policy_id?: string; + @OneToMany(() => Message, (message: Message) => message.channel, { cascade: true, orphanedRowAction: "delete", @@ -140,7 +143,7 @@ export class Channel extends BaseClass { orphanedRowAction: "delete", }) webhooks?: Webhook[]; - + // TODO: DM channel static async createChannel( channel: Partial, @@ -182,6 +185,7 @@ export class Channel extends BaseClass { switch (channel.type) { case ChannelType.GUILD_TEXT: + case ChannelType.GUILD_NEWS: case ChannelType.GUILD_VOICE: if (channel.parent_id && !opts?.skipExistsCheck) { const exists = await Channel.findOneOrFail({ id: channel.parent_id }); @@ -191,25 +195,24 @@ export class Channel extends BaseClass { } break; case ChannelType.GUILD_CATEGORY: + case ChannelType.UNHANDLED: break; case ChannelType.DM: case ChannelType.GROUP_DM: throw new HTTPError("You can't create a dm channel in a guild"); - // TODO: check if guild is community server case ChannelType.GUILD_STORE: - case ChannelType.GUILD_NEWS: default: throw new HTTPError("Not yet supported"); } if (!channel.permission_overwrites) channel.permission_overwrites = []; - // TODO: auto generate position + // TODO: eagerly auto generate position of all guild channels channel = { ...channel, ...(!opts?.keepId && { id: Snowflake.generate() }), created_at: new Date(), - position: channel.position || 0, + position: ((channel.type === ChannelType.UNHANDLED) || channel.position) || 0, }; await Promise.all([ @@ -231,11 +234,13 @@ export class Channel extends BaseClass { const otherRecipientsUsers = await User.find({ where: recipients.map((x) => ({ id: x })) }); // TODO: check config for max number of recipients + /** if you want to disallow note to self channels, uncomment the conditional below if (otherRecipientsUsers.length !== recipients.length) { throw new HTTPError("Recipient/s not found"); } + **/ - const type = recipients.length === 1 ? ChannelType.DM : ChannelType.GROUP_DM; + const type = recipients.length > 1 ? ChannelType.DM : ChannelType.GROUP_DM; let channel = null; @@ -288,7 +293,8 @@ export class Channel extends BaseClass { await emitEvent({ event: "CHANNEL_CREATE", data: channel_dto, user_id: creator_user_id }); } - return channel_dto.excludedRecipients([creator_user_id]); + if (recipients.length === 1) return channel_dto; + else return channel_dto.excludedRecipients([creator_user_id]); } static async removeRecipientFromChannel(channel: Channel, user_id: string) { @@ -354,4 +360,5 @@ export interface ChannelPermissionOverwrite { export enum ChannelPermissionOverwriteType { role = 0, member = 1, + group = 2, } -- cgit 1.5.1 From 67011ccc3d4147e47cbc1f728deb73e3e45641c9 Mon Sep 17 00:00:00 2001 From: Erkin Alp Güney Date: Wed, 23 Mar 2022 22:25:46 +0300 Subject: fix the conditional --- util/src/entities/Channel.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/src') diff --git a/util/src/entities/Channel.ts b/util/src/entities/Channel.ts index f6b1a6b4..08be1e02 100644 --- a/util/src/entities/Channel.ts +++ b/util/src/entities/Channel.ts @@ -212,7 +212,7 @@ export class Channel extends BaseClass { ...channel, ...(!opts?.keepId && { id: Snowflake.generate() }), created_at: new Date(), - position: ((channel.type === ChannelType.UNHANDLED) || channel.position) || 0, + position: (channel.type === ChannelType.UNHANDLED ? 0 : channel.position) || 0, }; await Promise.all([ -- cgit 1.5.1 From f1caebe98dfcdeab3c0237f31d77c54e32a12471 Mon Sep 17 00:00:00 2001 From: minhducsun2002 <32769878+minhducsun2002@users.noreply.github.com> Date: Sun, 20 Mar 2022 10:56:25 +0700 Subject: Make member.premium_since ISO8601 timestamp --- util/src/entities/Member.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'util/src') diff --git a/util/src/entities/Member.ts b/util/src/entities/Member.ts index a246b891..928a25d7 100644 --- a/util/src/entities/Member.ts +++ b/util/src/entities/Member.ts @@ -85,8 +85,8 @@ export class Member extends BaseClassWithoutId { @Column() joined_at: Date; - @Column({ type: "bigint", nullable: true }) - premium_since?: number; + @Column() + premium_since?: Date; @Column() deaf: boolean; @@ -245,7 +245,7 @@ export class Member extends BaseClassWithoutId { nick: undefined, roles: [guild_id], // @everyone role joined_at: new Date(), - premium_since: (new Date()).getTime(), + premium_since: new Date(), deaf: false, mute: false, pending: false, -- cgit 1.5.1 From 54ffd87e8e58ed8e04023f4c100e1b7167557ef7 Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Thu, 31 Mar 2022 01:21:40 +1100 Subject: Fix typo in table 'client_relase' -> 'client_release' ( and other of the same typo ) (#703) * Fixed typo in table name 'client_relase' -> 'client_release'. Fixed more typos of the same typo. * Fixed migration ( but dirty lol ) --- api/scripts/droptables.sql | 2 +- api/src/routes/downloads.ts | 6 ++--- .../store/published-listings/applications.ts | 2 +- api/src/routes/store/published-listings/skus.ts | 2 +- api/src/routes/updates.ts | 12 +++++----- bundle/package.json | 2 +- util/src/entities/ClientRelase.ts | 26 ---------------------- util/src/entities/ClientRelease.ts | 26 ++++++++++++++++++++++ util/src/entities/Config.ts | 10 ++++----- util/src/entities/index.ts | 2 +- util/src/migrations/1648643945733-ReleaseTypo.ts | 16 +++++++++++++ 11 files changed, 61 insertions(+), 45 deletions(-) delete mode 100644 util/src/entities/ClientRelase.ts create mode 100644 util/src/entities/ClientRelease.ts create mode 100644 util/src/migrations/1648643945733-ReleaseTypo.ts (limited to 'util/src') diff --git a/api/scripts/droptables.sql b/api/scripts/droptables.sql index 57d1b271..8a852048 100644 --- a/api/scripts/droptables.sql +++ b/api/scripts/droptables.sql @@ -26,6 +26,6 @@ DROP TABLE webhooks; DROP TABLE channels; DROP TABLE members; DROP TABLE guilds; -DROP TABLE client_relase; +DROP TABLE client_release; -- DROP TABLE users; -- DROP TABLE config; \ No newline at end of file diff --git a/api/src/routes/downloads.ts b/api/src/routes/downloads.ts index ad78b62f..ddfc080c 100644 --- a/api/src/routes/downloads.ts +++ b/api/src/routes/downloads.ts @@ -1,6 +1,6 @@ import { Router, Response, Request } from "express"; import { route } from "@fosscord/api"; -import { Relase, Config } from "@fosscord/util"; +import { Release, Config } from "@fosscord/util"; const router = Router(); @@ -12,9 +12,9 @@ router.get("/:branch", route({}), async (req: Request, res: Response) => { if(!platform || !["linux", "osx", "win"].includes(platform.toString())) return res.status(404) - const relase = await Relase.findOneOrFail({ name: client.relases.upstreamVersion }); + const release = await Release.findOneOrFail({ name: client.releases.upstreamVersion }); - res.redirect(relase[`win_url`]); + res.redirect(release[`win_url`]); }); export default router; diff --git a/api/src/routes/store/published-listings/applications.ts b/api/src/routes/store/published-listings/applications.ts index f06a01e4..060a4c3d 100644 --- a/api/src/routes/store/published-listings/applications.ts +++ b/api/src/routes/store/published-listings/applications.ts @@ -18,7 +18,7 @@ router.get("/:id", route({}), async (req: Request, res: Response) => { access_type: 2, name: "", features: [], - relase_date: "", + release_date: "", premium: false, slug: "", flags: 4, diff --git a/api/src/routes/store/published-listings/skus.ts b/api/src/routes/store/published-listings/skus.ts index f06a01e4..060a4c3d 100644 --- a/api/src/routes/store/published-listings/skus.ts +++ b/api/src/routes/store/published-listings/skus.ts @@ -18,7 +18,7 @@ router.get("/:id", route({}), async (req: Request, res: Response) => { access_type: 2, name: "", features: [], - relase_date: "", + release_date: "", premium: false, slug: "", flags: 4, diff --git a/api/src/routes/updates.ts b/api/src/routes/updates.ts index 4682ce7c..cb4577c8 100644 --- a/api/src/routes/updates.ts +++ b/api/src/routes/updates.ts @@ -1,19 +1,19 @@ import { Router, Response, Request } from "express"; import { route } from "@fosscord/api"; -import { Config, Relase } from "@fosscord/util"; +import { Config, Release } from "@fosscord/util"; const router = Router(); router.get("/", route({}), async (req: Request, res: Response) => { const { client } = Config.get(); - const relase = await Relase.findOneOrFail({ name: client.relases.upstreamVersion}) + const release = await Release.findOneOrFail({ name: client.releases.upstreamVersion}) res.json({ - name: relase.name, - pub_date: relase.pub_date, - url: relase.url, - notes: relase.notes + name: release.name, + pub_date: release.pub_date, + url: release.url, + notes: release.notes }); }); diff --git a/bundle/package.json b/bundle/package.json index 3754a3bf..7d68427f 100644 --- a/bundle/package.json +++ b/bundle/package.json @@ -111,4 +111,4 @@ "typescript-json-schema": "^0.50.1", "ws": "^7.4.2" } -} +} \ No newline at end of file diff --git a/util/src/entities/ClientRelase.ts b/util/src/entities/ClientRelase.ts deleted file mode 100644 index e021b82b..00000000 --- a/util/src/entities/ClientRelase.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Column, Entity} from "typeorm"; -import { BaseClass } from "./BaseClass"; - -@Entity("client_relase") -export class Relase extends BaseClass { - @Column() - name: string; - - @Column() - pub_date: string; - - @Column() - url: string; - - @Column() - deb_url: string; - - @Column() - osx_url: string; - - @Column() - win_url: string; - - @Column({ nullable: true }) - notes?: string; -} diff --git a/util/src/entities/ClientRelease.ts b/util/src/entities/ClientRelease.ts new file mode 100644 index 00000000..c5afd307 --- /dev/null +++ b/util/src/entities/ClientRelease.ts @@ -0,0 +1,26 @@ +import { Column, Entity} from "typeorm"; +import { BaseClass } from "./BaseClass"; + +@Entity("client_release") +export class Release extends BaseClass { + @Column() + name: string; + + @Column() + pub_date: string; + + @Column() + url: string; + + @Column() + deb_url: string; + + @Column() + osx_url: string; + + @Column() + win_url: string; + + @Column({ nullable: true }) + notes?: string; +} diff --git a/util/src/entities/Config.ts b/util/src/entities/Config.ts index f4a266dc..8d29b387 100644 --- a/util/src/entities/Config.ts +++ b/util/src/entities/Config.ts @@ -188,8 +188,8 @@ export interface ConfigValue { }, client: { useTestClient: Boolean; - relases: { - useLocalRelases: Boolean; //TODO + releases: { + useLocalRelease: Boolean; //TODO upstreamVersion: string; } }, @@ -222,7 +222,7 @@ export const DefaultConfigOptions: ConfigValue = { }, general: { instanceName: "Fosscord Instance", - instanceDescription: "This is a Fosscord instance made in pre-relase days", + instanceDescription: "This is a Fosscord instance made in pre-release days", frontPage: null, tosPage: null, correspondenceEmail: "noreply@localhost.local", @@ -389,8 +389,8 @@ export const DefaultConfigOptions: ConfigValue = { }, client: { useTestClient: true, - relases: { - useLocalRelases: true, + releases: { + useLocalRelease: true, upstreamVersion: "0.0.264" } }, diff --git a/util/src/entities/index.ts b/util/src/entities/index.ts index fc18d422..f023d5a6 100644 --- a/util/src/entities/index.ts +++ b/util/src/entities/index.ts @@ -27,4 +27,4 @@ export * from "./Template"; export * from "./User"; export * from "./VoiceState"; export * from "./Webhook"; -export * from "./ClientRelase"; \ No newline at end of file +export * from "./ClientRelease"; \ No newline at end of file diff --git a/util/src/migrations/1648643945733-ReleaseTypo.ts b/util/src/migrations/1648643945733-ReleaseTypo.ts new file mode 100644 index 00000000..944b9dd9 --- /dev/null +++ b/util/src/migrations/1648643945733-ReleaseTypo.ts @@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class ReleaseTypo1648643945733 implements MigrationInterface { + name = "ReleaseTypo1648643945733"; + + public async up(queryRunner: QueryRunner): Promise { + //drop table first because typeorm creates it before migrations run + await queryRunner.dropTable("client_release", true); + await queryRunner.renameTable("client_relase", "client_release"); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.dropTable("client_relase", true); + await queryRunner.renameTable("client_release", "client_relase"); + } +} -- cgit 1.5.1 From beba1feb82755fd3f65456e0eae93db5ce0c3a60 Mon Sep 17 00:00:00 2001 From: Erkin Alp Güney Date: Sat, 2 Apr 2022 10:22:54 +0300 Subject: first steps for E2EE support — channel security settings event MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- util/src/entities/Encryption.ts | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 util/src/entities/Encryption.ts (limited to 'util/src') diff --git a/util/src/entities/Encryption.ts b/util/src/entities/Encryption.ts new file mode 100644 index 00000000..3b82ff84 --- /dev/null +++ b/util/src/entities/Encryption.ts @@ -0,0 +1,35 @@ +import { Column, Entity, JoinColumn, ManyToOne, OneToMany, RelationId } from "typeorm"; +import { BaseClass } from "./BaseClass"; +import { Guild } from "./Guild"; +import { PublicUserProjection, User } from "./User"; +import { HTTPError } from "lambert-server"; +import { containsAll, emitEvent, getPermission, Snowflake, trimSpecial, InvisibleCharacters } from "../util"; +import { BitField, BitFieldResolvable, BitFlag } from "../util/BitField"; +import { Recipient } from "./Recipient"; +import { Message } from "./Message"; +import { ReadState } from "./ReadState"; +import { Invite } from "./Invite"; +import { DmChannelDTO } from "../dtos"; + +@Entity("security_settings") +export class SecuritySettings extends BaseClass { + + @Column({nullable: true}) + guild_id: Snowflake; + + @Column({nullable: true}) + channel_id: Snowflake; + + @Column() + encryption_permission_mask: BitField; + + @Column() + allowed_algorithms: string[]; + + @Column() + current_algorithm: string; + + @Column({nullable: true}) + used_since_message: Snowflake; + +} -- cgit 1.5.1 From 6e851f943568b033f055c819a227a040963adef0 Mon Sep 17 00:00:00 2001 From: Erkin Alp Güney Date: Sat, 2 Apr 2022 12:06:14 +0300 Subject: More message types --- util/src/entities/Message.ts | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'util/src') diff --git a/util/src/entities/Message.ts b/util/src/entities/Message.ts index e577d5df..04b04747 100644 --- a/util/src/entities/Message.ts +++ b/util/src/entities/Message.ts @@ -41,8 +41,14 @@ export enum MessageType { CHANNEL_FOLLOW_ADD = 12, GUILD_DISCOVERY_DISQUALIFIED = 14, GUILD_DISCOVERY_REQUALIFIED = 15, + ENCRYPTED = 16, REPLY = 19, APPLICATION_COMMAND = 20, + ROUTE_ADDED = 41, // custom message routing: new route affecting that channel + ROUTE_DISABLED = 42, // custom message routing: given route no longer affecting that channel + ENCRYPTION = 50, + CUSTOM_START = 63, + UNHANDLED = 255 } @Entity("messages") @@ -203,6 +209,7 @@ export interface MessageComponent { } export enum MessageComponentType { + Script = 0, // self command script ActionRow = 1, Button = 2, } -- cgit 1.5.1 From a7481ecaa115358844332645fb5f2238ab26ee68 Mon Sep 17 00:00:00 2001 From: Erkin Alp Güney Date: Sun, 3 Apr 2022 14:49:16 +0300 Subject: Add our custom channel types --- util/src/entities/Channel.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'util/src') diff --git a/util/src/entities/Channel.ts b/util/src/entities/Channel.ts index 08be1e02..4bf81901 100644 --- a/util/src/entities/Channel.ts +++ b/util/src/entities/Channel.ts @@ -20,13 +20,17 @@ export enum ChannelType { GROUP_DM = 3, // a direct message between multiple users GUILD_CATEGORY = 4, // an organizational category that contains zero or more channels GUILD_NEWS = 5, // a channel that users can follow and crosspost into a guild or route - GUILD_STORE = 6, // a channel in which game developers can sell their game on Discord + GUILD_STORE = 6, // a channel in which game developers can sell their things ENCRYPTED = 7, // end-to-end encrypted channel ENCRYPTED_THREAD = 8, // end-to-end encrypted thread channel + TRANSACTIONAL = 9, // event chain style transactional channel GUILD_NEWS_THREAD = 10, // a temporary sub-channel within a GUILD_NEWS channel GUILD_PUBLIC_THREAD = 11, // a temporary sub-channel within a GUILD_TEXT channel GUILD_PRIVATE_THREAD = 12, // a temporary sub-channel within a GUILD_TEXT channel that is only viewable by those invited and those with the MANAGE_THREADS permission GUILD_STAGE_VOICE = 13, // a voice channel for hosting events with an audience + TICKET_TRACKER = 33, // ticket tracker, individual ticket items shall have type 12 + KANBAN = 34, // confluence like kanban board + VOICELESS_WHITEBOARD = 35, // whiteboard but without voice (whiteboard + voice is the same as stage) CUSTOM_START = 64, // start custom channel types from here UNHANDLED = 255 // unhandled unowned pass-through channel type } -- cgit 1.5.1 From 99a5030530267b24ba923cdd75ee83df2e7f7c30 Mon Sep 17 00:00:00 2001 From: Erkin Alp Güney Date: Mon, 4 Apr 2022 18:22:37 +0300 Subject: Revert "Make member.premium_since ISO8601 timestamp" (#710) This reverts commit f1caebe98dfcdeab3c0237f31d77c54e32a12471. --- util/src/entities/Member.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'util/src') diff --git a/util/src/entities/Member.ts b/util/src/entities/Member.ts index 928a25d7..a246b891 100644 --- a/util/src/entities/Member.ts +++ b/util/src/entities/Member.ts @@ -85,8 +85,8 @@ export class Member extends BaseClassWithoutId { @Column() joined_at: Date; - @Column() - premium_since?: Date; + @Column({ type: "bigint", nullable: true }) + premium_since?: number; @Column() deaf: boolean; @@ -245,7 +245,7 @@ export class Member extends BaseClassWithoutId { nick: undefined, roles: [guild_id], // @everyone role joined_at: new Date(), - premium_since: new Date(), + premium_since: (new Date()).getTime(), deaf: false, mute: false, pending: false, -- cgit 1.5.1 From ecf59d30c55181b25493c170819d2bb223ef28ba Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Tue, 5 Apr 2022 19:58:34 +1000 Subject: User Notes (#707) * Notes implementation. Bug: Client does not save note locally after uploading to server. Client does save after reloading page. Is this due to the response being sent by PUT? * I don't know why the client doesn't do optimistic UI updates with this, or any updates at all without reloading the page * Added USER_NOTE_UPDATE event, thanks @TheRealGeoDash2019 ! --- api/src/routes/users/@me/notes.ts | 35 ++++++++++++++++++++++++++++++----- util/src/entities/User.ts | 4 ++++ util/src/interfaces/Event.ts | 1 + 3 files changed, 35 insertions(+), 5 deletions(-) (limited to 'util/src') diff --git a/api/src/routes/users/@me/notes.ts b/api/src/routes/users/@me/notes.ts index 96067bf5..4887b191 100644 --- a/api/src/routes/users/@me/notes.ts +++ b/api/src/routes/users/@me/notes.ts @@ -1,14 +1,39 @@ import { Request, Response, Router } from "express"; import { route } from "@fosscord/api"; +import { User, emitEvent } from "@fosscord/util"; const router: Router = Router(); +router.get("/:id", route({}), async (req: Request, res: Response) => { + const { id } = req.params; + const user = await User.findOneOrFail({ where: { id: req.user_id }, select: ["notes"] }); + + const note = user.notes[id]; + return res.json({ + note: note, + note_user_id: id, + user_id: user.id, + }); +}); + router.put("/:id", route({}), async (req: Request, res: Response) => { - //TODO - res.json({ - message: "Unknown User", - code: 10013 - }).status(404); + const { id } = req.params; + const user = await User.findOneOrFail({ where: { id: req.user_id } }); + const noteUser = await User.findOneOrFail({ where: { id: id }}); //if noted user does not exist throw + const { note } = req.body; + + await User.update({ id: req.user_id }, { notes: { ...user.notes, [noteUser.id]: note } }); + + await emitEvent({ + event: "USER_NOTE_UPDATE", + data: { + note: note, + id: noteUser.id + }, + user_id: user.id, + }) + + return res.status(204); }); export default router; diff --git a/util/src/entities/User.ts b/util/src/entities/User.ts index ed7bd4ce..7091ee24 100644 --- a/util/src/entities/User.ts +++ b/util/src/entities/User.ts @@ -164,6 +164,9 @@ export class User extends BaseClass { @Column({ type: "simple-json", select: false }) settings: UserSettings; + @Column({ type: "simple-json" }) + notes: { [key: string]: string }; //key is ID of user + toPublicUser() { const user: any = {}; PublicUserProjection.forEach((x) => { @@ -271,6 +274,7 @@ export class User extends BaseClass { }, settings: { ...defaultSettings, locale: language }, fingerprints: [], + notes: {}, }); await user.save(); diff --git a/util/src/interfaces/Event.ts b/util/src/interfaces/Event.ts index a5253c09..416082ed 100644 --- a/util/src/interfaces/Event.ts +++ b/util/src/interfaces/Event.ts @@ -623,6 +623,7 @@ export type EVENT = | "PRESENCE_UPDATE" | "TYPING_START" | "USER_UPDATE" + | "USER_NOTE_UPDATE" | "WEBHOOKS_UPDATE" | "INTERACTION_CREATE" | "VOICE_STATE_UPDATE" -- cgit 1.5.1 From 7bb42cb1ff51b53a0183e6801f36062acbf1d8e5 Mon Sep 17 00:00:00 2001 From: Erkin Alp Güney Date: Thu, 7 Apr 2022 17:49:44 +0300 Subject: with public read receipts explicitly stored, no need to store manual flag of the read mark --- util/src/entities/ReadState.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'util/src') diff --git a/util/src/entities/ReadState.ts b/util/src/entities/ReadState.ts index e6d73105..b915573b 100644 --- a/util/src/entities/ReadState.ts +++ b/util/src/entities/ReadState.ts @@ -49,6 +49,7 @@ export class ReadState extends BaseClass { @Column({ nullable: true }) mention_count: number; - @Column({ nullable: true }) + // @Column({ nullable: true }) + // TODO: derive this from (last_message_id=notifications_cursor=public_ack)=true manual: boolean; } -- cgit 1.5.1 From f33f9c6964f17f267039d96002b51b3ccf50beb2 Mon Sep 17 00:00:00 2001 From: Erkin Alp Güney Date: Thu, 7 Apr 2022 23:47:26 +0300 Subject: More rights stuff --- util/src/util/Rights.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'util/src') diff --git a/util/src/util/Rights.ts b/util/src/util/Rights.ts index db5384d0..dedbfe30 100644 --- a/util/src/util/Rights.ts +++ b/util/src/util/Rights.ts @@ -1,6 +1,7 @@ import { BitField } from "./BitField"; import "missing-native-js-functions"; import { BitFieldResolvable, BitFlag } from "./BitField"; +import { User } from "../entities"; var HTTPError: any; @@ -85,6 +86,16 @@ export class Rights extends BitField { // @ts-ignore throw new HTTPError(`You are missing the following rights ${permission}`, 403); } + + export async function getRight( + user_id: string, + /** opts: { + in_behalf?: (keyof User)[]; + } = {} **/) + { + user = await User.findOneOrFail({ where: { id: user_id } }); + return new Rights(user.right); + } } const ALL_RIGHTS = Object.values(Rights.FLAGS).reduce((total, val) => total | val, BigInt(0)); -- cgit 1.5.1 From 6482b112c427727d46efbb65b0f0ce78893e5049 Mon Sep 17 00:00:00 2001 From: Erkin Alp Güney Date: Fri, 8 Apr 2022 10:26:20 +0300 Subject: fix the build mistakes from yesternight --- .../#channel_id/messages/#message_id/index.ts | 19 ++++++++++++------- util/src/util/Rights.ts | 17 ++++++++--------- 2 files changed, 20 insertions(+), 16 deletions(-) (limited to 'util/src') diff --git a/api/src/routes/channels/#channel_id/messages/#message_id/index.ts b/api/src/routes/channels/#channel_id/messages/#message_id/index.ts index bdc34a81..58dfb1cc 100644 --- a/api/src/routes/channels/#channel_id/messages/#message_id/index.ts +++ b/api/src/routes/channels/#channel_id/messages/#message_id/index.ts @@ -1,4 +1,4 @@ -import { Channel, emitEvent, getPermission, getRight MessageDeleteEvent, Message, MessageUpdateEvent } from "@fosscord/util"; +import { Channel, emitEvent, getPermission, getRights, MessageDeleteEvent, Message, MessageUpdateEvent } from "@fosscord/util"; import { Router, Response, Request } from "express"; import { route } from "@fosscord/api"; import { handleMessage, postHandleMessage } from "@fosscord/api"; @@ -18,9 +18,11 @@ router.patch("/", route({ body: "MessageCreateSchema", permission: "SEND_MESSAGE const rights = await getRights(req.user_id); if ((req.user_id !== message.author_id)) { - if (rights.has("MANAGE_MESSAGES")) break; - permissions.hasThrow("MANAGE_MESSAGES"); - body = { flags: body.flags }; // admins can only suppress embeds of other messages + if (!rights.has("MANAGE_MESSAGES")) { + permissions.hasThrow("MANAGE_MESSAGES"); + body = { flags: body.flags }; +// guild admins can only suppress embeds of other messages, no such restriction imposed to instance-wide admins + } } else rights.hasThrow("SELF_EDIT_MESSAGES"); const new_message = await handleMessage({ @@ -54,11 +56,14 @@ router.delete("/", route({}), async (req: Request, res: Response) => { const channel = await Channel.findOneOrFail({ id: channel_id }); const message = await Message.findOneOrFail({ id: message_id }); + + const rights = await getRights(req.user_id); if ((message.author_id !== req.user_id)) { - if (rights.has("MANAGE_MESSAGES")) break; - const permission = await getPermission(req.user_id, channel.guild_id, channel_id); - permission.hasThrow("MANAGE_MESSAGES"); + if (!rights.has("MANAGE_MESSAGES")) { + const permission = await getPermission(req.user_id, channel.guild_id, channel_id); + permission.hasThrow("MANAGE_MESSAGES"); + } } else rights.hasThrow("SELF_DELETE_MESSAGES"); await Message.delete({ id: message_id }); diff --git a/util/src/util/Rights.ts b/util/src/util/Rights.ts index dedbfe30..35ad9514 100644 --- a/util/src/util/Rights.ts +++ b/util/src/util/Rights.ts @@ -87,15 +87,14 @@ export class Rights extends BitField { throw new HTTPError(`You are missing the following rights ${permission}`, 403); } - export async function getRight( - user_id: string, - /** opts: { - in_behalf?: (keyof User)[]; - } = {} **/) - { - user = await User.findOneOrFail({ where: { id: user_id } }); - return new Rights(user.right); - } } const ALL_RIGHTS = Object.values(Rights.FLAGS).reduce((total, val) => total | val, BigInt(0)); + +export async function getRights( user_id: string + /**, opts: { + in_behalf?: (keyof User)[]; + } = {} **/) { + let user = await User.findOneOrFail({ where: { id: user_id } }); + return new Rights(user.rights); +} -- cgit 1.5.1 From 9b2976d6b1aa8ef2f3a744f950daeda74485bbad Mon Sep 17 00:00:00 2001 From: Erkin Alp Güney Date: Fri, 8 Apr 2022 10:53:05 +0300 Subject: add joined_by to allow for separate treatment of force-joiners --- util/src/entities/Member.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'util/src') diff --git a/util/src/entities/Member.ts b/util/src/entities/Member.ts index a246b891..ae889a85 100644 --- a/util/src/entities/Member.ts +++ b/util/src/entities/Member.ts @@ -70,7 +70,7 @@ export class Member extends BaseClassWithoutId { @Column({ nullable: true }) nick?: string; - + @JoinTable({ name: "member_roles", joinColumn: { name: "index", referencedColumnName: "index" }, @@ -102,8 +102,17 @@ export class Member extends BaseClassWithoutId { @Column({ nullable: true }) last_message_id?: string; + + /** + @JoinColumn({ name: "id" }) + @ManyToOne(() => User, { + onDelete: "DO NOTHING", + // do not auto-kick force-joined members just because their joiners left the server + }) **/ + @Column({ nullable: true }) + joined_by: string; - // TODO: update + // TODO: add this when we have proper read receipts // @Column({ type: "simple-json" }) // read_state: ReadState; -- cgit 1.5.1 From 627e06f7831d9e13c583298d9994b9377baa80e7 Mon Sep 17 00:00:00 2001 From: Erkin Alp Güney Date: Fri, 8 Apr 2022 10:53:49 +0300 Subject: optional --- util/src/entities/Member.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'util/src') diff --git a/util/src/entities/Member.ts b/util/src/entities/Member.ts index ae889a85..fe2d5590 100644 --- a/util/src/entities/Member.ts +++ b/util/src/entities/Member.ts @@ -109,8 +109,8 @@ export class Member extends BaseClassWithoutId { onDelete: "DO NOTHING", // do not auto-kick force-joined members just because their joiners left the server }) **/ - @Column({ nullable: true }) - joined_by: string; + @Column({ nullable: true}) + joined_by?: string; // TODO: add this when we have proper read receipts // @Column({ type: "simple-json" }) -- cgit 1.5.1 From 34a36f7a856308882fdc1162a4006205e0ce5c25 Mon Sep 17 00:00:00 2001 From: Erkin Alp Güney Date: Sat, 9 Apr 2022 13:46:50 +0300 Subject: Update User.ts --- util/src/entities/User.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'util/src') diff --git a/util/src/entities/User.ts b/util/src/entities/User.ts index 7091ee24..42d926b2 100644 --- a/util/src/entities/User.ts +++ b/util/src/entities/User.ts @@ -60,7 +60,7 @@ export class User extends BaseClass { username: string; // username max length 32, min 2 (should be configurable) @Column() - discriminator: string; // #0001 4 digit long string from #0001 - #9999 + discriminator: string; // opaque string: 4 digits on discord.com setDiscriminator(val: string) { const number = Number(val); @@ -88,10 +88,10 @@ export class User extends BaseClass { mobile: boolean; // if the user has mobile app installed @Column() - premium: boolean; // if user bought nitro - + premium: boolean; // if user bought individual premium + @Column() - premium_type: number; // nitro level + premium_type: number; // individual premium level @Column() bot: boolean; // if user is bot @@ -100,11 +100,11 @@ export class User extends BaseClass { bio: string; // short description of the user (max 190 chars -> should be configurable) @Column() - system: boolean; // shouldn't be used, the api sents this field type true, if the generated message comes from a system generated author + system: boolean; // shouldn't be used, the api sends this field type true, if the generated message comes from a system generated author @Column({ select: false }) - nsfw_allowed: boolean; // if the user is older than 18 (resp. Config) - + nsfw_allowed: boolean; // if the user can do age-restricted actions (NSFW channels/guilds/commands) + @Column({ select: false }) mfa_enabled: boolean; // if multi factor authentication is enabled -- cgit 1.5.1 From 9f2e9d5faf416bf2631b046a343682fc2dfb0902 Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Sat, 9 Apr 2022 23:53:57 +1000 Subject: Resolves #715 --- util/src/entities/User.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/src') diff --git a/util/src/entities/User.ts b/util/src/entities/User.ts index 42d926b2..a5c4c136 100644 --- a/util/src/entities/User.ts +++ b/util/src/entities/User.ts @@ -132,7 +132,7 @@ export class User extends BaseClass { @Column() public_flags: number; - @Column() + @Column({ type: "bigint" }) rights: string; // Rights @OneToMany(() => Session, (session: Session) => session.user) -- cgit 1.5.1 From f30c3223b3a1696a83f68d13178888de90b0242c Mon Sep 17 00:00:00 2001 From: 1itt1eB0y Date: Sat, 9 Apr 2022 22:43:38 +0800 Subject: bug fix Fix `QueryFailedError: constraint "FK_05535bc695e9f7ee104616459d3" for relation "messages" already exists` --- util/src/entities/Message.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/src') diff --git a/util/src/entities/Message.ts b/util/src/entities/Message.ts index 04b04747..b32bbd94 100644 --- a/util/src/entities/Message.ts +++ b/util/src/entities/Message.ts @@ -90,7 +90,7 @@ export class Message extends BaseClass { @RelationId((message: Message) => message.member) member_id: string; - @JoinColumn({ name: "author_id", referencedColumnName: "id" }) + @JoinColumn({ name: "member_id", referencedColumnName: "id" }) @ManyToOne(() => User, { onDelete: "CASCADE", }) -- cgit 1.5.1 From 6b57c358fc5d72620673691e03c368513d8e5a65 Mon Sep 17 00:00:00 2001 From: Erkin Alp Güney Date: Sun, 10 Apr 2022 13:54:05 +0300 Subject: Update Guild.ts --- util/src/entities/Guild.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'util/src') diff --git a/util/src/entities/Guild.ts b/util/src/entities/Guild.ts index 9ac148ee..70bb41c5 100644 --- a/util/src/entities/Guild.ts +++ b/util/src/entities/Guild.ts @@ -187,11 +187,11 @@ export class Guild extends BaseClass { @Column({ nullable: true }) @RelationId((guild: Guild) => guild.owner) - owner_id: string; + owner_id?: string; // optional to allow for ownerless guilds @JoinColumn({ name: "owner_id", referencedColumnName: "id" }) @ManyToOne(() => User) - owner: User; + owner?: User; // optional to allow for ownerless guilds @Column({ nullable: true }) preferred_locale?: string; @@ -200,7 +200,7 @@ export class Guild extends BaseClass { premium_subscription_count?: number; @Column({ nullable: true }) - premium_tier?: number; // nitro boost level + premium_tier?: number; // crowd premium level @Column({ nullable: true }) @RelationId((guild: Guild) => guild.public_updates_channel) @@ -269,6 +269,10 @@ export class Guild extends BaseClass { @Column({ nullable: true }) nsfw?: boolean; + + // TODO: nested guilds + @Column({ nullable: true }) + parent?: string; // only for developer portal permissions?: number; @@ -308,7 +312,7 @@ export class Guild extends BaseClass { verification_level: 0, welcome_screen: { enabled: false, - description: "No description", + description: "Fill in your description", welcome_channels: [], }, widget_enabled: true, // NB: don't set it as false to prevent artificial restrictions -- cgit 1.5.1