Skip to content
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
22 changes: 14 additions & 8 deletions bot/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@

class Client(commands.Bot):
def __init__(self):
intents = discord.Intents.all()
super().__init__(intents=intents, command_prefix="s!", help_command=None)

try:
db.connect()
except Exception as e:
print("[ERROR] Error while connecting to the database: ", e)
intents = discord.Intents.none()
intents.guilds = True
intents.guild_messages = True
intents.message_content = True # privileged
intents.members = True # privileged — needed for role assignment cache lookup
super().__init__(
intents=intents,
command_prefix="s!",
help_command=None,
max_messages=100,
chunk_guilds_at_startup=False,
)

self.db = db
self.logger = Logger(self)
Expand Down Expand Up @@ -81,8 +86,9 @@ async def on_message(self, message: discord.Message):
if message.author.bot:
return

guild_config = self.guilds_config.get(message.guild.id, {"blacklisted_channel": []})
if message.channel.id not in [
channel["channel_id"]
for channel in self.guilds_config[message.guild.id]["blacklisted_channel"]
for channel in guild_config["blacklisted_channel"]
]:
await self.points_event.process_message(message)
Loading