Compare commits
5
Commits
70037fb47a
...
v2.1.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b221f1e438 | ||
|
|
1b08ba1355 | ||
|
|
e191df1a38 | ||
|
|
e35a2a8c8d | ||
|
|
d7046e4595 |
@@ -17,6 +17,7 @@ class ChannelIds:
|
|||||||
event_post: int
|
event_post: int
|
||||||
general: int
|
general: int
|
||||||
voting: int
|
voting: int
|
||||||
|
ban: int
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import nextcord
|
|||||||
from nextcord.ext import commands
|
from nextcord.ext import commands
|
||||||
|
|
||||||
from dakiny_bot.app import birthday_list
|
from dakiny_bot.app import birthday_list
|
||||||
|
from dakiny_bot.DakinySettings import settings
|
||||||
|
|
||||||
|
|
||||||
class SubmissionListener(commands.Cog, name="Message Listener"):
|
class SubmissionListener(commands.Cog, name="Message Listener"):
|
||||||
@@ -16,7 +17,15 @@ class SubmissionListener(commands.Cog, name="Message Listener"):
|
|||||||
async def on_message(self, message: nextcord.Message) -> None:
|
async def on_message(self, message: nextcord.Message) -> None:
|
||||||
"""Listener for message creation. Adds score and attachments to submission."""
|
"""Listener for message creation. Adds score and attachments to submission."""
|
||||||
# don't want to process any messages from bot.
|
# don't want to process any messages from bot.
|
||||||
if message.author.id == self.bot.user.id:
|
if message.author.id == self.bot.user.id: # pyright: ignore[reportOptionalMemberAccess]
|
||||||
|
return
|
||||||
|
|
||||||
|
# Ban all members who message in this channel. Everyone in guild is a member, so shouldn't miss a ban
|
||||||
|
# due to message.author not being a nextcord.Member object.
|
||||||
|
if message.channel.id == settings.channel_ids.ban and isinstance(message.author, nextcord.Member):
|
||||||
|
await message.author.ban(
|
||||||
|
delete_message_seconds=30 * 60, reason="Probable spam. The ban channel was messaged."
|
||||||
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
await birthday_action(message)
|
await birthday_action(message)
|
||||||
@@ -31,7 +40,7 @@ def setup(bot: commands.Bot) -> None:
|
|||||||
|
|
||||||
async def birthday_action(message: nextcord.Message) -> None:
|
async def birthday_action(message: nextcord.Message) -> None:
|
||||||
"""
|
"""
|
||||||
Checks a message's auther and mentions to see if they are in the birthday list.
|
Checks a message's author and mentions to see if they are in the birthday list.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
message (nextcord.Message): The message to check for a birthday person.
|
message (nextcord.Message): The message to check for a birthday person.
|
||||||
|
|||||||
Reference in New Issue
Block a user