refactor(arabot): change adding user to database

This commit is contained in:
smyalygames 2023-02-11 21:13:25 +00:00
parent c0da7cb1fa
commit a8250eb514

View File

@ -32,7 +32,7 @@ import type {
Snowflake,
} from 'discord.js';
import IDs from '#utils/ids';
import { addEmptyUser, addExistingUser, userExists } from '#utils/database/dbExistingUser';
import { addEmptyUser, updateUser, userExists } from '#utils/database/dbExistingUser';
import { restrict, checkActive } from '#utils/database/restriction';
export class RestrictCommand extends Command {
@ -146,9 +146,7 @@ export class RestrictCommand extends Command {
}
// Check if mod is in database
if (!await userExists(mod.id)) {
await addExistingUser(mod);
}
await updateUser(mod);
if (await checkActive(userId)) {
info.message = `<@${userId}> is already restricted!`;
@ -175,9 +173,7 @@ export class RestrictCommand extends Command {
}
// Check if user and mod are on the database
if (!await userExists(member.id)) {
await addExistingUser(member);
}
await updateUser(member);
if (member.roles.cache.has(IDs.roles.vegan.vegan)) {
await member.roles.add(IDs.roles.restrictions.restricted1);