mirror of
https://github.com/veganhacktivists/arabot.git
synced 2025-05-19 15:04:29 +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,
|
Snowflake,
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import IDs from '#utils/ids';
|
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';
|
import { restrict, checkActive } from '#utils/database/restriction';
|
||||||
|
|
||||||
export class RestrictCommand extends Command {
|
export class RestrictCommand extends Command {
|
||||||
@ -146,9 +146,7 @@ export class RestrictCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if mod is in database
|
// Check if mod is in database
|
||||||
if (!await userExists(mod.id)) {
|
await updateUser(mod);
|
||||||
await addExistingUser(mod);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (await checkActive(userId)) {
|
if (await checkActive(userId)) {
|
||||||
info.message = `<@${userId}> is already restricted!`;
|
info.message = `<@${userId}> is already restricted!`;
|
||||||
@ -175,9 +173,7 @@ export class RestrictCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if user and mod are on the database
|
// Check if user and mod are on the database
|
||||||
if (!await userExists(member.id)) {
|
await updateUser(member);
|
||||||
await addExistingUser(member);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (member.roles.cache.has(IDs.roles.vegan.vegan)) {
|
if (member.roles.cache.has(IDs.roles.vegan.vegan)) {
|
||||||
await member.roles.add(IDs.roles.restrictions.restricted1);
|
await member.roles.add(IDs.roles.restrictions.restricted1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user