feat(arabot): remove vegan restricts and restrict after left

This commit is contained in:
smyalygames 2023-02-14 14:26:52 +00:00
parent 71cc4d461c
commit dd008c1ea5
2 changed files with 12 additions and 4 deletions

View File

@ -97,6 +97,9 @@ export async function restrictRun(
await updateUser(member);
if (member.roles.cache.has(IDs.roles.vegan.vegan)) {
// TODO remove this error before enabling vegan restricts
info.message = `${member} is vegan, can't restrict them yet 😭`;
return info;
section = 5;
}
@ -209,6 +212,9 @@ export async function restrictRun(
IDs.roles.nonvegan.vegCurious,
]);
} else if (!await userExists(userId)) {
// TODO remove this error before replacing other bot role replacement
info.message = `<@${userId}> is not on this server, can't restrict them yet! 😭`;
return info;
await addEmptyUser(userId);
const dbRoles = await fetchRoles(userId);
if (dbRoles.includes(IDs.roles.vegan.vegan)) {
@ -257,7 +263,7 @@ export class RestrictCommand extends Command {
super(context, {
...options,
name: 'restrict',
aliases: ['r', 'rest', 'rr', 'rv'],
aliases: ['r', 'rest', 'rr'], // TODO add 'rv' when enabling vegan restrictions
description: 'Restricts a user',
preconditions: ['ModOnly'],
});

View File

@ -20,9 +20,9 @@
import { Listener } from '@sapphire/framework';
import type { GuildMember } from 'discord.js';
import { fetchRoles } from '#utils/database/dbExistingUser';
import IDs from '#utils/ids';
import { blockTime } from '#utils/database/verification';
import { checkActive, getSection } from '#utils/database/restriction';
// import IDs from '#utils/ids';
// import { blockTime } from '#utils/database/verification';
// import { checkActive, getSection } from '#utils/database/restriction';
export class RolesJoinServerListener extends Listener {
public constructor(context: Listener.Context, options: Listener.Options) {
@ -37,6 +37,7 @@ export class RolesJoinServerListener extends Listener {
const roles = await fetchRoles(member.id);
/*
// Check if the user is restricted
if (await checkActive(member.id)) {
const section = await getSection(member.id);
@ -49,6 +50,7 @@ export class RolesJoinServerListener extends Listener {
if (timeout > 0) {
roles.push(IDs.roles.verifyBlock);
}
*/
// Add roles if they don't have verification block
await member.roles.add(roles);