Run hooks

pull/133/head
stijndcl 2022-09-22 01:18:40 +02:00
parent 72415aeed0
commit abbb3026eb
3 changed files with 13 additions and 7 deletions

View File

@ -3,7 +3,7 @@ import os
import pathlib import pathlib
import re import re
from functools import cached_property from functools import cached_property
from typing import Union, Optional from typing import Optional, Union
import discord import discord
from aiohttp import ClientSession from aiohttp import ClientSession
@ -19,8 +19,8 @@ from didier.data.embeds.error_embed import create_error_embed
from didier.data.embeds.schedules import Schedule, parse_schedule from didier.data.embeds.schedules import Schedule, parse_schedule
from didier.exceptions import HTTPException, NoMatch from didier.exceptions import HTTPException, NoMatch
from didier.utils.discord.prefix import get_prefix from didier.utils.discord.prefix import get_prefix
from didier.utils.easter_eggs import detect_easter_egg
from didier.utils.discord.snipe import should_snipe from didier.utils.discord.snipe import should_snipe
from didier.utils.easter_eggs import detect_easter_egg
from didier.utils.types.datetime import tz_aware_now from didier.utils.types.datetime import tz_aware_now
__all__ = ["Didier"] __all__ = ["Didier"]
@ -342,14 +342,20 @@ class Didier(commands.Bot):
if not should_snipe(message): if not should_snipe(message):
return return
self.sniped[message.channel.id] = (message, None,) self.sniped[message.channel.id] = (
message,
None,
)
async def on_message_edit(self, before: discord.Message, after: discord.Message): async def on_message_edit(self, before: discord.Message, after: discord.Message):
"""Event triggered when a message is edited""" """Event triggered when a message is edited"""
if not should_snipe(before): if not should_snipe(before):
return return
self.sniped[before.channel.id] = (before, after,) self.sniped[before.channel.id] = (
before,
after,
)
async def on_ready(self): async def on_ready(self):
"""Event triggered when the bot is ready""" """Event triggered when the bot is ready"""

View File

@ -2,7 +2,6 @@ import discord
from didier.utils.regexes import STEAM_CODE from didier.utils.regexes import STEAM_CODE
__all__ = ["should_snipe"] __all__ = ["should_snipe"]

View File

@ -1,6 +1,6 @@
from typing import Union
from dataclasses import dataclass
import re import re
from dataclasses import dataclass
from typing import Union
__all__ = ["STEAM_CODE"] __all__ = ["STEAM_CODE"]
@ -8,6 +8,7 @@ __all__ = ["STEAM_CODE"]
@dataclass @dataclass
class Regex: class Regex:
"""Dataclass for a type of pattern""" """Dataclass for a type of pattern"""
pattern: str pattern: str
flags: Union[int, re.RegexFlag] = 0 flags: Union[int, re.RegexFlag] = 0