father-bot / chatgpt_telegram_bot Goto Github PK
View Code? Open in Web Editor NEW💬 Telegram bot with ChatGPT, Python-based, using OpenAI's API.
Home Page: https://t.me/chatgpt_karfly_bot
License: MIT License
💬 Telegram bot with ChatGPT, Python-based, using OpenAI's API.
Home Page: https://t.me/chatgpt_karfly_bot
License: MIT License
Karim. Good evening. Will you help me with starting script? Im кефирчик at coding and don
t know, how can i start the script. Also when i using mv config/config.example.yml config/config.yml i got an error "The System Cannot Find The Path Specified"
Recently, I found this awesome project which can integrate the chatgpt into teleggram, and I was instantly install and run it on some of my server which run pretty good.
But also, I found that we'll rely on the mongodb and mongo-express, which take lots of disk space, to store messages.
So I'm wandering if we could supports some light weight database like sqlite instead of mongo; this difinitely can save some disk space and make the install less painful on the budget vps.
Thanks!
Hi,
When i am chat is: "today"
Bot answer:
Today is Monday, November 20th, 2020. (20/11/2020)
but today real: 7/2/2023
chat on web is ok
Hi! I try to set up bot, but i always give the same error:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/telegram/ext/_application.py", line 945, in process_update
await coroutine
File "/usr/local/lib/python3.8/site-packages/telegram/ext/_handler.py", line 135, in handle_update
return await self.callback(update, context)
File "bot/bot.py", line 137, in new_dialog_handle
db.set_user_attribute(user_id, "last_interaction", datetime.now())
File "/code/bot/database.py", line 90, in set_user_attribute
self.check_if_user_exists(user_id, raise_exception=True)
File "/code/bot/database.py", line 23, in check_if_user_exists
raise ValueError(f"User {user_id} does not exist")
ValueError: User 300300302 does not exist
My config.yml :
allowed_telegram_usernames: [Username] # if empty, the bot is available to anyone
I also try:
allowed_telegram_usernames: [300300302] # if empty, the bot is available to anyone
allowed_telegram_usernames: ["Username"] # if empty, the bot is available to anyone
allowed_telegram_usernames: [] # if empty, the bot is available to anyone
But this no effect
it says service.mongodb.ports is invalid
Use the python-telegram-bot[socks] to support proxy.?
I made a bot through PyCharm and Docker. But in some, instead of an answer, a long error in telegram message. Am I doing something wrong?
An exception was raised while handling an update
.
.
.
NameError: name 'telegram' is not defined
Something went wrong during completion. Reason: Internal server error {
"error": {
"message": "Internal server error",
"type": "auth_subrequest_error",
"param": null,
"code": "internal_error"
}
}
500 {'error': {'message': 'Internal server error', 'type': 'auth_subrequest_error', 'param': None, 'code': 'internal_error'}} {'Date': 'Tue, 21 Feb 2023 08:13:58 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '166', 'Connection': 'keep-alive', 'Vary': 'Origin', 'X-Request-Id': '592b4cb57132fa43332fa570de93fb21', 'Strict-Transport-Security': 'max-age=15724800; includeSubDomains'}
Tried with two different setup with fresh OpenAI API Key. Same result.
After startup i got error in telegram messages:
Something went wrong during completion. Reason: 'NoneType' object is not subscriptable
docker compose --env-file config/config.env up --build
unknown flag: --env-file
See 'docker --help'.
I got that bug
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/telegram/ext/_application.py", line 945, in process_update
await coroutine
File "/usr/local/lib/python3.8/site-packages/telegram/ext/_handler.py", line 135, in handle_update
return await self.callback(update, context)
File "bot.py", line 84, in message_handle
await update.message.reply_text(answer, parse_mode=ParseMode.HTML)
UnboundLocalError: local variable 'answer' referenced before assignment
for those who dont have a VPS?
Thank you for this great project! Please consider adding an open source license like MIT.
when i create container using docker-compose --env-file config/config.env up --build,
it report this message
Define and run multi-container applications with Docker.
Usage:
docker-compose [-f <arg>...] [options] [COMMAND] [ARGS...]
docker-compose -h|--help
Options:
-f, --file FILE Specify an alternate compose file (default: docker-compose.yml)
-p, --project-name NAME Specify an alternate project name (default: directory name)
--verbose Show more output
-v, --version Print version and exit
-H, --host HOST Daemon socket to connect to
--tls Use TLS; implied by --tlsverify
--tlscacert CA_PATH Trust certs signed only by this CA
--tlscert CLIENT_CERT_PATH Path to TLS certificate file
--tlskey TLS_KEY_PATH Path to TLS key file
--tlsverify Use TLS and verify the remote
--skip-hostname-check Don't check the daemon's hostname against the name specified
in the client certificate (for example if your docker host
is an IP address)
--project-directory PATH Specify an alternate working directory
(default: the path of the Compose file)
Commands:
build Build or rebuild services
bundle Generate a Docker bundle from the Compose file
config Validate and view the Compose file
create Create services
down Stop and remove containers, networks, images, and volumes
events Receive real time events from containers
exec Execute a command in a running container
help Get help on a command
images List images
kill Kill containers
logs View output from containers
pause Pause services
port Print the public port for a port binding
ps List containers
pull Pull service images
push Push service images
restart Restart services
rm Remove stopped containers
run Run a one-off command
scale Set number of containers for a service
start Start services
stop Stop services
top Display the running processes
unpause Unpause services
up Create and start containers
version Show the Docker-Compose version information
can you help me ? please
As far as i understood, only username in here, can use bot? "allowed_telegram_usernames"?
I was writing it with @, and without.
And while checking it on second account, could freely use bot.
I am getting the above error that is on the title. Could you please help me with that?
EDIT: Fixed it
After install the bot, when I type the order on telegram, I got the wrong response: Something went wrong during completion. Reason: 'NoneType' object is not subscriptable
How could I fix this issue. Thanks.
I removed username but i want to use allowed_telegram_usernames configuration, how can i do it
log:
....
chatgpt_telegram_bot | The above exception was the direct cause of the following exception:
chatgpt_telegram_bot |
chatgpt_telegram_bot | Traceback (most recent call last):
chatgpt_telegram_bot | File "bot/bot.py", line 259, in
chatgpt_telegram_bot | run_bot()
chatgpt_telegram_bot | File "bot/bot.py", line 255, in run_bot
chatgpt_telegram_bot | application.run_polling()
chatgpt_telegram_bot | File "/usr/local/lib/python3.8/site-packages/telegram/ext/_application.py", line 618, in run_polling
chatgpt_telegram_bot | return self.__run(
chatgpt_telegram_bot | File "/usr/local/lib/python3.8/site-packages/telegram/ext/_application.py", line 768, in __run
chatgpt_telegram_bot | raise exc
chatgpt_telegram_bot | File "/usr/local/lib/python3.8/site-packages/telegram/ext/_application.py", line 759, in __run
chatgpt_telegram_bot | loop.run_until_complete(self.initialize())
chatgpt_telegram_bot | File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
chatgpt_telegram_bot | return future.result()
chatgpt_telegram_bot | File "/usr/local/lib/python3.8/site-packages/telegram/ext/_application.py", line 319, in initialize
chatgpt_telegram_bot | await self.bot.initialize()
chatgpt_telegram_bot | File "/usr/local/lib/python3.8/site-packages/telegram/_bot.py", line 375, in initialize
chatgpt_telegram_bot | await self.get_me()
chatgpt_telegram_bot | File "/usr/local/lib/python3.8/site-packages/telegram/_bot.py", line 238, in decorator
chatgpt_telegram_bot | result = await func(*args, **kwargs)
chatgpt_telegram_bot | File "/usr/local/lib/python3.8/site-packages/telegram/_bot.py", line 545, in get_me
chatgpt_telegram_bot | result = await self._post(
chatgpt_telegram_bot | File "/usr/local/lib/python3.8/site-packages/telegram/_bot.py", line 310, in _post
chatgpt_telegram_bot | return await request.post(
chatgpt_telegram_bot | File "/usr/local/lib/python3.8/site-packages/telegram/request/_baserequest.py", line 160, in post
chatgpt_telegram_bot | result = await self._request_wrapper(
chatgpt_telegram_bot | File "/usr/local/lib/python3.8/site-packages/telegram/request/_baserequest.py", line 279, in _request_wrapper
chatgpt_telegram_bot | raise exc
chatgpt_telegram_bot | File "/usr/local/lib/python3.8/site-packages/telegram/request/_baserequest.py", line 269, in _request_wrapper
chatgpt_telegram_bot | code, payload = await self.do_request(
chatgpt_telegram_bot | File "/usr/local/lib/python3.8/site-packages/telegram/request/_httpxrequest.py", line 195, in do_request
chatgpt_telegram_bot | raise NetworkError(f"httpx HTTPError: {err}") from err
chatgpt_telegram_bot | telegram.error.NetworkError: httpx HTTPError:
mongo | {"t":{"$date":"2023-02-12T00:03:00.961+00:00"},"s":"I", "c":"-", "id":20883, "ctx":"conn22","msg":"Interrupted operation as its client disconnected","attr":{"opId":2317}}
mongo | {"t":{"$date":"2023-02-12T00:03:00.962+00:00"},"s":"I", "c":"NETWORK", "id":22944, "ctx":"conn22","msg":"Connection ended","attr":{"remote":"172.18.0.4:59144","uuid":"86276229-d956-479b-a756-90b6c8c19b46","connectionId":22,"connectionCount":2}}
mongo | {"t":{"$date":"2023-02-12T00:03:01.005+00:00"},"s":"I", "c":"NETWORK", "id":22944, "ctx":"conn23","msg":"Connection ended","attr":{"remote":"172.18.0.4:59146","uuid":"0f9dbfe4-6e35-468c-81ff-913d32753c53","connectionId":23,"connectionCount":1}}
chatgpt_telegram_bot exited with code 1
....
I got an error if i try to start docker image.
First everything seems to bei fine:
~/projects/chatgpt_telegram_bot# docker compose up --build [+] Building 28.7s (12/12) FINISHED => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 32B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load metadata for docker.io/library/python:3.8-slim 20.7s => [internal] load build context 0.0s => => transferring context: 4.99kB 0.0s => [1/7] FROM docker.io/library/python:3.8-slim@sha256:e7eab22979e5698f18432aca3cc54d91b025282640b869cf17e4b87fb612144d 0.0s => CACHED [2/7] RUN apt-get update 0.0s => CACHED [3/7] RUN apt-get install -y python3 python3-pip python-dev build-essential python3-venv 0.0s => CACHED [4/7] RUN mkdir -p /chatgpt_telegram_bot 0.0s => [5/7] ADD . /chatgpt_telegram_bot 0.0s => [6/7] WORKDIR /chatgpt_telegram_bot 0.0s => [7/7] RUN pip3 install -r requirements.txt 7.2s => exporting to image 0.6s => => exporting layers 0.6s => => writing image sha256:d36bbb10bf9ba5cd2a12b4fcba237773c6d5c18abd75748ca9162dbfd2a18235 0.0s => => naming to docker.io/library/chatgpt_telegram_bot_chatgpt_telegram_bot 0.0s [+] Running 1/0 ⠿ Container chatgpt_telegram_bot Recreated 0.1s
But then this occurs:
Attaching to chatgpt_telegram_bot chatgpt_telegram_bot | Error refreshing session chatgpt_telegram_bot | <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html xmlns='http://www.w3.org/1999/xhtml'><head><meta content='text/html; charset=utf-8' http-equiv='content-type'/><style type='text/css'>body { font-family:Arial; margin-left:40px; }img { border:0 none; }#content { margin-left: auto; margin-right: auto }#message h2 { font-size: 20px; font-weight: normal; color: #000000; margin: 34px 0px 0px 0px }#message p { font-size: 13px; color: #000000; margin: 7px 0px 0px 0px }#errorref { font-size: 11px; color: #737373; margin-top: 41px }</style><title>Microsoft</title></head><body><div id='content'><div id='message'><h2>The request is blocked.</h2></div><div id='errorref'><span>[...]=</span></div></div></body></html>
what can i do to solve this?
Hello, Is there a way to make text-davinci-003 act more like ChatGPT? By providing it with more detailed and thorough prompts?
ERROR: for mongo Cannot create container for service mongo: status code not OK but 500: � ˙˙˙˙� �� �System.Exception ClassNameMessage�Data�InnerExceptionHelpURL�StackTraceString�RemoteStackTraceString�RemoteStackIndex�ExcWatsonBuckets������� � �)System.Collections.ListDictionaryInternal�System.Excepti��� �System.Exception�� XThe notification platform is unavailable.
i am running docker 4.4.4
I cannot find the corresponding image in the Docker on Synology NAS, which image I can looking for? Please help me.Thx
Hello, I got the error after running:
azr@U002:~/chatgpt_telegram_bot$ docker-compose --env-file config/config.env up --build
ERROR: The Compose file './docker-compose.yml' is invalid because:
services.mongo.ports is invalid: Invalid port "27017 # MongoDB port:27017 # MongoDB port", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
services.mongo_express.ports is invalid: Invalid port "8081 # Mongo Express port:8081 # Mongo Express port", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]
Any thoughts what's going wrong? Thanks!
Thank you for providing this library!
config.example.env
: Cannot have comments #
The following should be deletedDockerfile
:
RUN python -m pip install --upgrade pip
RUN pip3 install -r requirements.txt --root-user-action=ignore
ENV PIP_ROOT_USER_ACTION=ignore
example file
:hatgpt_telegram_bot | Traceback (most recent call last):
chatgpt_telegram_bot | File "bot.py", line 8, in
chatgpt_telegram_bot | from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
chatgpt_telegram_bot | ModuleNotFoundError: No module named 'telegram'
chatgpt_telegram_bot exited with code 0
chatgpt_telegram_bot | Traceback (most recent call last):
chatgpt_telegram_bot | File "bot.py", line 8, in
chatgpt_telegram_bot | from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
chatgpt_telegram_bot | ModuleNotFoundError: No module named 'telegram'
chatgpt_telegram_bot exited with code 0
chatgpt_telegram_bot | Traceback (most recent call last):
chatgpt_telegram_bot | File "bot.py", line 8, in
chatgpt_telegram_bot | from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
chatgpt_telegram_bot | ModuleNotFoundError: No module named 'telegram'
chatgpt_telegram_bot exited with code 1
chatgpt_telegram_bot | Traceback (most recent call last):
chatgpt_telegram_bot | File "bot.py", line 8, in
chatgpt_telegram_bot | from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
chatgpt_telegram_bot | ModuleNotFoundError: No module named 'telegram'
chatgpt_telegram_bot exited with code 1
chatgpt_telegram_bot | Traceback (most recent call last):
chatgpt_telegram_bot | File "bot.py", line 8, in
chatgpt_telegram_bot | from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
chatgpt_telegram_bot | ModuleNotFoundError: No module named 'telegram'
chatgpt_telegram_bot exited with code 1
chatgpt_telegram_bot | Traceback (most recent call last):
chatgpt_telegram_bot | File "bot.py", line 8, in
chatgpt_telegram_bot | from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
chatgpt_telegram_bot | ModuleNotFoundError: No module named 'telegram'
chatgpt_telegram_bot exited with code 1
Very lacking is the option to disable "new_dialog_timeout". I want to make myself an "assistant" that I can always talk to in the past context.
An exception was raised while handling an update
update = {
"update_id": 856662397,
"message": {
"chat": {
"id": 915625592,
"type": "private",
"last_name": "L",
"first_name": "S",
"username": "wangxun0712"
},
"text": "where is china",
"group_chat_created": false,
"entities": [],
"new_chat_members": [],
"new_chat_photo": [],
"message_id": 5,
"delete_chat_photo": false,
"caption_entities": [],
"date": 1670847311,
"supergroup_chat_created": false,
"photo": [],
"channel_chat_created": false,
"from": {
"is_bot": false,
"username": "wangxun0712",
"first_name": "S",
"last_name": "L",
"id": 915625592,
"language_code": "zh-hans"
}
}
}
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/telegram/ext/_application.py", line 945, in process_update
await coroutine
File "/usr/local/lib/python3.8/site-packages/telegram/ext/_handler.py", line 135, in handle_update
return await self.callback(update, context)
File "bot.py", line 33, in prompt_handle
r = chatgpt.get_chat_response(prompt)
File "/usr/local/lib/python3.8/site-packages/revChatGPT/revChatGPT.py", line 54, in get_chat_response
response = json.loads(response)
File "/usr/local/lib/python3.8/json/init.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 3 (char 2)
If comment like this:
MONGODB_PATH=./mongodb # local path where to store MongoDB
MONGODB_PORT=27017 # MongoDB port
Then in some system, mongo path will be "./mongodb # local path where to store MongoDB" and port will be "27017 # MongoDB port", which could not be specified.
So I think config.env should be:
# local path where to store MongoDB
MONGODB_PATH=./mongodb
# MongoDB port
MONGODB_PORT=27017
# Mongo Express port
MONGO_EXPRESS_PORT=8081
# Mongo Express username
MONGO_EXPRESS_USERNAME=username
# Mongo Express password
MONGO_EXPRESS_PASSWORD=password
Comments should not be placed after the variable.
The error replied in telegram:"Something went wrong during completion. Reason: 'NoneType' object is not subscriptable"
mongo | {"t":{"$date":"2023-02-16T14:31:41.464+00:00"},"s":"I", "c":"INDEX", "id":20345, "ctx":"conn4","msg":"Index build: done building","attr":{"buildUUID":null,"collectionUUID":{"uuid":{"$uuid":"xxx"}},"namespace":"chatgpt_telegram_bot.user","index":"id","ident":"index-8--6246329400734996252","collectionIdent":"collection-7--6246329400734996252","commitTimestamp":null}}
chatgpt_telegram_bot | Something went wrong during completion. Reason: 'NoneType' object is not subscriptable
chatgpt_telegram_bot | Something went wrong during completion. Reason: 'NoneType' object is not subscriptable
chatgpt_telegram_bot | Something went wrong during completion. Reason: 'NoneType' object is not subscriptable
chatgpt_telegram_bot | Something went wrong during completion. Reason: 'NoneType' object is not subscriptable
It works fine with the following lines deleted.
https://github.com/karfly/chatgpt_telegram_bot/blob/main/docker-compose.yml#L9
https://github.com/karfly/chatgpt_telegram_bot/blob/main/docker-compose.yml#L29
If someone deploy on public cloud, it will be danger...
First of all, Thank you for your appreciation of the project. I have noticed that the codes are not within the block code as markdown, and it would be great if the chat group were added.
And added some options such get last pervious chat group.
Hello, OpenAI just release the gpt-3.5-turbo API, can you support it?
If possible, can you mention the minimum and ideal systema and hardware requirements to run this.
Thanks.
Just putting this here if other people encounter this issue, with mongo:latest
the error was:
WARNING: MongoDB 5.0+ requires a CPU with AVX support, and your current system does not appear to have that!
see https://jira.mongodb.org/browse/SERVER-54407
see also https://www.mongodb.com/community/forums/t/mongodb-5-0-cpu-intel-g4650-compatibility/116610/2
see also https://github.com/docker-library/mongo/issues/485#issuecomment-891991814
mongo exited with code 132
The fix was to edit docker-compose.yml
and replace mongo:latest
with mongo:4.4.18
.
Hi,
below is answer of bot some times.
Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/telegram/ext/_application.py", line 945, in process_update await coroutine File "/usr/local/lib/python3.8/site-packages/telegram/ext/_handler.py", line 135, in handle_update return await self.callback(update, context) File "bot/bot.py", line 87, in message_handle await register_user_if_not_exists(update, context, update.message.from_user) AttributeError: 'NoneType' object has no attribute 'from_user'
mongo-express | Welcome to mongo-express
mongo-express | ------------------------
mongo-express |
mongo-express |
mongo-express | (node:7) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
mongo-express | Could not connect to database using connectionString: mongodb://mongo:27017/chatgpt_telegram_bot"
mongo-express | (node:7) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [mongo:27017] on first connect [Error: getaddrinfo ENOTFOUND mongo
mongo-express | at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:66:26) {
mongo-express | name: 'MongoNetworkError'
mongo-express | }]
mongo-express | at Pool. (/node_modules/mongodb/lib/core/topologies/server.js:441:11)
mongo-express | at Pool.emit (events.js:314:20)
mongo-express | at /node_modules/mongodb/lib/core/connection/pool.js:564:14
mongo-express | at /node_modules/mongodb/lib/core/connection/pool.js:1000:11
mongo-express | at /node_modules/mongodb/lib/core/connection/connect.js:32:7
mongo-express | at callback (/node_modules/mongodb/lib/core/connection/connect.js:300:5)
mongo-express | at Socket. (/node_modules/mongodb/lib/core/connection/connect.js:330:7)
mongo-express | at Object.onceWrapper (events.js:421:26)
mongo-express | at Socket.emit (events.js:314:20)
mongo-express | at emitErrorNT (internal/streams/destroy.js:92:8)
mongo-express | at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
mongo-express | at processTicksAndRejections (internal/process/task_queues.js:84:21)
mongo-express | (node:7) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
mongo-express | (node:7) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Tried using the bot by adding it on a group yet it doesn't respond to any commands other than Private Chats
`
An exception was raised while handling an update
update = {
"update_id": 329041365,
"message": {
"chat": {
"id": -1001479127404,
"type": "supergroup",
"username": "daboyclub",
"title": "The Boy's🕺&💃Girl's Club"
},
"text": "/new@clubwaifubot",
"group_chat_created": false,
"entities": [
{
"length": 17,
"type": "bot_command",
"offset": 0
}
],
"new_chat_members": [],
"reply_to_message": {
"chat": {
"id": -1001479127404,
"type": "supergroup",
"username": "daboyclub",
"title": "The Boy's🕺&💃Girl's Club"
},
"group_chat_created": false,
"entities": [],
"new_chat_members": [],
"new_chat_photo": [],
"message_id": 53913,
"delete_chat_photo": false,
"caption_entities": [],
"date": 1669044355,
"supergroup_chat_created": false,
"photo": [],
"channel_chat_created": false,
"from": {
"is_bot": false,
"username": "AaronOmoriChan",
"first_name": "Aaron",
"last_name": "Chan",
"id": 836019393,
"language_code": "en"
}
},
"new_chat_photo": [],
"message_id": 62391,
"delete_chat_photo": false,
"caption_entities": [],
"date": 1674797813,
"supergroup_chat_created": false,
"photo": [],
"channel_chat_created": false,
"from": {
"is_bot": false,
"username": "AaronOmoriChan",
"first_name": "Aaron",
"last_name": "Chan",
"id": 836019393,
"language_code": "en"
}
}
}Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/telegram/ext/_application.py", line 945, in process_update
await coroutine
File "/usr/local/lib/python3.8/site-packages/telegram/ext/_handler.py", line 135, in handle_update
return await self.callback(update, context)
File "bot/bot.py", line 149, in new_dialog_handle
await update.message.reply_text(f"{chatgpt.CHAT_MODES[chat_mode]['welcome_message']}", parse_mode=ParseMode.HTML)
File "/usr/local/lib/python3.8/site-packages/telegram/_message.py", line 784, in reply_text
return await self.get_bot().send_message(
File "/usr/local/lib/python3.8/site-packages/telegram/_bot.py", line 238, in decorator
result = await func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/telegram/_bot.py", line 637, in send_message
return await self._send_message( # type: ignore[return-value]
File "/usr/local/lib/python3.8/site-packages/telegram/ext/_extbot.py", line 253, in _send_message
result = await super()._send_message(
File "/usr/local/lib/python3.8/site-packages/telegram/_bot.py", line 346, in _send_message
result = await self._post(
File "/usr/local/lib/python3.8/site-packages/telegram/_bot.py", line 310, in _post
return await request.post(
File "/usr/local/lib/python3.8/site-packages/telegram/request/_baserequest.py", line 160, in post
result = await self._request_wrapper(
File "/usr/local/lib/python3.8/site-packages/telegram/request/_baserequest.py", line 319, in _request_wrapper
raise BadRequest(message)
telegram.error.BadRequest: Replied message not found
`
The messaging worked for a while on the groupchat while I mentioned with the command on a particular Group
Hello,
I've just received a message from DigitalOcean where I setup an Ubuntu vps for my chatGPT telegram bot. They said:
"A recent network security scan suggests your Droplet chatGPT is running a MongoDB instance and that it may be unintentionally exposing data, or misconfigured to allow unauthorized access.
MongoDB listens for traffic from everywhere on port 27107 and you can validate this report by attempting to connect to your MongoDB instance on via a simple telnet command:
telnet ... 27107
If the connection is successful you will receive output like the following, which will confirm that your service is visible to the public Internet:
Trying ... ...
Connected to ... .
Escape character is '^]'.You will want to restrict access to your MongoDB instance to prevent outsiders from reading or modifying your data. "
I don't want to block traffic by IP, how can I increase the security for this issue?
When I add new users to allowed_telegram_usernames, I have to recreate image.
Consider add a volume like: config:/root/config, then I can just restart the container by docker-compose up -d
.
or is there a better way?
Karfly
No
DEBUG:urllib3.connectionpool:Resetting dropped connection: api.openai.com
DEBUG:urllib3.util.retry:Incremented Retry for (url='/v1/engines/text-davinci-003/completions'): Retry(total=1, connect=None, read=None, redirect=None, status=None)
WARNING:urllib3.connectionpool:Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f2a89af1460>: Failed to establish a new connection: [Errno 110] Connection timed out')': /v1/engines/text-davinci-003/completions
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (10139): api.openai.com:443
When same thing is run directly on the host, there are no connection issues.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.