mattoofahad
formatting\
604d694
raw
history blame
690 Bytes
"""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)