Giter Site home page Giter Site logo

remiliacn / qqbot Goto Github PK

View Code? Open in Web Editor NEW
511.0 3.0 63.0 139.93 MB

一个会发色图、会聊*、会进行数据分析以及自然语言处理的沙雕多功能机器人。

License: GNU Affero General Public License v3.0

Python 100.00%
qqbot nonebot2 onebot11

qqbot's Introduction

关于

目前进度

由于我目前有个全职工作的原因,更新将会放缓。如果有想要添加的功能的话请直接提交pull request,或者issue。

感谢理解!

需求

  • Python版本为 3.10+
  • 安装requirements.txt中的所有依赖 pip install -r requirements.txt
  • 运行Go-CQHTTP具体文档清参考这里
  • 参考nonebot2运行项目部分在本项目的根目录用nb run即可运行机器人。
  • 重要 - 破坏性改动:如果你使用过nonebot版本的本机器人,请务必在使用最新commit的时候运行以下代码
pip uninstall nonebot;
pip install nonebot2~=2.3.2;

主要功能

  • 多种娱乐功能(轮盘赌、明日方舟十连寻访模拟、嘴臭等)
  • Twitch切片
  • 色图功能!(需要Pixiv账号)
  • 搜图功能(支持使用“回复”并直接输入搜图来进行搜图,或者!搜图 [图片](详见说明文档)
  • 权限系统(想要什么群,什么用户使用什么功能均可进行自定义)
  • B站监控 + 直播分析
  • Discord监控

说明文档在这里

重要

  • 为了更好的使用机器人,请在config.py文件中的SUPER_USER参数上设置好自己的QQ号,并使用添加管理命令将自己的qq号添加上管理员权限
  • 如果在使用机器人的时候遇到了权限问题,请参照该issue进行修正

Config

  1. 复制提供的sample_config.py文件,然后改名为config.py
  2. 按需填写需要的数据

go-cqhttp

config.yml

这个是我目前机器人的配置,仅供参考

# go-cqhttp 默认配置文件

account: # 账号相关
  uin: 0 # QQ账号
  password: '' # 密码为空时使用扫码登录
  encrypt: false  # 是否开启密码加密
  status: 14      # 在线状态 请参考 https://github.com/Mrs4s/go-cqhttp/blob/dev/docs/config.md#在线状态
  relogin: # 重连设置
    disabled: false
    delay: 3      # 重连延迟, 单位秒
    interval: 0   # 重连间隔
    max-times: 0  # 最大重连次数, 0为无限制

  # 是否使用服务器下发的新地址进行重连
  # 注意, 此设置可能导致在海外服务器上连接情况更差
  use-sso-address: false

heartbeat:
  disabled: true # 是否开启心跳事件上报
  # 心跳频率, 单位秒
  # -1 为关闭心跳
  interval: 5

message:
  # 上报数据类型
  # 可选: string,array
  post-format: string
  # 是否忽略无效的CQ码, 如果为假将原样发送
  ignore-invalid-cqcode: true
  # 是否强制分片发送消息
  # 分片发送将会带来更快的速度
  # 但是兼容性会有些问题
  force-fragment: false
  # 是否将url分片发送
  fix-url: true
  # 下载图片等请求网络代理
  proxy-rewrite: ''
  # 是否上报自身消息
  report-self-message: false
  # 移除服务端的Reply附带的At
  remove-reply-at: false
  # 为Reply附加更多信息
  extra-reply-data: false

output:
  # 日志等级 trace,debug,info,warn,error
  log-level: warn
  # 是否启用 DEBUG
  debug: false # 开启调试模式

# 默认中间件锚点
default-middlewares: &default
  # 访问密钥, 强烈推荐在公网的服务器设置
  access-token: ''
  # 事件过滤器文件目录
  filter: ''
  # API限速设置
  # 该设置为全局生效
  # 原 cqhttp 虽然启用了 rate_limit 后缀, 但是基本没插件适配
  # 目前该限速设置为令牌桶算法, 请参考:
  # https://baike.baidu.com/item/%E4%BB%A4%E7%89%8C%E6%A1%B6%E7%AE%97%E6%B3%95/6597000?fr=aladdin
  rate-limit:
    enabled: false # 是否启用限速
    frequency: 1  # 令牌回复频率, 单位秒
    bucket: 6     # 令牌桶大小

servers:
  # HTTP 通信设置
  - http:
      # 是否关闭正向HTTP服务器
      disabled: false
      # 服务端监听地址
      host: 
      # 服务端监听端口
      port: 5700
      # 反向HTTP超时时间, 单位秒
      # 最小值为5,小于5将会忽略本项设置
      timeout: 360
      middlewares:
        <<: *default # 引用默认中间件
      # 反向HTTP POST地址列表
      post:
      #- url: '' # 地址
      #  secret: ''           # 密钥
      #- url: 127.0.0.1:5701 # 地址
      #  secret: ''          # 密钥

  # 正向WS设置
  - ws:
      # 是否禁用正向WS服务器
      disabled: false
      # 正向WS服务器监听地址
      host: 127.0.0.1
      # 正向WS服务器监听端口
      port: 6700
      middlewares:
        <<: *default # 引用默认中间件

  - ws-reverse:
      # 是否禁用当前反向WS服务
      disabled: false
      # 反向WS Universal 地址
      # 注意 设置了此项地址后下面两项将会被忽略
      universal: 
      # 反向WS API 地址
      api: ws://127.0.0.1:5700/ws/api/
      # 反向WS Event 地址
      event: ws://127.0.0.1:5700/ws/event/
      # 重连间隔 单位毫秒
      reconnect-interval: 3000
      middlewares:
        <<: *default # 引用默认中间件
  # pprof 性能分析服务器, 一般情况下不需要启用.
  # 如果遇到性能问题请上传报告给开发者处理
  # 注意: pprof服务不支持中间件、不支持鉴权. 请不要开放到公网
  - pprof:
      # 是否禁用pprof性能分析服务器
      disabled: true
      # pprof服务器监听地址
      host: 127.0.0.1
      # pprof服务器监听端口
      port: 7700

  # 可添加更多
  #- ws-reverse:
  #- ws:
  #- http:
  #- pprof:

database: # 数据库相关设置
  leveldb:
    # 是否启用内置leveldb数据库
    # 启用将会增加10-20MB的内存占用和一定的磁盘空间
    # 关闭将无法使用 撤回 回复 get_msg 等上下文相关功能
    enable: true

您可以参考sample_config的配置方式对您的机器人进行配置。

qqbot's People

Contributors

dependabot[bot] avatar remiliacn 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  avatar

qqbot's Issues

YouTube和Twitter相关的指令是什么

这个Bot应该是全GitHub唯一一个能同时订阅推特和YouTube开播通知的
我朋友在看Vtuber,所以要我整一个
本人是小白,折腾了一晚上终于勉勉强强跑起来了
现在不知道订阅指令

qq_bot_core.py运行出错

大佬你好,我想问下这样的问题应该怎么办呢
D:\ROBOT\RB\qqBot-3.0.0>python qq_bot_core.py
Traceback (most recent call last):
File "D:\ROBOT\RB\qqBot-3.0.0\qq_bot_core.py", line 143, in
main()
File "D:\ROBOT\RB\qqBot-3.0.0\qq_bot_core.py", line 118, in main
nonebot.init(config)
File "D:\ROBOT\py\lib\site-packages\nonebot_init_.py", line 81, in init
bot = NoneBot(config_object)
File "D:\ROBOT\py\lib\site-packages\nonebot_init
.py", line 35, in init
self.asgi.debug = self.config.DEBUG
AttributeError: module 'config' has no attribute 'DEBUG'

冒昧的问一下,这个项目怎么跑起来啊!没学过python

是先用python.exe .\qq_bot_core.py 生成配置文件,然后也用python.exe .\qq_bot_core.py 这个把项目跑起来吗?我这边显示的是端口占用啦,cqhttp我已经跑起来了。貌似用python.exe .\qq_bot_core.py生成的配置文件的格式有点有点不对,空格多了。不知道是不是因为我pycharm的配置的原因。刚接触python,请指教,谢谢!

启动过程中无法启动,根据qq_bot_core.py中的提示注释掉第9行后仍无法启动

已添加config.py并填写了内容,启动qq_bot_core.py失败
以下为报错内容

C:\Users\Administrator\Desktop\robot\qqBot-3.0.0\qqBot-3.0.0>python qq_bot_core.py
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\robot\qqBot-3.0.0\qqBot-3.0.0\qq_bot_core.py", line 143, in
main()
File "C:\Users\Administrator\Desktop\robot\qqBot-3.0.0\qqBot-3.0.0\qq_bot_core.py", line 118, in main
nonebot.init(config)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot_init_.py", line 81, in init
bot = NoneBot(config_object)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot_init
.py", line 35, in init
self.asgi.debug = self.config.DEBUG
AttributeError: module 'config' has no attribute 'DEBUG'

不排除自身库安装问题

运行时不时会报错

时不时会报这个错:

INFO: Doing video fetch...
Job "send_tweet (trigger: interval[0:00:50], next run at: 2021-09-23 15:55:12 CST)" raised an exception
Traceback (most recent call last):
  File "/usr/local/python3/lib/python3.9/site-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job
    retval = await job.func(*job.args, **job.kwargs)
  File "/root/qqbot/qqBot-2.0.0/awesome/plugins/get_tweet/get_tweet.py", line 119, in send_tweet
    Popen(
  File "/usr/local/python3/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/local/python3/lib/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'py'

用的python版本是3.9.7

不知道为什么总是提示没有权限

qq_bot_core.py和config.py都填了超级管理员的qq不知道为啥还是会显示没有权限,是SUPER_USER = '******' # 超级管理员qq号 (int)这样嘛?希望能解答下这个很低级的问题orz感谢!

如何关闭不需要功能

请问大大,我不需要油管,推特,看股等的一些功能,如何去删除它们(我试着删除所有我不需要的功能,但总是出错)?同时,Services\stock.py这个文件中import Services.okex.spot_api as spot 这个导入报错

新增功能

有了YoutuBe的直播订阅,有没有B站的直播订阅相关呢?

[Enhancement] SUPER_USER param

Is this a good time to add this feature?

Yes. Bot is still in pre-beta stage.

Why this is needed

Currently the main owner of the bot is hard coded with my personal QQ. It is not really user friendly in most of the cases, especially in the circumstances that a user wanted to receive the information just like I did. SUPER_USER param should be able to achieve this goal in this circumstance, and also hide sensitive information if one wants to.

When to fix

In the next update.

在进行部署时遇到了未知问题

大佬,我这边尝试部署的时候出现了这个错误,请问一下这个错误要怎么解决,

我这边也有创建config.py这个文件,但是只配置了超管和端口,也没进行其他配置

PS F:\boot\2\3\qqBot-3.0.0> python qq_bot_core.py
Traceback (most recent call last):
File "qq_bot_core.py", line 143, in
main()
File "qq_bot_core.py", line 118, in main
nonebot.init(config)
NameError: name 'config' is not defined

下面这个是我直接解压下来还没进行任何操作直接运行的报错

PS F:\boot\2\qqBot-3.0.0> python qq_bot_core.py
Traceback (most recent call last):
File "qq_bot_core.py", line 10, in
from Services.cangku_api import CangkuApi
File "F:\boot\2\qqBot-3.0.0\Services\cangku_api.py", line 8, in
from config import CANGKU_USERNAME, CANGKU_PASSWORD
ImportError: cannot import name 'CANGKU_USERNAME' from 'config' (unknown location)

连接不到 i.pximg.net导致无法下载图片

关于色图指令
报错:
2022-08-16 03:43:53.324 | INFO | awesome.plugins.setu.setu:_download_pixiv_image_helper:566 - Download image error: Cannot connect to host i.pximg.net:443 ssl:default [信号灯超时时间已到]

最后bot发出的消息里只有图片的相关信息,图本体没有。是gohttp没设置好的原因吗?

进行到配置qq_bot_core.py时,始终无法运行

报错如下:
Traceback (most recent call last):
File "C:\Users\13712\Downloads\qqBot-master\qq_bot_core.py", line 10, in
from Services.cangku_api import CangkuApi
File "C:\Users\13712\Downloads\qqBot-master\Services\cangku_api.py", line 8, in
from config import CANGKU_USERNAME, CANGKU_PASSWORD
ImportError: cannot import name 'CANGKU_USERNAME' from 'config' (unknown location)

已经在qq_bot_core.py中设置了CANGKU_USERNAME
这不就变成了因为没有CANGKU_USERNAME,所以要运行qq_bot_core.py去设置,
但又因为没有CANGKU_USERNAME,所以运行不了qq_bot_core.py的死循环?

PCR fetch does not work properly

Impact

Slight customer experience would be impacted by this issue.

Fix

Roll back to the previous commit, check what happened.

Error:Could not find a version that satisfies the requirement kaleido

我在ARM64设备运行安装时卡在了这里,尝试手动输入以下命令安装时匜出现同样的问题pip install kaleido
Screenshot_20220207-002600_UTermux
从kaleido的github的项目查看后对我来说无解,但是能看到linux_arm64的分支,现已卡在这一步无法继续,百度和谷歌都搜不到这解决方法,因此来此求问

佬,以下是一些功能的推荐和建议(不小心把issues放说明文档了)

1、想接入gpt,用!指令触发引用gpt回复,更深入一点的话就是人物模板
(曾经用本地跑的ai模型也会带模板,但是开销太大了)
2、群语录支持关键词存储和关键词查询返图(可以用文件名命名实现?关键词后面+uuid防止重复)
3、方舟抽卡(呜)
4、色图按照热度随机返图。
已知问题:同关键词搜图重复度高。
热度(会员功能)
5、来个老婆可以捡起来搞一下,配个api,然后按照输入的关键词做图(想起来在本地也跑过novalai)
暂时这些,谢谢佬抽空帮我解决bug。
生活愉快,祝好。

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.