No project description provided
Project description
OrigamiBot - A Pythonic telegram bot API library
This is WORK IN PROGRESS
Library for creating bots for telegram with Python.
TODO
- implement methods for sending messages, media, etc
Usage example
Here goes a simple example of a bot:
from sys import argv
from time import sleep
from origamibot import OrigamiBot as Bot
class BotsCommands:
def __init__(self, bot: Bot): # Can initialize however you like
self.bot = bot
def start(self, message): # /start command
self.bot.send_message(
message.chat.id,
'Hello user!\nThis is an example bot.')
def echo(self, message, value: str): # /echo [value: str] command
self.bot.send_message(
message.chat.id,
value)
def add(self, message, a: float, b: float): # /add [a: float] [b: float] command
self.bot.send_message(
message.chat.id,
str(a + b)
)
if __name__ == '__main__':
token = (argv[1]
if len(argv) > 1 else
input('Enter bot token: '))
bot = Bot(token)
bot.add_commands(BotsCommands(bot))
bot.start() # start bot's threads
while True:
sleep(1)
# Can also do some useful work i main thread
# Like autoposting to channels for example
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
origamibot-0.0.1.tar.gz
(11.7 kB
view details)
Built Distribution
File details
Details for the file origamibot-0.0.1.tar.gz
.
File metadata
- Download URL: origamibot-0.0.1.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4302bb15826dcf4d66b190f45ec476f974243d74b0eaeee42452963e3b6721f6 |
|
MD5 | 0979733098e111e90c954ff63c7200cf |
|
BLAKE2b-256 | 3c38acb9b77575857467c3138c4b5a5dbc9a3cd9ec3867684614665d8166674d |
File details
Details for the file origamibot-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: origamibot-0.0.1-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d1f0ae8ef70917e190ddbb5b3b01c9b79478e36df245b34b8fd023c6242cf51 |
|
MD5 | fb5abf41d173c61b8115f1eee02e9bf0 |
|
BLAKE2b-256 | 2120c0a3439507185dfa2f82a792a3025e66fa0fcf601634d28997bdb19206a8 |