-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutils.py
More file actions
22 lines (16 loc) · 757 Bytes
/
Copy pathutils.py
File metadata and controls
22 lines (16 loc) · 757 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import logging
import discord
import botconfig as botconfig
def load_discord_client() -> discord.Client:
intents: discord.Intents = discord.Intents.default()
intents.message_content = True
return discord.Client(intents=intents)
def is_valid_channel(message: discord.Message) -> bool:
is_correct_channel: bool = message.channel.id == botconfig.BOT_CHANNEL
is_correct_forum: bool = getattr(
message.channel, "parent_id", None) == botconfig.BOT_CHANNEL
if not is_correct_channel and not is_correct_forum:
logging.error(
f"Message received in a channel that is not the bot channel. Message channel ID: {message.channel.id}, Bot channel ID: {botconfig.BOT_CHANNEL}")
return False
return True