diff --git a/src/util/entities/Application.ts b/src/util/entities/Application.ts
index 67475bdd..e37f5ee5 100644
--- a/src/util/entities/Application.ts
+++ b/src/util/entities/Application.ts
@@ -1,4 +1,11 @@
-import { Column, Entity, JoinColumn, ManyToOne, OneToOne, RelationId } from "typeorm";
+import {
+ Column,
+ Entity,
+ JoinColumn,
+ ManyToOne,
+ OneToOne,
+ RelationId,
+} from "typeorm";
import { BaseClass } from "./BaseClass";
import { Guild } from "./Guild";
import { Team } from "./Team";
@@ -8,78 +15,78 @@ import { User } from "./User";
export class Application extends BaseClass {
@Column()
name: string;
-
+
@Column({ nullable: true })
icon?: string;
-
+
@Column({ nullable: true })
description: string;
-
+
@Column({ nullable: true })
summary: string = "";
-
+
@Column({ type: "simple-json", nullable: true })
type?: any;
-
+
@Column()
hook: boolean = true;
-
+
@Column()
bot_public?: boolean = true;
-
+
@Column()
bot_require_code_grant?: boolean = false;
-
+
@Column()
verify_key: string;
-
+
@JoinColumn({ name: "owner_id" })
@ManyToOne(() => User)
owner: User;
-
+
// TODO: enum this? https://discord.com/developers/docs/resources/application#application-object-application-flags
@Column()
flags: number = 0;
-
+
@Column({ type: "simple-array", nullable: true })
redirect_uris: string[] = [];
-
+
@Column({ nullable: true })
rpc_application_state: number = 0;
-
+
@Column({ nullable: true })
store_application_state: number = 1;
-
+
@Column({ nullable: true })
verification_state: number = 1;
-
+
@Column({ nullable: true })
interactions_endpoint_url?: string;
-
+
@Column({ nullable: true })
integration_public: boolean = true;
-
+
@Column({ nullable: true })
integration_require_code_grant: boolean = false;
-
+
@Column({ nullable: true })
discoverability_state: number = 1;
-
+
@Column({ nullable: true })
discovery_eligibility_flags: number = 2240;
-
+
@JoinColumn({ name: "bot_user_id" })
@OneToOne(() => User)
bot?: User;
-
+
@Column({ type: "simple-array", nullable: true })
tags?: string[];
-
+
@Column({ nullable: true })
cover_image?: string; // the application's default rich presence invite cover image hash
-
+
@Column({ type: "simple-json", nullable: true })
- install_params?: {scopes: string[], permissions: string};
+ install_params?: { scopes: string[]; permissions: string };
@Column({ nullable: true })
terms_of_service_url?: string;
@@ -91,7 +98,7 @@ export class Application extends BaseClass {
//@Column({ type: "simple-array", nullable: true })
//rpc_origins?: string[];
-
+
//@JoinColumn({ name: "guild_id" })
//@ManyToOne(() => Guild)
//guild?: Guild; // if this application is a game sold, this field will be the guild to which it has been linked
@@ -105,11 +112,10 @@ export class Application extends BaseClass {
@JoinColumn({ name: "team_id" })
@ManyToOne(() => Team, {
onDelete: "CASCADE",
- nullable: true
+ nullable: true,
})
team?: Team;
-
- }
+}
export interface ApplicationCommand {
id: string;
diff --git a/src/util/entities/Channel.ts b/src/util/entities/Channel.ts
index e9e631f1..aaddc001 100644
--- a/src/util/entities/Channel.ts
+++ b/src/util/entities/Channel.ts
@@ -209,7 +209,10 @@ export class Channel extends BaseClass {
);
// Categories skip these checks on discord.com
- if (channel.type !== ChannelType.GUILD_CATEGORY || guild.features.includes("IRC_LIKE_CATEGORY_NAMES")) {
+ if (
+ channel.type !== ChannelType.GUILD_CATEGORY ||
+ guild.features.includes("IRC_LIKE_CATEGORY_NAMES")
+ ) {
if (channel.name.includes(" "))
throw new HTTPError(
"Channel name cannot include invalid characters",
@@ -286,10 +289,10 @@ export class Channel extends BaseClass {
Channel.create(channel).save(),
!opts?.skipEventEmit
? emitEvent({
- event: "CHANNEL_CREATE",
- data: channel,
- guild_id: channel.guild_id,
- } as ChannelCreateEvent)
+ event: "CHANNEL_CREATE",
+ data: channel,
+ guild_id: channel.guild_id,
+ } as ChannelCreateEvent)
: Promise.resolve(),
]);
diff --git a/src/util/entities/EmbedCache.ts b/src/util/entities/EmbedCache.ts
index 14881ccf..e182b8c2 100644
--- a/src/util/entities/EmbedCache.ts
+++ b/src/util/entities/EmbedCache.ts
@@ -9,4 +9,4 @@ export class EmbedCache extends BaseClass {
@Column({ type: "simple-json" })
embed: Embed;
-}
\ No newline at end of file
+}
diff --git a/src/util/entities/Guild.ts b/src/util/entities/Guild.ts
index c86a5787..7f3536fa 100644
--- a/src/util/entities/Guild.ts
+++ b/src/util/entities/Guild.ts
@@ -79,7 +79,8 @@ export class Guild extends BaseClass {
banner?: string;
@Column({ nullable: true })
- default_message_notifications?: number = Config.get().defaults.guild.defaultMessageNotifications;
+ default_message_notifications?: number =
+ Config.get().defaults.guild.defaultMessageNotifications;
@Column({ nullable: true })
description?: string;
@@ -88,7 +89,8 @@ export class Guild extends BaseClass {
discovery_splash?: string;
@Column({ nullable: true })
- explicit_content_filter?: number = Config.get().defaults.guild.explicitContentFilter;
+ explicit_content_filter?: number =
+ Config.get().defaults.guild.explicitContentFilter;
@Column({ type: "simple-array" })
features: string[] = Config.get().guild.defaultFeatures || []; //TODO use enum
@@ -110,7 +112,8 @@ export class Guild extends BaseClass {
max_presences?: number = Config.get().defaults.guild.maxPresences;
@Column({ nullable: true })
- max_video_channel_users?: number = Config.get().defaults.guild.maxVideoChannelUsers;
+ max_video_channel_users?: number =
+ Config.get().defaults.guild.maxVideoChannelUsers;
@Column({ nullable: true })
member_count?: number;
diff --git a/src/util/entities/Invite.ts b/src/util/entities/Invite.ts
index 8f5619fc..4b71ed02 100644
--- a/src/util/entities/Invite.ts
+++ b/src/util/entities/Invite.ts
@@ -1,10 +1,4 @@
-import {
- Column,
- Entity,
- JoinColumn,
- ManyToOne,
- RelationId,
-} from "typeorm";
+import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
import { Member } from "./Member";
import { BaseClassWithoutId, PrimaryIdColumn } from "./BaseClass";
import { Channel } from "./Channel";
@@ -62,7 +56,7 @@ export class Invite extends BaseClassWithoutId {
@JoinColumn({ name: "inviter_id" })
@ManyToOne(() => User, {
- onDelete: "CASCADE"
+ onDelete: "CASCADE",
})
inviter: User;
diff --git a/src/util/entities/Member.ts b/src/util/entities/Member.ts
index eeae181e..f8a91f85 100644
--- a/src/util/entities/Member.ts
+++ b/src/util/entities/Member.ts
@@ -125,9 +125,9 @@ export class Member extends BaseClassWithoutId {
@Column()
bio: string;
-
+
@Column({ nullable: true, type: "simple-array" })
- theme_colors?: number[]; // TODO: Separate `User` and `UserProfile` models
+ theme_colors?: number[]; // TODO: Separate `User` and `UserProfile` models
@Column({ nullable: true })
pronouns?: string;
@@ -309,9 +309,9 @@ export class Member extends BaseClassWithoutId {
guild_id,
user: {
sessions: {
- status: Not("invisible" as "invisible") // lol typescript?
- }
- }
+ status: Not("invisible" as "invisible"), // lol typescript?
+ },
+ },
},
take: 10,
});
@@ -380,7 +380,7 @@ export class Member extends BaseClassWithoutId {
stage_instances: [],
threads: [],
embedded_activities: [],
- voice_states: guild.voice_states
+ voice_states: guild.voice_states,
},
user_id,
} as GuildCreateEvent),
diff --git a/src/util/entities/User.ts b/src/util/entities/User.ts
index e039eb17..34b7ea0e 100644
--- a/src/util/entities/User.ts
+++ b/src/util/entities/User.ts
@@ -15,13 +15,7 @@ import { ConnectedAccount } from "./ConnectedAccount";
import { Member } from "./Member";
import { UserSettings } from "./UserSettings";
import { Session } from "./Session";
-import {
- Config,
- FieldErrors,
- Snowflake,
- trimSpecial,
- adjustEmail,
-} from "..";
+import { Config, FieldErrors, Snowflake, trimSpecial, adjustEmail } from "..";
export enum PublicUserEnum {
username,
@@ -68,7 +62,7 @@ export const PrivateUserProjection = [
// Private user data that should never get sent to the client
export type PublicUser = Pick<User, PublicUserKeys>;
-export interface UserPublic extends Pick<User, PublicUserKeys> { }
+export interface UserPublic extends Pick<User, PublicUserKeys> {}
export interface UserPrivate extends Pick<User, PrivateUserKeys> {
locale: string;
@@ -92,7 +86,7 @@ export class User extends BaseClass {
banner?: string; // hash of the user banner
@Column({ nullable: true, type: "simple-array" })
- theme_colors?: number[]; // TODO: Separate `User` and `UserProfile` models
+ theme_colors?: number[]; // TODO: Separate `User` and `UserProfile` models
@Column({ nullable: true })
pronouns?: string;
@@ -140,7 +134,7 @@ export class User extends BaseClass {
premium_since: Date = new Date(); // premium date
@Column({ select: false })
- verified: boolean = true; // email is verified
+ verified: boolean = true; // email is verified
@Column()
disabled: boolean = false; // if the account is disabled
@@ -203,7 +197,7 @@ export class User extends BaseClass {
@OneToOne(() => UserSettings, {
cascade: true,
orphanedRowAction: "delete",
- eager: false
+ eager: false,
})
@JoinColumn()
settings: UserSettings;
@@ -270,7 +264,9 @@ export class User extends BaseClass {
});
}
- public static async generateDiscriminator(username: string): Promise<string | undefined> {
+ public static async generateDiscriminator(
+ username: string,
+ ): Promise<string | undefined> {
if (Config.get().register.incrementingDiscriminators) {
// discriminator will be incrementally generated
@@ -322,7 +318,7 @@ export class User extends BaseClass {
password?: string;
email?: string;
date_of_birth?: Date; // "2000-04-03"
- id?: string,
+ id?: string;
req?: any;
}) {
// trim special uf8 control characters -> Backspace, Newline, ...
@@ -347,7 +343,7 @@ export class User extends BaseClass {
const settings = UserSettings.create({
locale: language,
- })
+ });
const user = User.create({
username: username,
@@ -367,15 +363,12 @@ export class User extends BaseClass {
});
user.validate();
- await Promise.all([
- user.save(),
- settings.save(),
- ])
+ await Promise.all([user.save(), settings.save()]);
setImmediate(async () => {
if (Config.get().guild.autoJoin.enabled) {
for (const guild of Config.get().guild.autoJoin.guilds || []) {
- await Member.addToGuild(user.id, guild).catch((e) => { });
+ await Member.addToGuild(user.id, guild).catch((e) => {});
}
}
});
diff --git a/src/util/entities/UserSettings.ts b/src/util/entities/UserSettings.ts
index b1a1fe68..995bb262 100644
--- a/src/util/entities/UserSettings.ts
+++ b/src/util/entities/UserSettings.ts
@@ -3,117 +3,117 @@ import { BaseClassWithoutId } from "./BaseClass";
@Entity("user_settings")
export class UserSettings extends BaseClassWithoutId {
- @PrimaryGeneratedColumn()
+ @PrimaryGeneratedColumn()
index: string;
@Column({ nullable: true })
- afk_timeout: number = 3600;
+ afk_timeout: number = 3600;
@Column({ nullable: true })
- allow_accessibility_detection: boolean = true;
-
- @Column({ nullable: true })
- animate_emoji: boolean = true;
-
- @Column({ nullable: true })
- animate_stickers: number = 0;
-
- @Column({ nullable: true })
- contact_sync_enabled: boolean = false;
-
- @Column({ nullable: true })
- convert_emoticons: boolean = false;
-
- @Column({ nullable: true, type: "simple-json" })
- custom_status: CustomStatus | null = null;
-
- @Column({ nullable: true })
- default_guilds_restricted: boolean = false;
-
- @Column({ nullable: true })
- detect_platform_accounts: boolean = false;
-
- @Column({ nullable: true })
- developer_mode: boolean = true;
-
- @Column({ nullable: true })
- disable_games_tab: boolean = true;
-
- @Column({ nullable: true })
- enable_tts_command: boolean = false;
-
- @Column({ nullable: true })
- explicit_content_filter: number = 0;
-
- @Column({ nullable: true, type: "simple-json" })
- friend_source_flags: FriendSourceFlags = { all: true };
-
- @Column({ nullable: true })
- gateway_connected: boolean = false;
-
- @Column({ nullable: true })
- gif_auto_play: boolean = false;
-
- @Column({ nullable: true, type: "simple-json" })
- guild_folders: GuildFolder[] = []; // every top guild is displayed as a "folder"
-
- @Column({ nullable: true, type: "simple-json" })
- guild_positions: string[] = []; // guild ids ordered by position
-
- @Column({ nullable: true })
- inline_attachment_media: boolean = true;
-
- @Column({ nullable: true })
- inline_embed_media: boolean = true;
-
- @Column({ nullable: true })
- locale: string = "en-US"; // en_US
-
- @Column({ nullable: true })
- message_display_compact: boolean = false;
-
- @Column({ nullable: true })
- native_phone_integration_enabled: boolean = true;
-
- @Column({ nullable: true })
- render_embeds: boolean = true;
-
- @Column({ nullable: true })
- render_reactions: boolean = true;
-
- @Column({ nullable: true, type: "simple-json" })
- restricted_guilds: string[] = [];
-
- @Column({ nullable: true })
- show_current_game: boolean = true;
-
- @Column({ nullable: true })
- status: "online" | "offline" | "dnd" | "idle" | "invisible" = "online";
-
- @Column({ nullable: true })
- stream_notifications_enabled: boolean = false;
-
- @Column({ nullable: true })
- theme: "dark" | "light" = "dark"; // dark
-
- @Column({ nullable: true })
- timezone_offset: number = 0; // e.g -60
+ allow_accessibility_detection: boolean = true;
+
+ @Column({ nullable: true })
+ animate_emoji: boolean = true;
+
+ @Column({ nullable: true })
+ animate_stickers: number = 0;
+
+ @Column({ nullable: true })
+ contact_sync_enabled: boolean = false;
+
+ @Column({ nullable: true })
+ convert_emoticons: boolean = false;
+
+ @Column({ nullable: true, type: "simple-json" })
+ custom_status: CustomStatus | null = null;
+
+ @Column({ nullable: true })
+ default_guilds_restricted: boolean = false;
+
+ @Column({ nullable: true })
+ detect_platform_accounts: boolean = false;
+
+ @Column({ nullable: true })
+ developer_mode: boolean = true;
+
+ @Column({ nullable: true })
+ disable_games_tab: boolean = true;
+
+ @Column({ nullable: true })
+ enable_tts_command: boolean = false;
+
+ @Column({ nullable: true })
+ explicit_content_filter: number = 0;
+
+ @Column({ nullable: true, type: "simple-json" })
+ friend_source_flags: FriendSourceFlags = { all: true };
+
+ @Column({ nullable: true })
+ gateway_connected: boolean = false;
+
+ @Column({ nullable: true })
+ gif_auto_play: boolean = false;
+
+ @Column({ nullable: true, type: "simple-json" })
+ guild_folders: GuildFolder[] = []; // every top guild is displayed as a "folder"
+
+ @Column({ nullable: true, type: "simple-json" })
+ guild_positions: string[] = []; // guild ids ordered by position
+
+ @Column({ nullable: true })
+ inline_attachment_media: boolean = true;
+
+ @Column({ nullable: true })
+ inline_embed_media: boolean = true;
+
+ @Column({ nullable: true })
+ locale: string = "en-US"; // en_US
+
+ @Column({ nullable: true })
+ message_display_compact: boolean = false;
+
+ @Column({ nullable: true })
+ native_phone_integration_enabled: boolean = true;
+
+ @Column({ nullable: true })
+ render_embeds: boolean = true;
+
+ @Column({ nullable: true })
+ render_reactions: boolean = true;
+
+ @Column({ nullable: true, type: "simple-json" })
+ restricted_guilds: string[] = [];
+
+ @Column({ nullable: true })
+ show_current_game: boolean = true;
+
+ @Column({ nullable: true })
+ status: "online" | "offline" | "dnd" | "idle" | "invisible" = "online";
+
+ @Column({ nullable: true })
+ stream_notifications_enabled: boolean = false;
+
+ @Column({ nullable: true })
+ theme: "dark" | "light" = "dark"; // dark
+
+ @Column({ nullable: true })
+ timezone_offset: number = 0; // e.g -60
}
interface CustomStatus {
- emoji_id?: string;
- emoji_name?: string;
- expires_at?: number;
- text?: string;
+ emoji_id?: string;
+ emoji_name?: string;
+ expires_at?: number;
+ text?: string;
}
interface GuildFolder {
- color: number;
- guild_ids: string[];
- id: number;
- name: string;
+ color: number;
+ guild_ids: string[];
+ id: number;
+ name: string;
}
-interface FriendSourceFlags {
- all: boolean
-}
\ No newline at end of file
+interface FriendSourceFlags {
+ all: boolean;
+}
diff --git a/src/util/entities/ValidRegistrationTokens.ts b/src/util/entities/ValidRegistrationTokens.ts
index 00839324..7db66c1d 100644
--- a/src/util/entities/ValidRegistrationTokens.ts
+++ b/src/util/entities/ValidRegistrationTokens.ts
@@ -4,10 +4,10 @@ import { BaseEntity, Column, Entity, PrimaryColumn } from "typeorm";
export class ValidRegistrationToken extends BaseEntity {
@PrimaryColumn()
token: string;
-
+
@Column()
created_at: Date = new Date();
@Column()
expires_at: Date;
-}
\ No newline at end of file
+}
diff --git a/src/util/entities/index.ts b/src/util/entities/index.ts
index dc509250..3e64965c 100644
--- a/src/util/entities/index.ts
+++ b/src/util/entities/index.ts
@@ -33,4 +33,4 @@ export * from "./User";
export * from "./UserSettings";
export * from "./ValidRegistrationTokens";
export * from "./VoiceState";
-export * from "./Webhook";
\ No newline at end of file
+export * from "./Webhook";
|