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: just send to sendable channel #10

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
15 changes: 8 additions & 7 deletions src/cpn_core/notifications/discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
from typing import override

from discord import (
CategoryChannel,
Client,
DMChannel,
Forbidden,
GroupChannel,
ForumChannel,
HTTPException,
Intents,
TextChannel,
User,
)
from discord.abc import PrivateChannel

from cpn_core.models.notifications.discord import DiscordConfig

Expand All @@ -37,12 +37,13 @@ async def _send_channel(self) -> None:
logger.error("Discord channel ID %d: Not found", self.discord.chat_id)
return
if (
not isinstance(channel, TextChannel)
or not isinstance(channel, GroupChannel)
or not isinstance(channel, DMChannel)
isinstance(channel, ForumChannel)
or isinstance(channel, CategoryChannel)
or isinstance(channel, PrivateChannel)
):
logger.error(
"Discord channel ID %d: Must be text channel", self.discord.chat_id
"Discord channel ID %d is not sendable channel",
self.discord.chat_id,
)
return
for message in self._messages:
Expand Down
Loading