Compare commits
No commits in common. "cfb1b8449d9c19fe24153d1539b10e0e05b85cbc" and "bd5706c0ce46b811ed67f4a69e8a120fcb22a17e" have entirely different histories.
cfb1b8449d
...
bd5706c0ce
3 changed files with 5 additions and 26 deletions
|
@ -5,7 +5,6 @@ from typing import Union
|
|||
|
||||
from disnake import Embed, Member, Thread, User
|
||||
from disnake.abc import GuildChannel
|
||||
from disnake.errors import Forbidden
|
||||
from disnake.ext.commands import Cog, group, guild_only
|
||||
|
||||
from .utils import can_view, confirm, test_keyword
|
||||
|
@ -65,16 +64,10 @@ async def handle_notification(db_updates, ctx, message, keyword, user_id, use_em
|
|||
icon_url=message.author.display_avatar,
|
||||
)
|
||||
|
||||
try:
|
||||
await member.send(header, embed=embed)
|
||||
except Forbidden:
|
||||
log.warning("Cannot send messages to this user")
|
||||
else:
|
||||
log.debug("Sending plain message")
|
||||
try:
|
||||
await member.send("\n".join((header, indent(message.content, "> ", lambda line: True).strip(), footer)))
|
||||
except Forbidden:
|
||||
log.warning("Cannot send messages to this user")
|
||||
|
||||
log.debug("Sent")
|
||||
|
||||
|
|
|
@ -148,10 +148,6 @@ You may want to `{ctx.clean_prefix}nomen export` first"""
|
|||
You will not trigger anyone else's notifications, and you will not receive any notifications
|
||||
"""
|
||||
|
||||
if await ctx.bot.get_setting(ctx.author.id, "disabled"):
|
||||
await ctx.send("You are already opted-out")
|
||||
return
|
||||
|
||||
log.debug(f"Opting-out: {ctx.author} ({ctx.author.id})")
|
||||
|
||||
await ctx.send(
|
||||
|
@ -167,10 +163,6 @@ You may want to `{ctx.clean_prefix}nomen export` first"""
|
|||
Opt-in to Nomen processing your messages
|
||||
"""
|
||||
|
||||
if not await ctx.bot.get_setting(ctx.author.id, "disabled"):
|
||||
await ctx.send("You are already opted-in")
|
||||
return
|
||||
|
||||
log.debug(f"Opting-in: {ctx.author} ({ctx.author.id})")
|
||||
|
||||
await ctx.send(
|
||||
|
|
|
@ -4,7 +4,6 @@ from itertools import chain
|
|||
|
||||
import re2 as re
|
||||
from disnake import ChannelType
|
||||
from disnake.ext.commands import BadArgument
|
||||
|
||||
log = logging.getLogger("nomen.utils")
|
||||
|
||||
|
@ -88,14 +87,9 @@ def compile_keyword(keyword, regex):
|
|||
if not regex:
|
||||
keyword = re.escape(keyword)
|
||||
|
||||
try:
|
||||
reg = re.compile(rf"(?i)\b{keyword}\b")
|
||||
regex_cache[(keyword, regex)] = reg
|
||||
return reg
|
||||
except re._re2.Error:
|
||||
raise BadArgument(
|
||||
"Invalid regex. Nomen only supports regexes that [re2](<https://github.com/google/re2>) can parse."
|
||||
)
|
||||
|
||||
|
||||
def contains(string, keyword, regex):
|
||||
|
|
Loading…
Reference in a new issue