Skip to content

KyleJamesWalker/telebot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telebot

Note: This is not pyTelegramBotAPI, but do to often confusion I have included it within this package. So if you accidentally install this instead of pyTelegramBotAPI the examples, etc will still work.

This originally was telegram bot library, with simple route decorators, and will now be imported as telebot_router, to separate pyTelegramBotAPI and this package from collision.

Currently a work in progress, doesn't do much now, but will register and send messages.

Example Setup

from telebot_router import TeleBot

app = TeleBot(__name__)


@app.route('/command ?(.*)')
def example_command(message, cmd):
    chat_dest = message['chat']['id']
    msg = "Command Recieved: {}".format(cmd)

    app.send_message(chat_dest, msg)


@app.route('(?!/).+')
def parrot(message):
   chat_dest = message['chat']['id']
   user_msg = message['text']

   msg = "Parrot Says: {}".format(user_msg)
   app.send_message(chat_dest, msg)


if __name__ == '__main__':
    app.config['api_key'] = 'xxxxxxxx:enterYourBotKeyHereToTest'
    app.poll(debug=True)