chatgpt_telegram_bot icon indicating copy to clipboard operation
chatgpt_telegram_bot copied to clipboard

Can it support group multiplayer chat?

Open Nanlo1 opened this issue 2 years ago • 2 comments
trafficstars

  1. Support multi-person group chat
  2. @ trigger reply

Nanlo1 avatar Mar 09 '23 10:03 Nanlo1

When using the bot in group chats, it replies to every user in the group, which can be inconvenient. It would be more convenient if the bot supports @ trigger. Moreover.

there is an error in group chat usage:

Encountered error one:

出了一些问题. 原因: 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, 07 Mar 2023 11:38:11 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '166', 'Connection': 'keep-alive', 'Vary': 'Origin', 'X-Request-Id': '4ba25b98241f1abe13a79c3500917e17', 'Strict-Transport-Security': 'max-age=15724800; includeSubDomains'}

Encountered error two:


 处理更新时出现异常
update = {
  "update_id": 412403869,
  "message": {
    "chat": {
      "id": -1001666799105,
      "type": "supergroup",
      "username": "community_tiancheng1",
      "title": "天秤社区"
    },
    "text": "【Btok-DID-CCDS】\n我是CCDS.SNS铁军\n我为CCDS打CALL",
    "group_chat_created": false,
    "entities": [
      {
        "length": 16,
        "type": "spoiler",
        "offset": 0
      },
      {
        "length": 11,
        "type": "spoiler",
        "offset": 29
      }
    ],
    "message_id": 8197,
    "delete_chat_photo": false,
    "date": 1678190313,
    "supergroup_chat_created": false,
    "channel_chat_created": false,
    "from": {
      "is_bot": false,
      "first_name": "阳",
      "last_name": "仔",
      "id": 5331402222
    }
  }
}

Traceback (most recent call last):
  File "bot/bot.py", line 112, in message_handle
    answer, n_used_tokens, n_first_dialog_messages_removed = chatgpt_instance.send_message(
  File "/code/bot/chatgpt.py", line 54, in send_message
    r = openai.ChatCompletion.create(
  File "/usr/local/lib/python3.8/site-packages/openai/api_resources/chat_completion.py", line 25, in create
    return super().create(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
    response, _, api_key = requestor.request(
  File "/usr/local/lib/python3.8/site-packages/openai/api_requestor.py", line 226, in request
    resp, got_stream = self._interpret_response(result, stream)
  File "/usr/local/lib/python3.8/site-packages/openai/api_requestor.py", line 619, in _interpret_response
    self._interpret_response_line(
  File "/usr/local/lib/python3.8/site-packages/openai/api_requestor.py", line 679, in _interpret_response_line
    raise self.handle_error_response(
openai.error.APIError: 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, 07 Mar 2023 11:58:47 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '166', 'Connection': 'keep-alive', 'Vary': 'Origin', 'X-Request-Id': 'ad950aec822375ef64768ce047fa6410', 'Strict-Transport-Security': 'max-age=15724800; includeSubDomains'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/telegram/ext/_application.py", line 1104, in process_update
    await coroutine
  File "/usr/local/lib/python3.8/site-packages/telegram/ext/_handler.py", line 141, in handle_update
    retu

Nanlo1 avatar Mar 09 '23 14:03 Nanlo1

Adding to group and an interesting feature. I'll research it.

karfly avatar Mar 10 '23 13:03 karfly

Looking forward to this feature.

secsilm avatar Mar 16 '23 11:03 secsilm

If bot will reply only after mention it @ - could be really nice.

cookins avatar Mar 16 '23 16:03 cookins

Looking forward to this feature so much!

ITqua avatar Mar 16 '23 23:03 ITqua

Bots can be added to groups: See SO thread

I did a PR to allow restricting the bot's answer, only to mention #140

clemsau avatar Mar 18 '23 18:03 clemsau

same issue replying every messege in group.

Abdul-Kaium5 avatar Mar 19 '23 12:03 Abdul-Kaium5

Hi! I've just added support of group chats. Please update the code (git pull) and send /help_group_chat to bot to get instructions (I also added video instruction there).

@1491928274 @secsilm @cookins @ITqua @clemsau @ab-kaium

karfly avatar Apr 21 '23 11:04 karfly