File size: 568 Bytes
7f2cb09
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""Module doc string"""

from discord_webhook import DiscordWebhook

from .config import DISCORD_HOOK, ENVIRONMENT
from .logs import logger


def discord_hook(message):
    """_summary_"""
    logger.info(message)
    if ENVIRONMENT != "LOCAL":
        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.")