EuDs

EuDs

EuDs's Blog
twitter
github

qqBot Setup

Building qqBot#

These days, I'm building a qqBot, so I'll record it.

Overall Technology#

I'm using go-cqhttp and nonebot2.

When encountering risk control issues, I used unidbg-fetch-qsign.

Process#

  • The whole process was much more difficult than I expected before starting to build it, and I encountered many problems. But a great thing is that the issues for these three projects are very active. I could find almost all the problems I encountered in the issues. I haven't used many open-source projects, but these three have given me a good impression, and I hope to make my own contributions in the future.

  • I didn't expect the most difficult part to be the login, not the programming of the bot. I used a new account (created about a week ago), and the risk control level is high.

My requirement is to deploy the bot on a server located in a place other than where I am, which increases the probability of being risk-controlled.

After trying many methods, my final solution is:

  1. Use the watch protocol to scan the QR code for login locally. ("sort_version_name":8.9.73, protocol: 2)
  2. After successfully logging in, move the obtained files to the server and configure signsever for login again.
  • But in the end, the bot was still risk-controlled and unable to send group messages.

    I don't want to tinker further in a short time.

  • Today, I published my own plugin EuDs63/nonebot-plugin-yesman: nonebot2 plugin to the Plugin Store | NoneBot. I went through the process of publishing a plugin, which was quite interesting. There are a few points worth mentioning:

    1. The username requirement for Create an account · PyPI is the most strict I have ever seen. But I can understand it.

      Choose a strong password that contains letters (uppercase and lowercase), numbers and special characters. Avoid common words or repetition.

    2. About NoneFlow is very powerful. I want to try to write a similar one myself or understand how it is done.

Thoughts#

  1. I remembered when building a Telegram bot, I only needed to apply for a token, and even the official tutorial was available. But here, it's like a cat-and-mouse game with each side trying to outsmart the other. It's a mixed feeling.
  2. I think the plugin system like nonebot is great. It saves a lot of effort.
  3. I feel that qqBot has a high playability. I often see interesting bots in other groups. But unfortunately, Tencent's attitude is disappointing.

Gains#

  1. nohup
  • Usage: Example: nohup nb run
  • Shutdown: Example:
  1. Daemon (Systemd)
    Note: The following is copied from 使用 NoneBot2 和 go-cqhttp 打造自己的 FF14 QQ 机器人
    • Creation
    • Usage
  2. Python virtual environment
    • Create
    • Activate

References#

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.