feat(arabot): add manual verification function to database

This commit is contained in:
smyalygames 2023-02-20 13:09:37 +00:00
parent 905d9f4811
commit 9b402a435b

View File

@ -23,6 +23,47 @@ import { updateUser } from '#utils/database/dbExistingUser';
import { leaveBan } from '#utils/verificationConfig'; import { leaveBan } from '#utils/verificationConfig';
import { fibonacci } from '#utils/maths'; import { fibonacci } from '#utils/maths';
export async function manualVerification(
messageId: Snowflake,
member: GuildMember,
verifier: GuildMember,
roles: {
vegan: boolean,
activist: boolean,
araVegan: boolean,
trusted: boolean,
vegCurious: boolean,
convinced: boolean
},
) {
await updateUser(member);
await updateUser(verifier);
await container.database.verify.create({
data: {
id: messageId,
user: {
connect: {
id: member.id,
},
},
verifier: {
connect: {
id: verifier.id,
},
},
manual: true,
// Roles
vegan: roles.vegan,
activist: roles.activist,
serverVegan: roles.araVegan,
trusted: roles.trusted,
vegCurious: roles.vegCurious,
convinced: roles.convinced,
},
});
}
export async function joinVerification(channelId: Snowflake, member: GuildMember) { export async function joinVerification(channelId: Snowflake, member: GuildMember) {
// Update the user on the database with the current roles they have // Update the user on the database with the current roles they have
await updateUser(member); await updateUser(member);
@ -86,6 +127,7 @@ export async function finishVerification(
roles: { roles: {
vegan: boolean, vegan: boolean,
activist: boolean, activist: boolean,
araVegan: boolean,
trusted: boolean, trusted: boolean,
vegCurious: boolean, vegCurious: boolean,
convinced: boolean convinced: boolean
@ -106,6 +148,7 @@ export async function finishVerification(
// Roles // Roles
vegan: info.roles.vegan, vegan: info.roles.vegan,
activist: info.roles.activist, activist: info.roles.activist,
serverVegan: info.roles.araVegan,
trusted: info.roles.trusted, trusted: info.roles.trusted,
vegCurious: info.roles.vegCurious, vegCurious: info.roles.vegCurious,
convinced: info.roles.convinced, convinced: info.roles.convinced,