diff options
Diffstat (limited to 'src/util/entities/Invite.ts')
-rw-r--r-- | src/util/entities/Invite.ts | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/util/entities/Invite.ts b/src/util/entities/Invite.ts index 4f36f247..90dec92a 100644 --- a/src/util/entities/Invite.ts +++ b/src/util/entities/Invite.ts @@ -1,4 +1,11 @@ -import { Column, Entity, JoinColumn, ManyToOne, RelationId, PrimaryColumn } from "typeorm"; +import { + Column, + Entity, + JoinColumn, + ManyToOne, + RelationId, + PrimaryColumn, +} from "typeorm"; import { Member } from "./Member"; import { BaseClassWithoutId } from "./BaseClass"; import { Channel } from "./Channel"; @@ -76,7 +83,8 @@ export class Invite extends BaseClassWithoutId { static async joinGuild(user_id: string, code: string) { const invite = await Invite.findOneOrFail({ where: { code } }); - if (invite.uses++ >= invite.max_uses && invite.max_uses !== 0) await Invite.delete({ code }); + if (invite.uses++ >= invite.max_uses && invite.max_uses !== 0) + await Invite.delete({ code }); else await invite.save(); await Member.addToGuild(user_id, invite.guild_id); |