diff --git a/src/utils/checker.ts b/src/utils/checker.ts new file mode 100644 index 0000000..34892a7 --- /dev/null +++ b/src/utils/checker.ts @@ -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 . +*/ + +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; +} diff --git a/src/utils/devIDs.ts b/src/utils/devIDs.ts index 2135ba5..0507fc0 100644 --- a/src/utils/devIDs.ts +++ b/src/utils/devIDs.ts @@ -97,6 +97,7 @@ const devIDs = { }, }, categories: { + staff: '999431676058927253', verification: '999431677006860409', diversity: '999431679053660185', }, diff --git a/src/utils/ids.ts b/src/utils/ids.ts index 0bdd580..9506e87 100644 --- a/src/utils/ids.ts +++ b/src/utils/ids.ts @@ -100,6 +100,7 @@ let IDs = { }, }, categories: { + staff: '768685283583328257', verification: '797505409073676299', diversity: '933078380394459146', },