Coder Social home page Coder Social logo

cc-telegram's Introduction

cc-telegram

Async bot framework for Telegram Messenger designed for Python >= 3.5.
Named after シー・ツー

tip for next commit
1

Running

Clone the repo, fill settings.py with your settings. Run:

python3 cc.py

You can also run bot with different config module. For example, if your settings file is called settings_test.py, run:

python3 cc.py -s settings_test

You can daemonize bot by adding -d option:

python3 cc.py -d

To get all available options check:

python3 cc.py --help

Modules

All modules should be written with async in mind, since modules executor is non-blocking and built on top of Python's asyncio.
However, if you write blocking module, it will not block main event loop anyway, CC is designed to run blocking module in another thread.

Async modules should define main method as async def main(bot, *args, **kwargs) and use await keyword where it's needed. You can check some modules inside modules dir of this repo and see differences between blocking and non-blocking modules.

Module types:

  • user_* - command called with '/command' syntax, available for all users
  • owner_* - command called with '/command' syntax, available only for owner (there's owner option in the settings)
  • audio_* - module will be called on each audio message
  • video_* - called on each video message
  • text_* - called on each text message
  • photo_* - called on each message with photo
  • sticker_* - called on each message with sticker

Check currently available modules by running /lsmod command in chat.

Running tests

You can run the full test suite using:

python3 -m unittest discover tests

cc-telegram's People

Contributors

aluminiumgeek avatar hoofoo avatar seenkoo avatar c0llar avatar ahushh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.