Open patrickelectric opened 6 years ago
Hi @patrickelectric, you ran bottery startproject <name>
, configured your bot token on settings.py
and executed bottery run
? This message indicates that something on configurations step didn't work (e.g. setting polling mode on Telegram platform).
I understand that the message isn't helpful at all. I'll take a look and try to make it better.
Thanks for opening the issue.
I have a local computer running the code without problems. Maybe can be something related with my vps ? Both settings are identical. Code struct:
wilson
├── bot.py
├── getnet.py
├── __pycache__
│ ├── bot.cpython-35.pyc
│ ├── getnet.cpython-35.pyc
│ └── settings.cpython-35.pyc
└── settings.py
You can check my settings here.
My guess would be something related to the polling mode. Since it keeps requesting updates from Telegram API, could the VPS be thinking your are DDoSing them?
I would suggest you to use webhook mode. Almost no changes on settings.py
, but you would need to expose your bot on port 80 or 88 (ref) (we don't support SSL yet, sorry about that).
Update your version of bottery (0.1.0a10), I just published this --port
feature (:
$ bottery run --port 80
HOSTNAME = 'your.vps.ip' # changing here
SECRET_KEY = 'super-secret-key'
PLATFORMS = {
'telegram': {
'ENGINE': 'bottery.platform.telegram',
'OPTIONS': {
'token': 'I have my token here !',
'mode': 'webhook', # changing here
}
},
}
Same error.. I don't know if this can help, but running the local bot, and starting the vps bot, the local one returns:
January 01, 2018 - 21:17:49
Bottery version 0.0.1a9
Server running at http://localhost:7000
Quit the bot with CONTROL-C
Task exception was never retrieved
future: <Task finished coro=<TelegramEngine.polling() done, defined at /usr/lib/python3.6/site-packages/bottery/platform/telegram/engine.py:74> exception=KeyError('result',)>
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/bottery/platform/telegram/engine.py", line 91, in polling
tasks = [self.message_handler(msg) for msg in updates['result']]
KeyError: 'result'
Oh, I thought it was working on your local machine. The token you put on settings.py
is exactly as you got from BotFather? This is probably the case.
Sorry, probably I was not clear enough. Yes, the bot is working in my local machine, this error appear in my local machine when I start the vps bot. My conclusion is that the vps bot start the communication with the telegram server, that's why my local bot exit. I don't know if this information can help, just a plus.
Alright, when you said same error
did you mean the No tasks found
problem? I don't know how Telegram reacts when there are two different machines making request for its API but I do know that it only works on one mode at the time, polling or webhook.
I have the same error running on heroku. I coundn't emulate it locally, thought. It is very possible I've ran two machines at the same time with the bot, but I only get this error in production. The worst part is heroku stops the process after some error, and the bot goes offiline for a while (from minutes to hours).
To me would be enough to silence this error and continue, but I'm yet studing how can I do this.
I just realized that revoke the token and generate a new one can solve this problem
Fresh install,
No tasks found.
appear withbottery run
.