File size: 690 Bytes
de28db9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
604d694
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""Module doc string"""

from discord_webhook import DiscordWebhook

from .config import DISCORD_HOOK
from .logs import logger


def discord_hook(message):
    """_summary_"""
    try:
        logger.info(message)
        url = DISCORD_HOOK
        if url != "NO_HOOK":
            webhook = DiscordWebhook(
                url=url, username="simple-chat-bot", content=message
            )
            webhook.execute()
            logger.debug("Discord Hook Successful.")
        else:
            logger.debug("Discord Hook Failed.")
    except Exception as error:
        error_message = f"Discord Hook Failed. Error {error}"
        logger.error(error_message)