mirror of
https://github.com/veganhacktivists/arabot.git
synced 2025-05-19 12:44:17 +02:00
refactor(arabot): change adding user to database
This commit is contained in:
parent
c0da7cb1fa
commit
a8250eb514
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user