feat: add very large guild feature (#88)
Some checks failed
deploy admin / channel-vars (push) Successful in 14s
deploy api / channel-vars (push) Successful in 2s
deploy app / channel-vars (push) Successful in 2s
deploy app / Deploy app (push) Has been cancelled
deploy admin / Deploy admin (push) Has been cancelled
deploy api / Deploy api (push) Has been cancelled
Some checks failed
deploy admin / channel-vars (push) Successful in 14s
deploy api / channel-vars (push) Successful in 2s
deploy app / channel-vars (push) Successful in 2s
deploy app / Deploy app (push) Has been cancelled
deploy admin / Deploy admin (push) Has been cancelled
deploy api / Deploy api (push) Has been cancelled
This commit is contained in:
@@ -34,6 +34,8 @@ export const MAX_GUILD_STICKERS = 50;
|
||||
export const MAX_GUILD_STICKERS_MORE_STICKERS = 250;
|
||||
export const MAX_GUILD_INVITES = 1000;
|
||||
export const MAX_GUILD_ROLES = 250;
|
||||
export const MAX_GUILD_MEMBERS = 1000;
|
||||
export const MAX_GUILD_MEMBERS_VERY_LARGE = 10000;
|
||||
|
||||
export const MAX_WEBHOOKS_PER_CHANNEL = 15;
|
||||
export const MAX_WEBHOOKS_PER_GUILD = 1000;
|
||||
|
||||
@@ -71,6 +71,7 @@ export const GuildFeatures = {
|
||||
VISIONARY: 'VISIONARY',
|
||||
OPERATOR: 'OPERATOR',
|
||||
LARGE_GUILD_OVERRIDE: 'LARGE_GUILD_OVERRIDE',
|
||||
VERY_LARGE_GUILD: 'VERY_LARGE_GUILD',
|
||||
} as const;
|
||||
|
||||
export const GuildSplashCardAlignment = {
|
||||
|
||||
@@ -19,12 +19,21 @@
|
||||
|
||||
import type {GuildID, RoleID, UserID} from '~/BrandedTypes';
|
||||
import {createChannelID, createRoleID} from '~/BrandedTypes';
|
||||
import {MAX_GUILDS_NON_PREMIUM, MAX_GUILDS_PREMIUM, Permissions, SystemChannelFlags} from '~/Constants';
|
||||
import {
|
||||
GuildFeatures,
|
||||
MAX_GUILD_MEMBERS,
|
||||
MAX_GUILD_MEMBERS_VERY_LARGE,
|
||||
MAX_GUILDS_NON_PREMIUM,
|
||||
MAX_GUILDS_PREMIUM,
|
||||
Permissions,
|
||||
SystemChannelFlags,
|
||||
} from '~/Constants';
|
||||
import type {ChannelService} from '~/channel/services/ChannelService';
|
||||
import {AuditLogActionType} from '~/constants/AuditLogActionType';
|
||||
import {JoinSourceTypes} from '~/constants/Guild';
|
||||
import {
|
||||
InputValidationError,
|
||||
MaxGuildMembersError,
|
||||
MaxGuildsError,
|
||||
MissingPermissionsError,
|
||||
UnknownGuildError,
|
||||
@@ -437,6 +446,13 @@ export class GuildMemberOperationsService {
|
||||
const user = await this.userRepository.findUnique(userId);
|
||||
if (!user) throw new UnknownGuildError();
|
||||
|
||||
const maxGuildMembers = guild.features.has(GuildFeatures.VERY_LARGE_GUILD)
|
||||
? MAX_GUILD_MEMBERS_VERY_LARGE
|
||||
: MAX_GUILD_MEMBERS;
|
||||
if (guild.memberCount >= maxGuildMembers) {
|
||||
throw new MaxGuildMembersError(maxGuildMembers);
|
||||
}
|
||||
|
||||
if (!skipBanCheck) {
|
||||
await this.validationService.checkUserBanStatus({userId, guildId});
|
||||
}
|
||||
|
||||
@@ -25,7 +25,16 @@ import {
|
||||
type UserID,
|
||||
vanityCodeToInviteCode,
|
||||
} from '~/BrandedTypes';
|
||||
import {ChannelTypes, GuildFeatures, GuildOperations, InviteTypes, MAX_GUILD_INVITES, Permissions} from '~/Constants';
|
||||
import {
|
||||
ChannelTypes,
|
||||
GuildFeatures,
|
||||
GuildOperations,
|
||||
InviteTypes,
|
||||
MAX_GUILD_INVITES,
|
||||
MAX_GUILD_MEMBERS,
|
||||
MAX_GUILD_MEMBERS_VERY_LARGE,
|
||||
Permissions,
|
||||
} from '~/Constants';
|
||||
import type {ChannelService} from '~/channel/services/ChannelService';
|
||||
import {AuditLogActionType} from '~/constants/AuditLogActionType';
|
||||
import {
|
||||
@@ -422,8 +431,11 @@ export class InviteService {
|
||||
await this.guildService.checkUserBanStatus({userId, guildId: invite.guildId});
|
||||
|
||||
const {memberCount} = await this.gatewayService.getGuildCounts(invite.guildId);
|
||||
if (memberCount >= 1000) {
|
||||
throw new MaxGuildMembersError(1000);
|
||||
const maxGuildMembers = guild.features.has(GuildFeatures.VERY_LARGE_GUILD)
|
||||
? MAX_GUILD_MEMBERS_VERY_LARGE
|
||||
: MAX_GUILD_MEMBERS;
|
||||
if (memberCount >= maxGuildMembers) {
|
||||
throw new MaxGuildMembersError(maxGuildMembers);
|
||||
}
|
||||
|
||||
if (invite.temporary) {
|
||||
|
||||
Reference in New Issue
Block a user