Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/KyleJamesWalker/telebot
Small Telegram Bot Framework
https://github.com/KyleJamesWalker/telebot
Last synced: about 1 month ago
JSON representation
Small Telegram Bot Framework
- Host: GitHub
- URL: https://github.com/KyleJamesWalker/telebot
- Owner: KyleJamesWalker
- License: mit
- Created: 2015-07-12T16:41:05.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-04-26T04:34:43.000Z (over 1 year ago)
- Last Synced: 2024-04-27T02:44:03.334Z (8 months ago)
- Language: Python
- Size: 18.6 KB
- Stars: 47
- Watchers: 6
- Forks: 13
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
- awesome-python-resources - Source
README
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)