Merge branch 'master' into welcomeUpdate
This commit is contained in:
commit
6af5270223
1
.gitignore
vendored
1
.gitignore
vendored
@ -21,3 +21,4 @@ tmp/
|
|||||||
dump/
|
dump/
|
||||||
result
|
result
|
||||||
jwt.key*
|
jwt.key*
|
||||||
|
bun.lock
|
||||||
|
|||||||
@ -20,4 +20,5 @@ export class AutoJoinConfiguration {
|
|||||||
enabled: boolean = true;
|
enabled: boolean = true;
|
||||||
guilds: string[] = [];
|
guilds: string[] = [];
|
||||||
canLeave: boolean = true;
|
canLeave: boolean = true;
|
||||||
|
bots: boolean = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -157,7 +157,7 @@ export class User extends BaseClass {
|
|||||||
@OneToOne(() => UserSettings, {
|
@OneToOne(() => UserSettings, {
|
||||||
cascade: true,
|
cascade: true,
|
||||||
orphanedRowAction: "delete",
|
orphanedRowAction: "delete",
|
||||||
nullable: true
|
nullable: true,
|
||||||
})
|
})
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
settings?: UserSettings;
|
settings?: UserSettings;
|
||||||
@ -257,6 +257,7 @@ export class User extends BaseClass {
|
|||||||
password,
|
password,
|
||||||
id,
|
id,
|
||||||
req,
|
req,
|
||||||
|
bot,
|
||||||
}: {
|
}: {
|
||||||
username: string;
|
username: string;
|
||||||
password?: string;
|
password?: string;
|
||||||
@ -264,6 +265,7 @@ export class User extends BaseClass {
|
|||||||
date_of_birth?: Date; // "2000-04-03"
|
date_of_birth?: Date; // "2000-04-03"
|
||||||
id?: string;
|
id?: string;
|
||||||
req?: Request;
|
req?: Request;
|
||||||
|
bot?: boolean;
|
||||||
}) {
|
}) {
|
||||||
// trim special uf8 control characters -> Backspace, Newline, ...
|
// trim special uf8 control characters -> Backspace, Newline, ...
|
||||||
username = trimSpecial(username);
|
username = trimSpecial(username);
|
||||||
@ -306,6 +308,7 @@ export class User extends BaseClass {
|
|||||||
premium_type: Config.get().defaults.user.premiumType ?? 0,
|
premium_type: Config.get().defaults.user.premiumType ?? 0,
|
||||||
verified: Config.get().defaults.user.verified ?? true,
|
verified: Config.get().defaults.user.verified ?? true,
|
||||||
created_at: new Date(),
|
created_at: new Date(),
|
||||||
|
bot: !!bot,
|
||||||
});
|
});
|
||||||
|
|
||||||
user.validate();
|
user.validate();
|
||||||
@ -319,6 +322,12 @@ export class User extends BaseClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setImmediate(async () => {
|
setImmediate(async () => {
|
||||||
|
if (bot) {
|
||||||
|
const { guild } = Config.get();
|
||||||
|
if (!guild.autoJoin.bots) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (Config.get().guild.autoJoin.enabled) {
|
if (Config.get().guild.autoJoin.enabled) {
|
||||||
for (const guild of Config.get().guild.autoJoin.guilds || []) {
|
for (const guild of Config.get().guild.autoJoin.guilds || []) {
|
||||||
await Member.addToGuild(user.id, guild).catch((e) => console.error("[Autojoin]", e));
|
await Member.addToGuild(user.id, guild).catch((e) => console.error("[Autojoin]", e));
|
||||||
|
|||||||
@ -7,6 +7,7 @@ export async function createAppBotUser(app: Application, req: Request) {
|
|||||||
password: undefined,
|
password: undefined,
|
||||||
id: app.id,
|
id: app.id,
|
||||||
req,
|
req,
|
||||||
|
bot: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
user.id = app.id;
|
user.id = app.id;
|
||||||
|
|||||||
Reference in New Issue
Block a user