Beispiel #1
0
from bot import TelegramBot

bot = TelegramBot("config.cfg")


def make_reply(msg):
    reply = None
    if msg is not None:
        reply = 'Okay'
    return reply

update_id = None
while True:
    updates = bot.get_updates(offset=update_id)
    updates = updates["result"]
    if updates:
        for item in updates:
            update_id = item["update_id"]
            try:
                message = str(item["message"]["text"])
            except:
                message = None
            from_ = item["message"]["from"]["id"]
            reply = make_reply(message)
            bot.send_message(reply, from_)
Beispiel #2
0
from bot import TelegramBot

my_bot = TelegramBot()

msg = """
*JUST CREATED A TELEGRAM BOT*

*AUTHOR:* LENNY
*LANGUAGE:* PYTHON
*MESSAGE:* I AM AWESOME

"""

my_bot.send_message(msg=msg, chat_id=681966513)