feat(arabot): add check if in staff category

This commit is contained in:
smyalygames 2022-11-05 23:41:30 +00:00
parent c42d612ed4
commit d90b89d4ac
3 changed files with 41 additions and 0 deletions

39
src/utils/checker.ts Normal file
View File

@ -0,0 +1,39 @@
// SPDX-License-Identifier: GPL-3.0-or-later
/*
Animal Rights Advocates Discord Bot
Copyright (C) 2022 Anthony Berg
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import type { TextChannel } from 'discord.js';
import IDs from './ids';
/**
* Checks if the channel is in the staff category.
* @param channel channel to check if parent is staff
* @returns {boolean} true if is in staff channel
*/
// eslint-disable-next-line import/prefer-default-export
export function checkStaff(channel: TextChannel) {
if (channel.parent === null) {
return false;
}
if (channel.parent.id === IDs.categories.staff) {
return true;
}
return false;
}

View File

@ -97,6 +97,7 @@ const devIDs = {
}, },
}, },
categories: { categories: {
staff: '999431676058927253',
verification: '999431677006860409', verification: '999431677006860409',
diversity: '999431679053660185', diversity: '999431679053660185',
}, },

View File

@ -100,6 +100,7 @@ let IDs = {
}, },
}, },
categories: { categories: {
staff: '768685283583328257',
verification: '797505409073676299', verification: '797505409073676299',
diversity: '933078380394459146', diversity: '933078380394459146',
}, },