Skip to content

Instantly share code, notes, and snippets.

@MamdMehrabi
Created May 3, 2024 08:19
Show Gist options
  • Save MamdMehrabi/08c842d2be8e923524e56576b0c90707 to your computer and use it in GitHub Desktop.
Save MamdMehrabi/08c842d2be8e923524e56576b0c90707 to your computer and use it in GitHub Desktop.

Questions:

  • How Create Bot in bale messanger ??
  • How to develop a bot ?

We want to answer the above questions!

  1. install bale to this link
  2. create account in bale
  3. search @botfather and send messsage this bot
  4. create bot with @botfather and get token

Well, until now we were able to create a bot and now we have to give the token to our Python source...

from balepy import Client
from asyncio import run


__token = 'your-token-here'
client = Client(__token, timeout=10)

async def main():
    async for message in client.on_message():
        await message.reply('hello __from__ **balepy**')


if __name__ == '__main__':
    run(main())
  1. in this step give token to __token and run source !

congratulation! You have succeeded in writing your first bale bot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment