# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/03-notificator.ipynb (unless otherwise specified).

__all__ = ['TelegramNotificator', 'send']

# Cell

import telebot
import fastcore.basics as fcb
from .core import logger

# Cell

class TelegramNotificator:
    def __init__(self, token='6190703828:AAFksjz6MrtXDkQpTdiy7-A4zig0wT_g1Uo', chat_id='662822665'):

        # create attribute bot:
        self.bot = telebot.TeleBot(token)

        # create attribute chat_id:
        self.chat_id = chat_id

        logger.info(f"SUCCESS: started bot")

# Cell

@fcb.patch_to(TelegramNotificator)
def send(self, text):

    """
    METHOD TO SEND A TEXT MESSAGE.
    """
    bot = self.bot
    bot.send_message(self.chat_id, text)
    logger.info(f"SUCCESS: sent message")