Code Monkey home page Code Monkey logo

gd's Introduction

青龙安装Bot监控

- [x] 2022.4.9 已兼容青龙`2.12.x`版本路经

1.进入容器内

# 进入青龙容器内,“qinglong” 为容器名字。
docker exec -it qinglong /bin/bash

2.安装依赖

  • 一键安装
rm -f install.sh* && wget -q https://raw.githubusercontent.com/curtinlv/gd/main/install.sh && bash install.sh

3.配置tg机器人参数

青龙存放位置:/ql/config /ql/data/config
  • bot.json 填写你的机器人token 用户id等参数
  • diybotset.json 填写监控群组频道id等参数
  • jk.json 自定义监控变量和应对脚本路径
#登录青龙面板
菜单【配置文件】右上角选择对应配置文件进行编辑
bot.json
diybotset.json

Ps: 可参考本仓库 conf/xxx.json

4.启动机器人

#青龙2.10x
cd /ql/jbot/
#青龙2.12.x版本
cd /ql/data/jbot/

#第一次启动是这样启动,后续启动参考底部相关命令
pm2 start ecosystem.config.js 
#查看运行状态
pm2 status jbot 

# 查看日志:看看有没有报错。
tail -100f /ql/log/bot/run.log
#青龙2.12
tail -100f /ql/data/log/bot/run.log
#终止查看日志 按 Ctrl+C

  • 如TG收到机器人信息,证明你填写的机器人参数是正确的∆。

图2:完成登录,tg机器人发通知

登录user开启监控

  • a.发送【/user】 点击 “重新登录”

图1:首次登录授权个人tg

  • b.输入手机号格式0086x x xx x x (要关闭两步验证)

图2:登录

  • c.发送【user?】 给你的机器人,有以下回复,证明监控状态正常。

图3:测试1

图4:测试2

  • 在所监控的频道发出变量,机器人会马上通知:

图4:测试2

恭喜你,部署已完成。

#################### 相关命令 ####################
操作环境:进入容器内
## 查看机器人运行状态
pm2 status jbot

## 启动机器人:
pm2 start jbot

## 停止机器人
pm2 stop jbot

## 重启机器人
pm2 restart jbot

## 一键更新1
rm -rf /ql/repo/gd && cd /ql/repo/ && git clone https://github.com/curtinlv/gd.git && pm2 stop jbot ; rm -rf /ql/jbot/* && cp -a /ql/repo/gd/* /ql/jbot/ ; pm2 start jbot

#或一键更新2
if [ -d /ql/data ];then QL=/ql/data;else QL=/ql; fi;cd ${QL} && rm -f update.sh* && wget  -q https://raw.githubusercontent.com/curtinlv/gd/main/update.sh >/dev/null && bash update.sh

## 卸载机器人
pm2 stop jbot && pm2 delete jbot
rm -rf /ql/jbot/*
rm -rf /ql/data/jbot/*

机器人指令

/restart 重启机器人

/upgd 更新机器人

/user? 查看监控状态

/clean 清理缓存日志,释放空间

/help 命令帮助

最近更新 2022.4.10(v1.3.0)

  • 新增清理功能 /clean
  • 兼容青龙版本2.12.x
  • 优化变量匹配正则
  • 解决user?不回复问题
  • 优化队列问题
  • /user 重复对话问题

更多

特别感谢

gd's People

Contributors

curtinlv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gd's Issues

监控KR开卡时的变量

首先非常感谢大佬的脚本,真的很好用。

这里反馈一个小问题,监控KR开卡时,输出变量时由于两个''的关系,输出的变量成了
export VENDER_ID="1000094033"

这个是不是要去USER.PY中修改?

不知道启动为啥报错

2022-04-24 20:49:34,044 asyncio ERROR [default_exception_handler] Task exception was never retrieved future: <Task finished name='Task-11' coro=<hello() done, defined at /ql/jbot/main.py:71> exception=ValueError('Could not find the input entity for PeerUser(user_id=1046689044) (PeerUser). Please read https://docs.telethon.dev/en/latest/concepts/entities.html to find out more details.')> Traceback (most recent call last): File "/ql/jbot/main.py", line 76, in hello await jdbot.send_message(chat_id, f'{str(hello_word)}\n\n\t{info}', link_preview=False) File "/usr/lib/python3.8/site-packages/telethon/client/messages.py", line 810, in send_message entity = await self.get_input_entity(entity) File "/usr/lib/python3.8/site-packages/telethon/client/users.py", line 466, in get_input_entity raise ValueError( ValueError: Could not find the input entity for PeerUser(user_id=1046689044) (PeerUser). Please read https://docs.telethon.dev/en/latest/concepts/entities.html to find out more details.Screenshot_2022-04-24-21-19-07-08_61c78dc80ee02b53007c815fefe993e3.jpg

挂机时间久了不监控

时间长了就不监控频道了,其他指令有反应,就是user?没反应,也不监控,重启也不行,重装可以解决,什么问题
Uploading 231D3C50-B3BE-4F59-9A29-5A6F83F6C090.png…

python3 -m jbot

python3 -m jbot
出现这个错误

Traceback (most recent call last):
File "/usr/local/lib/python3.10/runpy.py", line 187, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/local/lib/python3.10/runpy.py", line 146, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/local/lib/python3.10/runpy.py", line 110, in _get_module_details
import(pkg_name)
File "/ql/jbot/init.py", line 90, in
jdbot = TelegramClient("bot", API_ID, API_HASH, connection=connectionType, proxy=proxy).start(bot_token=TOKEN)
File "/usr/local/lib/python3.10/site-packages/telethon/client/auth.py", line 133, in start
else self.loop.run_until_complete(coro)
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "/usr/local/lib/python3.10/site-packages/telethon/client/auth.py", line 140, in _start
await self.connect()
File "/usr/local/lib/python3.10/site-packages/telethon/client/telegrambaseclient.py", line 525, in connect
if not await self._sender.connect(self._connection(
File "/usr/local/lib/python3.10/site-packages/telethon/network/mtprotosender.py", line 127, in connect
await self._connect()
File "/usr/local/lib/python3.10/site-packages/telethon/network/mtprotosender.py", line 253, in _connect
raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 5 time(s)

pm2运行错误了

[PM2][WARN] Applications jbot not running, starting...
[PM2][ERROR] Error: Script not found: /ql/python
大佬这个错误怎么解决

安装好后登陆出现以下

The authorization key (session file) was used under two different IP addresses simultaneously, and can no longer be used. Use the same session exclusively, or use different sessions (caused by InvokeWithLayerRequest(InitConnectionRequest(GetConfigRequest)))

求助大佬:启动机器人报错

root@550fdc2698ca:/ql $ python3 -m jbot
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 185, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.8/runpy.py", line 144, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/lib/python3.8/runpy.py", line 111, in _get_module_details
import(pkg_name)
File "/ql/jbot/init.py", line 1, in
from telethon import TelegramClient, connection
ModuleNotFoundError: No module named 'telethon'

为什么提示缺少这个data里的js呢,需要运行的js已经复制到ql/scripts路径下了

JD_News, [2022/3/28 0:08]
【替换】 转盘抽奖 环境变量成功
M_WX_LUCK_DRAW_URL="https://lzkj-isv.isvjcloud.com/lzclient/1648397227906/cjwx/common/entry.html?activityId=90fdad31e1c045b38356334e5872dbc4&gameType=wxTurnTable&"

JD_News, [2022/3/28 0:08]

开始执行... 2022-03-28 00:08:09

node:internal/modules/cjs/loader:936
throw err;
^

Error: Cannot find module '/ql/data/scripts/m_jd_wx_luckDraw.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}

Node.js v17.7.2

执行结束... 2022-03-28 00:08:10 耗时 1 秒

[已解决]首次启动报错,不知道该怎么解决

asyncio ERROR [default_exception_handler] Task exception was never retrieved
future: <Task finished name='Task-10' coro=<hello() done, defined at /ql/data/jbot/main.py:71> exception=ValueError('Could not find the input entity for PeerUser(user_id=2096307281) (PeerUser). Please read https://docs.telethon.dev/en/latest/concepts/entities.html to find out more details.')>
Traceback (most recent call last):
File "/ql/data/jbot/main.py", line 76, in hello
await jdbot.send_message(chat_id, f'{str(hello_word)}\n\n\t{info}', link_preview=False)
File "/usr/lib/python3.9/site-packages/telethon/client/messages.py", line 810, in send_message
entity = await self.get_input_entity(entity)
File "/usr/lib/python3.9/site-packages/telethon/client/users.py", line 466, in get_input_entity
raise ValueError(
ValueError: Could not find the input entity for PeerUser(user_id=2096307281) (PeerUser). Please read https://docs.telethon.dev/en/latest/concepts/entities.html to find out more details.

向bot发送关注有礼的环境变量后,运行脚本报错

运行环境是centos7,青龙v2.9.3
具体报错信息:
您提供了1个的特效关注有礼店铺活动

(node:8061) UnhandledPromiseRejectionWarning: Error: Cannot find module 'tough-cookie'
Require stack:

  • /ql/repo/gd/jk_script/pkc_txgzyl.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
    at Function.Module._load (internal/modules/cjs/loader.js:745:27)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.initGotEnv (/ql/repo/gd/jk_script/pkc_txgzyl.js:645:3814)
    at Object.post (/ql/repo/gd/jk_script/pkc_txgzyl.js:645:5679)
    at /ql/repo/gd/jk_script/pkc_txgzyl.js:603:7
    at new Promise ()
    at TotalBean (/ql/repo/gd/jk_script/pkc_txgzyl.js:589:10)
    at /ql/repo/gd/jk_script/pkc_txgzyl.js:69:13
    (Use node --trace-warnings ... to show where the warning was created)
    (node:8061) 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)
    (node:8061) [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.

每次青龙重启以后 机器人启动失败

每次青龙重启以后 日志加载成功了,但是机器人启动失败,只能青龙重启了 先进容器 停机jbot 然后删除jbot ,在cd /ql/jbot 重新启动,我直接pm2 启动提示我找不到文件

查询资产报错

试用chart和bean查询资产要不报错,要不没有反应;没反应须要重启bot,不然bot使用别的命令也没有办法使用。
chart报错如下图
image

cd /ql/data python3 -m jbot. 启动报错

Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 188, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.9/runpy.py", line 147, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/lib/python3.9/runpy.py", line 111, in _get_module_details
import(pkg_name)
File "/ql/data/jbot/init.py", line 81, in
jdbot = TelegramClient("bot", API_ID, API_HASH, connection_retries=None).start(bot_token=TOKEN)
File "/usr/lib/python3.9/site-packages/telethon/client/telegrambaseclient.py", line 273, in init
session = SQLiteSession(session)
File "/usr/lib/python3.9/site-packages/telethon/sessions/sqlite.py", line 53, in init
version = c.fetchone()[0]
TypeError: 'NoneType' object is not subscriptable

机器人执行某些脚本报错

机器人执行某些脚本报错,config里的变量是写进去了,手动也可以执行,但机器人执行不了。
比如脚本 KingRan_KR/jd_sevenDay.js

2022-09-13 20:32:25,505 telethon.client.uploads INFO [upload_file] Uploading file of 2107 bytes in 1 chunks of 131072
2022-09-13 20:38:40,972 telethon.client.uploads INFO [upload_file] Uploading file of 2052 bytes in 1 chunks of 131072
2022-09-13 20:56:05,987 telethon.client.uploads INFO [upload_file] Uploading file of 10608 bytes in 1 chunks of 131072
2022-09-13 21:12:05,440 telethon.client.uploads INFO [upload_file] Uploading file of 5872 bytes in 1 chunks of 131072
2022-09-13 21:59:45,224 telethon.client.uploads INFO [upload_file] Uploading file of 5310 bytes in 1 chunks of 131072
2022-09-13 22:37:30,910 telethon.client.uploads INFO [upload_file] Uploading file of 7532 bytes in 1 chunks of 131072
2022-09-13 23:16:59,798 telethon.client.uploads INFO [upload_file] Uploading file of 1828 bytes in 1 chunks of 131072
2022-09-13 23:33:18,833 telethon.client.uploads INFO [upload_file] Uploading file of 2694 bytes in 1 chunks of 131072
2022-09-13 23:37:57,266 telethon.client.uploads INFO [upload_file] Uploading file of 1828 bytes in 1 chunks of 131072
2022-09-13 23:40:49,053 jbot ERROR [activityID] 错误--->'超级无线店铺签到'
2022-09-13 23:43:41,394 jbot ERROR [activityID] 错误--->'超级无线店铺签到'
2022-09-13 23:44:35,600 jbot ERROR [activityID] 错误--->'超级无线店铺签到'
2022-09-13 23:45:42,022 jbot ERROR [activityID] 错误--->'超级无线店铺签到'
2022-09-13 23:52:18,123 jbot ERROR [activityID] 错误--->'加购有礼通用-加密'

【💥错误💥】

文件名:user
函数名:activityID
错误原因:'加购有礼通用-加密'

建议百度/谷歌进行查询

使用该脚本报错

大佬 使用该脚本安装的时候报以下错误

ERROR: unable to select packages:
  bizCode (no such package):
    required by: world[bizCode]
  bizMsg (no such package):
    required by: world[bizMsg]
  lxml (no such package):
    required by: world[lxml]
ERROR: unable to select packages:
  bizCode (no such package):
    required by: world[bizCode]
  bizMsg (no such package):
    required by: world[bizMsg]
  lxml (no such package):
    required by: world[lxml]

重装出错,不知道什么原因

root@qinglong:/ql/data/jbot $ tail -100f /ql/data/log/bot/run.log
2022-05-21 23:34:19,424 telethon.network.mtprotosender INFO [_connect] Connecting to 149.154.175.60:443/TcpFull...
2022-05-21 23:34:19,451 telethon.network.mtprotosender INFO [_connect] Connection to 149.154.175.60:443/TcpFull complete!
2022-05-21 23:34:19,578 jbot INFO [] 加载 user 模块
2022-05-21 23:34:19,578 jbot INFO [load_module] 加载成功 login
2022-05-21 23:34:19,579 jbot INFO [load_module] 加载成功 utils
2022-05-21 23:34:19,694 jbot INFO [load_module] 加载成功 del_msg
2022-05-21 23:34:19,695 jbot INFO [load_module] 加载成功 reply_msg
2022-05-21 23:34:19,696 jbot INFO [load_module] 加载成功 del_all_msg
2022-05-21 23:34:19,697 jbot INFO [load_module] 加载成功 usermsg
2022-05-21 23:34:19,712 jbot INFO [load_module] 加载成功 user
2022-05-21 23:34:19,712 jbot INFO [] 加载 bot 模块
2022-05-21 23:34:19,713 jbot INFO [load_module] 加载成功 start
2022-05-21 23:34:19,715 jbot INFO [load_module] 加载成功 quickchart
2022-05-21 23:34:19,719 jbot INFO [load_module] 加载成功 cron
2022-05-21 23:34:19,721 jbot INFO [load_module] 加载成功 node
2022-05-21 23:34:19,722 jbot INFO [load_module] 加载成功 auth
2022-05-21 23:34:19,763 jbot INFO [load_module] 加载成功 bean
2022-05-21 23:34:19,764 jbot INFO [load_module] 加载成功 setshort
2022-05-21 23:34:19,765 jbot INFO [load_module] 加载成功 utils
2022-05-21 23:34:19,768 jbot INFO [load_module] 加载成功 setting
2022-05-21 23:34:19,770 jbot INFO [load_module] 加载成功 snode
2022-05-21 23:34:19,772 jbot INFO [load_module] 加载成功 short
2022-05-21 23:34:19,775 jbot INFO [load_module] 加载成功 editfile
2022-05-21 23:34:19,775 jbot INFO [load_module] 加载成功 beandata
2022-05-21 23:34:19,778 jbot INFO [load_module] 加载成功 getfile
2022-05-21 23:34:19,778 jbot INFO [load_module] 加载成功 update
2022-05-21 23:34:19,780 jbot INFO [load_module] 加载成功 chart
2022-05-21 23:34:19,781 jbot INFO [load_module] 加载成功 help
2022-05-21 23:34:19,783 jbot INFO [load_module] 加载成功 forward
2022-05-21 23:34:19,784 jbot INFO [load_module] 加载成功 up
2022-05-21 23:34:19,786 jbot INFO [load_module] 加载成功 sendfile
2022-05-21 23:34:19,787 jbot INFO [load_module] 加载成功 cmd
2022-05-21 23:34:19,790 jbot INFO [load_module] 加载成功 qlenv
2022-05-21 23:34:19,790 jbot INFO [] 加载 diy 模块
2022-05-21 23:34:19,799 jbot INFO [load_module] 加载成功 addrepo
2022-05-21 23:34:19,801 jbot INFO [load_module] 加载成功 addexport
2022-05-21 23:34:19,805 jbot INFO [load_module] 加载成功 wskey
2022-05-21 23:34:19,807 jbot INFO [load_module] 加载成功 upGdJk
2022-05-21 23:34:19,808 jbot INFO [load_module] 加载成功 utils
2022-05-21 23:34:19,809 jbot INFO [load_module] 加载成功 restart
2022-05-21 23:34:19,810 jbot INFO [load_module] 加载成功 getbotlog
2022-05-21 23:34:19,811 jbot INFO [load_module] 加载成功 cxjc
2022-05-21 23:34:19,813 jbot INFO [load_module] 加载成功 cxjc_kill
2022-05-21 23:34:19,817 jbot INFO [load_module] 加载成功 checkcookie
2022-05-21 23:34:19,819 jbot INFO [load_module] 加载成功 autoblock
2022-05-21 23:34:19,821 jbot INFO [load_module] 加载成功 diy
2022-05-21 23:34:19,822 jbot INFO [load_module] 加载成功 example
2022-05-21 23:34:19,825 jbot INFO [load_module] 加载成功 editexport
2022-05-21 23:34:19,826 jbot INFO [load_module] 加载成功 clean
2022-05-21 23:34:19,835 jbot INFO [load_module] 加载成功 tempblockcookie
2022-05-21 23:34:19,838 jbot INFO [load_module] 加载成功 download
2022-05-21 23:34:19,906 asyncio ERROR [default_exception_handler] Task exception was never retrieved
future: <Task finished name='Task-11' coro=<hello() done, defined at /ql/data/jbot/main.py:71> exception=ValueError('Could not find the input entity for PeerUser(user_id=12345678) (PeerUser). Please read https://docs.telethon.dev/en/latest/concepts/entities.html to find out more details.')>
Traceback (most recent call last):
File "/ql/data/jbot/main.py", line 76, in hello
await jdbot.send_message(chat_id, f'{str(hello_word)}\n\n\t{info}', link_preview=False)
File "/usr/lib/python3.9/site-packages/telethon/client/messages.py", line 810, in send_message
entity = await self.get_input_entity(entity)
File "/usr/lib/python3.9/site-packages/telethon/client/users.py", line 466, in get_input_entity
raise ValueError(
ValueError: Could not find the input entity for PeerUser(user_id=12345678) (PeerUser). Please read https://docs.telethon.dev/en/latest/concepts/entities.html to find out more details.

一样启动bot报错

root@ql:/ql $ python3 -m jbot
/usr/bin/python3: No module named jbot.main; 'jbot' is a package and cannot be directly executed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.