iwestlin / gd-utils

Google Drive 百宝箱
1.31k stars 424 forks source link

手工操作可以运行,但是机通过机器人造作显示无法获取对象信息 #225

Closed windyin closed 3 years ago

windyin commented 3 years ago

通过docker 安装,未配置SA,通过client id / secret访问

发现如果通过tg-bot机器人操作,无论做啥操作,都显示“无法获取对象信息,请检查链接是否有效且SA拥有相应的权限”,同时服务端log打出“没有可用的SA” 但是如果登录服务端直接命令行操作,则一切正常。。

windyin commented 3 years ago

tg message: { "update_id": 964964389, "callback_query": { "id": "2332744023492927644", "from": { "id": 543134292, "is_bot": false, "first_name": "Tommy", "last_name": "Page", "username": "windyin", "language_code": "zh-hans" }, "message": { "message_id": 350, "from": { "id": 1249765445, "is_bot": true, "first_name": "gdwindyin", "username": "gdwindyinbot" }, "chat": { "id": 543134292, "first_name": "Tommy", "last_name": "Page", "username": "windyin", "type": "private" }, "date": 1610550566, "text": "识别出分享ID 1dTUl77MsT2_ci2jQwygyjCz1oOEPirPn,请选择动作", "reply_markup": { "inline_keyboard": [ [ { "text": "文件统计", "callback_data": "count 1dTUl77MsT2_ci2jQwygyjCz1oOEPirPn" }, { "text": "开始复制", "callback_data": "copy 1dTUl77MsT2_ci2jQwygyjCz1oOEPirPn" } ], [ { "text": "强制刷新", "callback_data": "update 1dTUl77MsT2_ci2jQwygyjCz1oOEPirPn" }, { "text": "清除按钮", "callback_data": "clear_button" } ], [ { "text": "复制到 movie", "callback_data": "copy 1dTUl77MsT2_ci2jQwygyjCz1oOEPirPn movie" } ] ] } }, "chat_instance": "-1956412518376283296", "data": "count 1dTUl77MsT2_ci2jQwygyjCz1oOEPirPn" } } 没有可用的SA 没有可用的SA 没有可用的SA 没有可用的SA 没有可用的SA 没有可用的SA 没有可用的SA Error: 无法获取对象信息,请检查链接是否有效且SA拥有相应的权限:https://drive.google.com/drive/folders/1dTUl77MsT2_ci2jQwygyjCz1oOEPirPn at gen_count_body (/gd-utils/src/gd.js:111:11) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async send_count (/gd-utils/src/tg.js:326:17)

windyin commented 3 years ago

bash-5.0# ./count 1dTUl77MsT2_ci2jQwygyjCz1oOEPirPn

信息获取完毕 所有目录读取完毕 ┌──────┬───────┬───────────┐ │ Type │ Count │ Size │ ├──────┼───────┼───────────┤ │ mkv │ 11 │ 25.46 GB │ ├──────┼───────┼───────────┤ │ srt │ 10 │ 538.38 KB │ ├──────┼───────┼───────────┤ │ 总计 │ 21 │ 25.47 GB │

iwestlin commented 3 years ago

命令行可以运行是因为你没加 -S 参数,所以就默认用了个人帐号授权。 命令行具体用法可以看 ./count -h

机器人无法使用是因为它默认使用sa授权,如果希望机器人也使用个人账号可以参考: https://github.com/iwestlin/gd-utils/issues/59#issuecomment-653738463

iwestlin commented 3 years ago

另外修改代码之后需要执行 pm2 reload server 重启下机器人的服务

windyin commented 3 years ago

的确如此,已解决. Thanks