Compare commits
2 commits
b7ca0b9a3e
...
d8135eb55d
Author | SHA1 | Date | |
---|---|---|---|
d8135eb55d | |||
0966dc2ca3 |
2 changed files with 7 additions and 4 deletions
|
@ -9,6 +9,7 @@ import traceback
|
||||||
from contextlib import redirect_stdout
|
from contextlib import redirect_stdout
|
||||||
|
|
||||||
import disnake
|
import disnake
|
||||||
|
import re2 as re
|
||||||
from disnake import Embed, Guild, Intents, Message, Thread
|
from disnake import Embed, Guild, Intents, Message, Thread
|
||||||
from disnake.ext import commands
|
from disnake.ext import commands
|
||||||
from disnake.ext.commands import Bot, Paginator
|
from disnake.ext.commands import Bot, Paginator
|
||||||
|
@ -17,7 +18,7 @@ from dotenv import find_dotenv, load_dotenv
|
||||||
from .db import run_db_migrations, setup_db
|
from .db import run_db_migrations, setup_db
|
||||||
from .notifications import Notifications
|
from .notifications import Notifications
|
||||||
from .settings import Settings
|
from .settings import Settings
|
||||||
from .utils import cleanup_code
|
from .utils import cleanup_code, contains
|
||||||
|
|
||||||
# Logger setup
|
# Logger setup
|
||||||
logger_disnake = logging.getLogger("disnake")
|
logger_disnake = logging.getLogger("disnake")
|
||||||
|
@ -228,9 +229,11 @@ async def on_message(message: Message):
|
||||||
if now < timeout:
|
if now < timeout:
|
||||||
return
|
return
|
||||||
|
|
||||||
c = message.content.lower().split(" ")
|
mentions_nomen = contains(message, "nomen", False)
|
||||||
|
mentions_help = contains(message, "help", False)
|
||||||
|
asks_for_help = contains(message, r"how\b(\w+\b)+use\b(\w+\b)*nomen", True)
|
||||||
|
|
||||||
if "help" in c and "nomen" in c:
|
if (mentions_nomen and mentions_help) or asks_for_help:
|
||||||
help_timeouts[ctx.channel.id] = now + datetime.timedelta(minutes=5)
|
help_timeouts[ctx.channel.id] = now + datetime.timedelta(minutes=5)
|
||||||
prefix = (await bot.get_guild_prefix(ctx.guild) if ctx.guild else DEFAULT_PREFIX) or "@nomen "
|
prefix = (await bot.get_guild_prefix(ctx.guild) if ctx.guild else DEFAULT_PREFIX) or "@nomen "
|
||||||
await message.reply(f"""\
|
await message.reply(f"""\
|
||||||
|
|
|
@ -31,7 +31,7 @@ class KeywordError(Exception):
|
||||||
|
|
||||||
async def send(self, ctx):
|
async def send(self, ctx):
|
||||||
if self.msg:
|
if self.msg:
|
||||||
await ctx.send(self.msg + " (check DMs)")
|
await ctx.send(self.msg + (" (check DMs)" if self.dm_msg else ""))
|
||||||
if self.dm_msg:
|
if self.dm_msg:
|
||||||
await ctx.author.send(self.dm_msg)
|
await ctx.author.send(self.dm_msg)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue