mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-07 09:52:30 -05:00
Bump d.py version to 2.4.0 (#6401)
Co-authored-by: Ryan <yamikaitou@gmail.com>
This commit is contained in:
@@ -40,10 +40,10 @@ HUMANIZED_PERM = {
|
||||
"add_reactions": _("Add Reactions"),
|
||||
"view_audit_log": _("View Audit Log"),
|
||||
"priority_speaker": _("Priority Speaker"),
|
||||
"stream": _("Go Live"),
|
||||
"stream": _("Video"),
|
||||
"read_messages": _("Read Text Channels & See Voice Channels"),
|
||||
"send_messages": _("Send Messages"),
|
||||
"send_tts_messages": _("Send TTS Messages"),
|
||||
"send_tts_messages": _("Send Text-to-speech Messages"),
|
||||
"manage_messages": _("Manage Messages"),
|
||||
"embed_links": _("Embed Links"),
|
||||
"attach_files": _("Attach Files"),
|
||||
@@ -70,12 +70,16 @@ HUMANIZED_PERM = {
|
||||
"create_private_threads": _("Create Private Threads"),
|
||||
"external_stickers": _("Use External Stickers"),
|
||||
"send_messages_in_threads": _("Send Messages in Threads"),
|
||||
"start_embedded_activities": _("Start Activities"),
|
||||
"moderate_members": _("Moderate Member"),
|
||||
"use_embedded_activities": _("Use Activities"),
|
||||
"moderate_members": _("Time out members"),
|
||||
"view_creator_monetization_analytics": _("View Creator Monetization Analytics"),
|
||||
"use_soundboard": _("Use Soundboard"),
|
||||
"create_expressions": _("Create Expressions"),
|
||||
"create_events": _("Create Events"),
|
||||
"use_external_sounds": _("Use External Sounds"),
|
||||
"send_voice_messages": _("Send Voice Messages"),
|
||||
"send_polls": _("Create Polls"),
|
||||
"use_external_apps": _("Use External Apps"),
|
||||
}
|
||||
|
||||
DANGEROUS_COMMANDS = {
|
||||
|
||||
@@ -445,7 +445,6 @@ class Filter(commands.Cog):
|
||||
|
||||
async def filter_hits(
|
||||
self,
|
||||
text: str,
|
||||
server_or_channel: Union[
|
||||
discord.Guild,
|
||||
discord.TextChannel,
|
||||
@@ -453,6 +452,7 @@ class Filter(commands.Cog):
|
||||
discord.StageChannel,
|
||||
discord.Thread,
|
||||
],
|
||||
*texts: str,
|
||||
) -> Set[str]:
|
||||
if isinstance(server_or_channel, discord.Guild):
|
||||
guild = server_or_channel
|
||||
@@ -483,7 +483,8 @@ class Filter(commands.Cog):
|
||||
self.pattern_cache[(guild.id, channel and channel.id)] = pattern
|
||||
|
||||
if pattern:
|
||||
hits |= set(pattern.findall(text))
|
||||
for text in texts:
|
||||
hits |= set(pattern.findall(text))
|
||||
return hits
|
||||
|
||||
async def check_filter(self, message: discord.Message):
|
||||
@@ -506,7 +507,15 @@ class Filter(commands.Cog):
|
||||
user_count = 0
|
||||
member_data["filter_count"] = user_count
|
||||
|
||||
hits = await self.filter_hits(message.content, message.channel)
|
||||
texts = [message.content]
|
||||
poll = message.poll
|
||||
if poll is not None:
|
||||
texts.append(poll.question or "")
|
||||
for answer in poll.answers:
|
||||
texts.append(answer.text or "")
|
||||
for attachment in message.attachments:
|
||||
texts.append(attachment.description or "")
|
||||
hits = await self.filter_hits(message.channel, *texts)
|
||||
|
||||
if hits:
|
||||
# modlog doesn't accept PartialMessageable
|
||||
@@ -607,7 +616,7 @@ class Filter(commands.Cog):
|
||||
|
||||
await set_contextual_locales_from_guild(self.bot, guild)
|
||||
|
||||
if await self.filter_hits(member.display_name, member.guild):
|
||||
if await self.filter_hits(member.guild, member.display_name):
|
||||
name_to_use = guild_data["filter_default_name"]
|
||||
reason = _("Filtered nickname") if member.nick else _("Filtered name")
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user