Skip to main content

use bilibili uid join in group

Project description

nonebot

nonebot_plugin_BiliRequestBarand

已实现功能

  • 以B站UID审核入群(粉丝牌)

使用方法

  • 使用pip
pip install nonebot_plugin_BiliRequestBarand
  • 点击DOWNLOAD ZIP
使用方法BiliRequest(barand)
  • 打开机器人目录下的 'pyproject.toml',一般是在第17行
17| plugin_dirs = ["XXX/XXX"]  <- XXX为插件的路径
##|               ^^^^^^^^^^^
  • 将下载的文件放入 XXX/XXX目录下

  • 重新加载插件

说明依赖

10| import json,time, requests
11| from nonebot import on_request, logger
12| from nonebot.adapters.onebot.v11 import Bot, GroupRequestEvent

注意事项

20| if event.group_id == <群号>: <- 直接替换成要使用的群号
##|                     ^^^^^^^
21|   raw = json.loads(event.json())
22|   gid = str(event.group_id)
23|   uid = str(event.user_id)
24|   flag = raw['flag']
27| comment = raw['comment']
28| BiliUID = ''.join(filter(str.isdigit,comment))
29| cookies = {"cookie": "<你的cookie>"}  <- 填入cookie
                          ^^^^^^^^^^^^

nonebot

34| # 同意入群
35| if '<粉丝牌子名>' in response: <- 直接替换成粉丝牌名
##|    ^^^^^^^^^^^^
36|   logger.info(f"同意{uid}加入群 {gid},验证消息为 “{comment}”")
37|   await bot.set_group_add_request(
38|     flag=flag,
39|     sub_type=sub_type,
40|     approve=True,
41|     reason=' ',
42|   )
43| # 拒绝入群
44| if '<粉丝牌子名>' not in response: <- 直接替换成粉丝牌名
##|    ^^^^^^^^^^^^
45|   logger.info(f"拒绝{uid}加入群 {gid},验证消息为 “{comment}”")
46|   await bot.set_group_add_request(
47|     flag=flag,
48|     sub_type=sub_type,
49|    approve=False,
50|     reason='未获得粉丝牌或未打开展示设置',
51|   )

未来计划

  • Tips:如果在不咕的情况下
    • 实现单插件分群管理
    • 实现切换审核模式(粉丝/持有粉丝牌/等)

反馈问题

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page