Closed ljhmily closed 1 year ago
The text backend expects to run in an interactive shell where you can type commands directly to the bot via the console. Running errbot as a daemon detaches from stdin/stdout and stderr, which causes the text backend to shutdown because it can't read from stdin. This is by design and not a bug since running the text backend in the background prevents interaction with it.
If you want to be able to run errbot in background mode you should use the Null
backend, which does not expect to have access to stdin/stdout/stderr.
The text backend expects to run in an interactive shell where you can type commands directly to the bot via the console. Running errbot as a daemon detaches from stdin/stdout and stderr, which causes the text backend to shutdown because it can't read from stdin. This is by design and not a bug since running the text backend in the background prevents interaction with it.
If you want to be able to run errbot in background mode you should use the
Null
backend, which does not expect to have access to stdin/stdout/stderr. emm,in the backend list, it not give the Null backend. i create some webapi as plugins, so even in text backend, i can use web api to get the interactive replies.
i have two server, and the python envirionment the same, the other one can be use text backend with backgroud mode, but this one cannot.
and, i tried the Null backend, it cannot reply my web query with the webrequests.
My understanding is the text backend can not run without an interactive shell. If you managed to do it on one server, you'll need to figure out what you did and do the same thing on the second server.
Failing that, I see two possible ways to get errbot working the way you seem to want:
screen
or tmux
to start errbot in foreground mode with an interactive shell. (not a very clean solution, but it'd work)the text backend is not necessary for me. my webapi is like this, but it cannot run as the Null backend, it cannot reply.
errbot is designed first and foremost as a chat bot, not a web server. It might have a webserver integration, but that is not its core function or intended use case. If you want to attempt to use errbot as a webserver, you're free to do that, but the problems you're encountering are because of the way errbot is designed.
You might want to consider frameworks that are specifically designed for web server use cases (flask, bottle etc). If you insist on using errbot as a webserver, you will probably need to fork errbot and adapt the code to match your requirements.
errbot is designed first and foremost as a chat bot, not a web server. It might have a webserver integration, but that is not its core function or intended use case. If you want to attempt to use errbot as a webserver, you're free to do that, but the problems you're encountering are because of the way errbot is designed.
You might want to consider frameworks that are specifically designed for web server use cases (flask, bottle etc). If you insist on using errbot as a webserver, you will probably need to fork errbot and adapt the code to match your requirements.
got that,i Adjusted some code,the Null mode is ok now。
Errbot does have webhook functionality, as described in https://errbot.readthedocs.io/en/latest/user_guide/plugin_development/webhooks.html.
It's strongly suggested to not expose it directly but use it behind a real webserver, like nginx or apache.
Describe the bug my errbot cannot start as daemon, it always shutdown automatic
To Reproduce start with errbot -d -c config.py, and then it start my port, then shutdown it, the logs like this the console mode start is right
Expected behavior start normal.
Screenshots If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
Additional context Add any other context about the problem here.