Skip to main content

一个用于生成 Sticker 的简易 Telegram Bot 框架

Project description

StickerViaBot

一个用于生成 Sticker 的简易 Telegram Bot 框架

Requirements

  • python>=3.7
  • pyrogram~=2.0.97
  • pluginlib~=0.9.0

Installation

pip install StickerViaBot

Usage

只需简单一个 main.py 即可运行,把项目 git 下来改下 main.py 不也能跑

"""
main.py
"""
from StickerViaBot import create_bot


bot = create_bot(
    session_name = 'StickerViaBot',
    api_id = 0,         # TELEGRAM_API_ID
    api_hash = "",      # TELEGRAM_API_HASH
    bot_token = "",     # TELEGRAM_BOT_TOKEN
    plugins=dict(root="plugins"),  # PLUGINS_DIR_PATH
)

if __name__ == '__main__':
    import logging
    logging.basicConfig(level=logging.INFO)
    bot.run()

如果你要运行在 Docker 之中,只需要通过环境变量进行传递

For Plugins

虽然说了怎么使用,但最重要一点还是如何编写插件。 插件的简单范例在plugins文件夹内,插件的规范需要参考pluginlib文档

编写插件常用的函数放在StickerViaBot.utils里面。文件中Utils类的函数一般与Telegram Bot有关,依赖于pyrogram.Client才能使用, 设计上直接继承到StickerViaBot.Bot之中。

Note

  1. 设计 inline mode 用到的绘图,需要注意结果返回时间,如果超时将不返回结果。对于动图类的,建议改用 command mode ,以确保稳定工作

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

StickerViaBot-0.2.2.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

StickerViaBot-0.2.2-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file StickerViaBot-0.2.2.tar.gz.

File metadata

  • Download URL: StickerViaBot-0.2.2.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for StickerViaBot-0.2.2.tar.gz
Algorithm Hash digest
SHA256 3da8e01c35238e086119412ade573073bdca8bf7f760845c3101f3529caad775
MD5 fbe9ab3a60529597a863e9ac46f38201
BLAKE2b-256 771d210bd7ba92819268465dd2503952a1d031e32c923ba4a5abe3e201436b96

See more details on using hashes here.

File details

Details for the file StickerViaBot-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for StickerViaBot-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9ad9e9cb1c2de5f82ae79b6756bf9dd18ba3f145ebcbbbd75de0ac5be44ac3ff
MD5 4ade74a81452ed23064fbf00c9190a49
BLAKE2b-256 e2d009108e7bf1fa11bbb924bfc1ce1407eb2c7ea59a84db4b8b3487c01a1cf4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page