Prerequisites
Since I've set up a blog, I figured I could post some simple code snippets I've written here. They're all quite basic, so I don't plan to create a separate repository for each on GitHub.
I'll start by updating the "Bilibili Comics Check-in and Coupon Redemption" script. More scripts might follow when I have time.
Motivation
Bilibili Comics grants users a certain number of points daily upon check-in, which can be redeemed for coupons usable in purchasing comics.
However, the most favorable 100-point coupon is only available in limited quantities at exactly 00:00 every day.
To address this, I developed two plugins based on NoneBot2 and bilibili-api, referencing SocialSisterYi/bilibili-API-collect. One handles daily check-ins for points, and the other automatically secures the 100-point coupon at 00:00. So far, both have proven highly stable.
NoneBot2 is fairly easy to use, and I've also built several plugins on it—some of which I may share later.
The results are as follows:

Seems like the success rate is too high—no need to push notifications
Still, better safe than sorry. I’ll keep the notification feature enabled.
Code
get_sessdata.py
Used to retrieve and refresh login information
The cookie_path refers to a JSON file containing the following five keys:
- sessdata
- buvid3
- bili_jct
- actimevalue
- dedeuserid
You can obtain these values by logging in via an InPrivate browser window and inspecting the cookies. See the bilibili-api documentation for details.
checkin.py
A simple NoneBot2 plugin that allows manual execution via /漫画签到 command sent to a QQ bot, and also runs automatically at a specified time each day, reporting results.
I didn’t make it general-purpose for all QQ bot friends—only administrators can use it. Of course, you could adapt it to run directly via cron, then handle message delivery differently (or skip it altogether).
exchange.py
A NoneBot2 plugin for redeeming coupons at 00:00 daily. In practice, it starts running at 23:59 for preprocessing, then waits until exactly 00:00 to execute the redemption. Ensure your system clock is accurate and synchronized regularly:
The logic is similar to the check-in plugin. Refer to the exchange_func function to understand the redemption process. The code is as follows: