Skip to content

Latest commit

 

History

History
51 lines (36 loc) · 1.83 KB

File metadata and controls

51 lines (36 loc) · 1.83 KB

Signal Bot Framework

PyPI Downloads Version License CI codecov

Python package to build your own Signal bots.

Important

Signalbot v2 is being developed at #240. Feedback on the direction is welcomed, either as a comment there or in #234

Installation

See the getting started section in the documentation.

Minimal bot

This is what a minimal bot using signalbot looks like:

import os
import logging
from signalbot import SignalBot, Config, Command, Context, triggered, enable_console_logging


class PingCommand(Command):
    @triggered("Ping")
    async def handle(self, context: Context) -> None:
        await context.send("Pong")


if __name__ == "__main__":
    enable_console_logging(logging.INFO)

    bot = SignalBot(
        Config(
            signal_service=os.environ["SIGNAL_SERVICE"],
            phone_number=os.environ["PHONE_NUMBER"],
        )
    )
    bot.register(PingCommand()) # Run the command for all contacts and groups
    bot.start()

Help

See the documentation for more details.