JungDev / django-telegrambot

Simple app for Telegram bot in Django
BSD 3-Clause "New" or "Revised" License
237 stars 88 forks source link

sampleproject not working #32

Open ilmenshik opened 5 years ago

ilmenshik commented 5 years ago

Every time I try to run sampleproject from the repository, the bot does not work. The application starts, but the bot does not work. If I change the code without shutting down, django will reread the files and the bot will start working.

I tried to call main() in wsgi.py, but only got an error: list index out of range here: https://github.com/JungDev/django-telegrambot/blob/master/django_telegrambot/apps.py#L47

How to make the bot work at the start (after manage.py runserver)?

JungDev commented 5 years ago

Do you have a valid bot token in your config?

lukruh commented 4 years ago

How to make the bot work at the start (after manage.py runserver)?

If you have added the bot token in settings.py and configured it to use webhooks, it should be enough to call manage.py runserver. For bot polling you have to start the bot with manage.py botpolling --username=<botusername>.

Make sure the module name (folder which contains telegrambot.py) is added to installed apps and matches your bots username (@... not the displayed name) in the command and in your main function.