Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(temp): block praise in pvt threads #1125

Merged
merged 2 commits into from
Aug 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions packages/discord-bot/src/utils/assertPraiseAllowedInChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ export const assertPraiseAllowedInChannel = async (
getSetting('PRAISE_ALLOWED_CHANNEL_IDS', host) as Promise<string[]>,
]);

if (allowedInAllChannels) return true;

if (!channel) {
if (!channel || channel.type === ChannelType.PrivateThread) {
await interaction.editReply({
content:
'**❌ Missing Permissions**\nPraise bot can not work in private threads yet.',
});
return false;
}

if (allowedInAllChannels) return true;

if (!Array.isArray(allowedChannelsList) || allowedChannelsList.length === 0) {
await interaction.editReply({
content: '**❌ Praise Restricted**\nPraise not allowed in any channel.',
Expand All @@ -39,7 +40,10 @@ export const assertPraiseAllowedInChannel = async (
return false;
}

if (!allowedChannelsList.includes(getChannelId(channel))) {
if (
!allowedChannelsList.includes(getChannelId(channel)) &&
!allowedChannelsList.includes(channel.id)
) {
await interaction.editReply({
content: `**❌ Praise Restricted**\nPraise not allowed in this channel.\nTo praise, use the following channels - ${allowedChannelsList
.filter((el) => el !== '0')
Expand Down