Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Dispatcher #39

Merged
merged 8 commits into from
Aug 3, 2024
Merged

Improve Dispatcher #39

merged 8 commits into from
Aug 3, 2024

Conversation

z44d
Copy link
Owner

@z44d z44d commented Aug 3, 2024

  • Added compose function to run multiple bots
from tgram import TgBot, filters, compose
from tgram.types import Message

bot = TgBot("...", parse_mode="Markdown")
bot_2 = TgBot("...", parse_mode="Markdown")
FILTERS = filters.command("start")

@bot.on_message(FILTERS)
@bot_2.on_message(FILTERS)
async def on_start(_, m: Message) -> Message:
    return await m.reply_text(
        "**Hi**",
    )

compose([bot, bot_2])
  • Move the class variables to TgBot.__init__
  • Added stop method

@z44d z44d merged commit 104ace3 into main Aug 3, 2024
2 checks passed
@z44d z44d deleted the dispatcher branch August 3, 2024 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant