summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
authorPuyodead1 <puyodead@proton.me>2023-03-24 21:21:21 -0400
committerPuyodead1 <puyodead@proton.me>2023-04-13 15:28:41 -0400
commitc2ce88dee726bb6c1993bf4615aa866d089ca494 (patch)
treef5b3fe7d7d1e23b5f2ce6540c7e78d34b4c1e43f /src/util
parentUpdate openapi.json (diff)
downloadserver-c2ce88dee726bb6c1993bf4615aa866d089ca494.tar.xz
guilds
Diffstat (limited to 'src/util')
-rw-r--r--src/util/entities/Guild.ts13
-rw-r--r--src/util/interfaces/GuildWelcomeScreen.ts10
-rw-r--r--src/util/interfaces/index.ts1
-rw-r--r--src/util/schemas/responses/GuildBansResponse.ts10
-rw-r--r--src/util/schemas/responses/GuildChannelsResponse.ts3
-rw-r--r--src/util/schemas/responses/GuildCreateResponse.ts3
-rw-r--r--src/util/schemas/responses/GuildDiscoveryRequirements.ts23
-rw-r--r--src/util/schemas/responses/GuildEmojisResponse.ts3
-rw-r--r--src/util/schemas/responses/GuildInvitesResponse.ts3
-rw-r--r--src/util/schemas/responses/GuildMembersResponse.ts3
-rw-r--r--src/util/schemas/responses/GuildMessagesSearchResponse.ts32
-rw-r--r--src/util/schemas/responses/GuildPruneResponse.ts7
-rw-r--r--src/util/schemas/responses/GuildResponse.ts3
-rw-r--r--src/util/schemas/responses/GuildRolesResponse.ts3
-rw-r--r--src/util/schemas/responses/GuildStickersResponse.ts3
-rw-r--r--src/util/schemas/responses/GuildTemplatesResponse.ts3
-rw-r--r--src/util/schemas/responses/GuildVanityUrl.ts17
-rw-r--r--src/util/schemas/responses/GuildVoiceRegionsResponse.ts9
-rw-r--r--src/util/schemas/responses/GuildWidgetJsonResponse.ts21
-rw-r--r--src/util/schemas/responses/GuildWidgetSettingsResponse.ts6
-rw-r--r--src/util/schemas/responses/MemberJoinGuildResponse.ts8
-rw-r--r--src/util/schemas/responses/index.ts18
22 files changed, 191 insertions, 11 deletions
diff --git a/src/util/entities/Guild.ts b/src/util/entities/Guild.ts
index e8454986..7d7ae1ea 100644
--- a/src/util/entities/Guild.ts
+++ b/src/util/entities/Guild.ts
@@ -24,7 +24,7 @@ import {
 	OneToMany,
 	RelationId,
 } from "typeorm";
-import { Config, handleFile, Snowflake } from "..";
+import { Config, GuildWelcomeScreen, handleFile, Snowflake } from "..";
 import { Ban } from "./Ban";
 import { BaseClass } from "./BaseClass";
 import { Channel } from "./Channel";
@@ -270,16 +270,7 @@ export class Guild extends BaseClass {
 	verification_level?: number;
 
 	@Column({ type: "simple-json" })
-	welcome_screen: {
-		enabled: boolean;
-		description: string;
-		welcome_channels: {
-			description: string;
-			emoji_id?: string;
-			emoji_name?: string;
-			channel_id: string;
-		}[];
-	};
+	welcome_screen: GuildWelcomeScreen;
 
 	@Column({ nullable: true })
 	@RelationId((guild: Guild) => guild.widget_channel)
diff --git a/src/util/interfaces/GuildWelcomeScreen.ts b/src/util/interfaces/GuildWelcomeScreen.ts
new file mode 100644
index 00000000..38b6061b
--- /dev/null
+++ b/src/util/interfaces/GuildWelcomeScreen.ts
@@ -0,0 +1,10 @@
+export interface GuildWelcomeScreen {
+	enabled: boolean;
+	description: string;
+	welcome_channels: {
+		description: string;
+		emoji_id?: string;
+		emoji_name?: string;
+		channel_id: string;
+	}[];
+}
diff --git a/src/util/interfaces/index.ts b/src/util/interfaces/index.ts
index c6a00458..6620ba32 100644
--- a/src/util/interfaces/index.ts
+++ b/src/util/interfaces/index.ts
@@ -19,6 +19,7 @@
 export * from "./Activity";
 export * from "./ConnectedAccount";
 export * from "./Event";
+export * from "./GuildWelcomeScreen";
 export * from "./Interaction";
 export * from "./Presence";
 export * from "./Status";
diff --git a/src/util/schemas/responses/GuildBansResponse.ts b/src/util/schemas/responses/GuildBansResponse.ts
new file mode 100644
index 00000000..876a4bc4
--- /dev/null
+++ b/src/util/schemas/responses/GuildBansResponse.ts
@@ -0,0 +1,10 @@
+export interface GuildBansResponse {
+	reason: string;
+	user: {
+		username: string;
+		discriminator: string;
+		id: string;
+		avatar: string | null;
+		public_flags: number;
+	};
+}
diff --git a/src/util/schemas/responses/GuildChannelsResponse.ts b/src/util/schemas/responses/GuildChannelsResponse.ts
new file mode 100644
index 00000000..3321455d
--- /dev/null
+++ b/src/util/schemas/responses/GuildChannelsResponse.ts
@@ -0,0 +1,3 @@
+import { Channel } from "../../entities";
+
+export type GuildChannelsResponse = Channel[];
diff --git a/src/util/schemas/responses/GuildCreateResponse.ts b/src/util/schemas/responses/GuildCreateResponse.ts
new file mode 100644
index 00000000..8185cb86
--- /dev/null
+++ b/src/util/schemas/responses/GuildCreateResponse.ts
@@ -0,0 +1,3 @@
+export interface GuildCreateResponse {
+	id: string;
+}
diff --git a/src/util/schemas/responses/GuildDiscoveryRequirements.ts b/src/util/schemas/responses/GuildDiscoveryRequirements.ts
new file mode 100644
index 00000000..2d303133
--- /dev/null
+++ b/src/util/schemas/responses/GuildDiscoveryRequirements.ts
@@ -0,0 +1,23 @@
+export interface GuildDiscoveryRequirements {
+	uild_id: string;
+	safe_environment: boolean;
+	healthy: boolean;
+	health_score_pending: boolean;
+	size: boolean;
+	nsfw_properties: unknown;
+	protected: boolean;
+	sufficient: boolean;
+	sufficient_without_grace_period: boolean;
+	valid_rules_channel: boolean;
+	retention_healthy: boolean;
+	engagement_healthy: boolean;
+	age: boolean;
+	minimum_age: number;
+	health_score: {
+		avg_nonnew_participators: number;
+		avg_nonnew_communicators: number;
+		num_intentful_joiners: number;
+		perc_ret_w1_intentful: number;
+	};
+	minimum_size: number;
+}
diff --git a/src/util/schemas/responses/GuildEmojisResponse.ts b/src/util/schemas/responses/GuildEmojisResponse.ts
new file mode 100644
index 00000000..cea6fd55
--- /dev/null
+++ b/src/util/schemas/responses/GuildEmojisResponse.ts
@@ -0,0 +1,3 @@
+import { Emoji } from "../../entities";
+
+export type GuildEmojisResponse = Emoji[];
diff --git a/src/util/schemas/responses/GuildInvitesResponse.ts b/src/util/schemas/responses/GuildInvitesResponse.ts
new file mode 100644
index 00000000..cf9ed9cc
--- /dev/null
+++ b/src/util/schemas/responses/GuildInvitesResponse.ts
@@ -0,0 +1,3 @@
+import { Invite } from "../../entities";
+
+export type GuildInvitesResponse = Invite[];
diff --git a/src/util/schemas/responses/GuildMembersResponse.ts b/src/util/schemas/responses/GuildMembersResponse.ts
new file mode 100644
index 00000000..8d14fd9e
--- /dev/null
+++ b/src/util/schemas/responses/GuildMembersResponse.ts
@@ -0,0 +1,3 @@
+import { Member } from "../../entities";
+
+export type GuildMembersResponse = Member[];
diff --git a/src/util/schemas/responses/GuildMessagesSearchResponse.ts b/src/util/schemas/responses/GuildMessagesSearchResponse.ts
new file mode 100644
index 00000000..0b6248b7
--- /dev/null
+++ b/src/util/schemas/responses/GuildMessagesSearchResponse.ts
@@ -0,0 +1,32 @@
+import {
+	Attachment,
+	Embed,
+	MessageType,
+	PublicUser,
+	Role,
+} from "../../entities";
+
+export interface GuildMessagesSearchMessage {
+	id: string;
+	type: MessageType;
+	content?: string;
+	channel_id: string;
+	author: PublicUser;
+	attachments: Attachment[];
+	embeds: Embed[];
+	mentions: PublicUser[];
+	mention_roles: Role[];
+	pinned: boolean;
+	mention_everyone?: boolean;
+	tts: boolean;
+	timestamp: string;
+	edited_timestamp: string | null;
+	flags: number;
+	components: unknown[];
+	hit: true;
+}
+
+export interface GuildMessagesSearchResponse {
+	messages: GuildMessagesSearchMessage[];
+	total_results: number;
+}
diff --git a/src/util/schemas/responses/GuildPruneResponse.ts b/src/util/schemas/responses/GuildPruneResponse.ts
new file mode 100644
index 00000000..fb1abb89
--- /dev/null
+++ b/src/util/schemas/responses/GuildPruneResponse.ts
@@ -0,0 +1,7 @@
+export interface GuildPruneResponse {
+	pruned: number;
+}
+
+export interface GuildPurgeResponse {
+	purged: number;
+}
diff --git a/src/util/schemas/responses/GuildResponse.ts b/src/util/schemas/responses/GuildResponse.ts
new file mode 100644
index 00000000..00035243
--- /dev/null
+++ b/src/util/schemas/responses/GuildResponse.ts
@@ -0,0 +1,3 @@
+import { Guild } from "../../entities";
+
+export type GuildResponse = Guild & { joined_at: string };
diff --git a/src/util/schemas/responses/GuildRolesResponse.ts b/src/util/schemas/responses/GuildRolesResponse.ts
new file mode 100644
index 00000000..a064cddb
--- /dev/null
+++ b/src/util/schemas/responses/GuildRolesResponse.ts
@@ -0,0 +1,3 @@
+import { Role } from "../../entities";
+
+export type GuildRolesResponse = Role[];
diff --git a/src/util/schemas/responses/GuildStickersResponse.ts b/src/util/schemas/responses/GuildStickersResponse.ts
new file mode 100644
index 00000000..a02f3e55
--- /dev/null
+++ b/src/util/schemas/responses/GuildStickersResponse.ts
@@ -0,0 +1,3 @@
+import { Sticker } from "../../entities";
+
+export type GuildStickersResponse = Sticker[];
diff --git a/src/util/schemas/responses/GuildTemplatesResponse.ts b/src/util/schemas/responses/GuildTemplatesResponse.ts
new file mode 100644
index 00000000..e975fe43
--- /dev/null
+++ b/src/util/schemas/responses/GuildTemplatesResponse.ts
@@ -0,0 +1,3 @@
+import { Template } from "../../entities";
+
+export type GuildTemplatesResponse = Template[];
diff --git a/src/util/schemas/responses/GuildVanityUrl.ts b/src/util/schemas/responses/GuildVanityUrl.ts
new file mode 100644
index 00000000..ff37bf4e
--- /dev/null
+++ b/src/util/schemas/responses/GuildVanityUrl.ts
@@ -0,0 +1,17 @@
+export interface GuildVanityUrl {
+	code: string;
+	uses: number;
+}
+
+export interface GuildVanityUrlNoInvite {
+	code: null;
+}
+
+export type GuildVanityUrlResponse =
+	| GuildVanityUrl
+	| GuildVanityUrl[]
+	| GuildVanityUrlNoInvite;
+
+export interface GuildVanityUrlCreateResponse {
+	code: string;
+}
diff --git a/src/util/schemas/responses/GuildVoiceRegionsResponse.ts b/src/util/schemas/responses/GuildVoiceRegionsResponse.ts
new file mode 100644
index 00000000..c17e2f5d
--- /dev/null
+++ b/src/util/schemas/responses/GuildVoiceRegionsResponse.ts
@@ -0,0 +1,9 @@
+export interface GuildVoiceRegion {
+	id: string;
+	name: string;
+	custom: boolean;
+	deprecated: boolean;
+	optimal: boolean;
+}
+
+export type GuildVoiceRegionsResponse = GuildVoiceRegion[];
diff --git a/src/util/schemas/responses/GuildWidgetJsonResponse.ts b/src/util/schemas/responses/GuildWidgetJsonResponse.ts
new file mode 100644
index 00000000..ef85dd08
--- /dev/null
+++ b/src/util/schemas/responses/GuildWidgetJsonResponse.ts
@@ -0,0 +1,21 @@
+import { ClientStatus } from "../../interfaces";
+
+export interface GuildWidgetJsonResponse {
+	id: string;
+	name: string;
+	instant_invite: string;
+	channels: {
+		id: string;
+		name: string;
+		position: number;
+	}[];
+	members: {
+		id: string;
+		username: string;
+		discriminator: string;
+		avatar: string | null;
+		status: ClientStatus;
+		avatar_url: string;
+	}[];
+	presence_count: number;
+}
diff --git a/src/util/schemas/responses/GuildWidgetSettingsResponse.ts b/src/util/schemas/responses/GuildWidgetSettingsResponse.ts
new file mode 100644
index 00000000..3c6b45ce
--- /dev/null
+++ b/src/util/schemas/responses/GuildWidgetSettingsResponse.ts
@@ -0,0 +1,6 @@
+import { Snowflake } from "../../util";
+
+export interface GuildWidgetSettingsResponse {
+	enabled: boolean;
+	channel_id: Snowflake | null;
+}
diff --git a/src/util/schemas/responses/MemberJoinGuildResponse.ts b/src/util/schemas/responses/MemberJoinGuildResponse.ts
new file mode 100644
index 00000000..d7b39d10
--- /dev/null
+++ b/src/util/schemas/responses/MemberJoinGuildResponse.ts
@@ -0,0 +1,8 @@
+import { Emoji, Guild, Role, Sticker } from "../../entities";
+
+export interface MemberJoinGuildResponse {
+	guild: Guild;
+	emojis: Emoji[];
+	roles: Role[];
+	stickers: Sticker[];
+}
diff --git a/src/util/schemas/responses/index.ts b/src/util/schemas/responses/index.ts
index 30949f7f..91c889db 100644
--- a/src/util/schemas/responses/index.ts
+++ b/src/util/schemas/responses/index.ts
@@ -12,7 +12,25 @@ export * from "./ChannelWebhooksResponse";
 export * from "./GatewayBotResponse";
 export * from "./GatewayResponse";
 export * from "./GenerateRegistrationTokensResponse";
+export * from "./GuildBansResponse";
+export * from "./GuildChannelsResponse";
+export * from "./GuildCreateResponse";
+export * from "./GuildDiscoveryRequirements";
+export * from "./GuildEmojisResponse";
+export * from "./GuildInvitesResponse";
+export * from "./GuildMembersResponse";
+export * from "./GuildMessagesSearchResponse";
+export * from "./GuildPruneResponse";
+export * from "./GuildResponse";
+export * from "./GuildRolesResponse";
+export * from "./GuildStickersResponse";
+export * from "./GuildTemplatesResponse";
+export * from "./GuildVanityUrl";
+export * from "./GuildVoiceRegionsResponse";
+export * from "./GuildWidgetJsonResponse";
+export * from "./GuildWidgetSettingsResponse";
 export * from "./LocationMetadataResponse";
+export * from "./MemberJoinGuildResponse";
 export * from "./Tenor";
 export * from "./TokenResponse";
 export * from "./UserProfileResponse";