mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
✨ feat: 增加#rbs
This commit is contained in:
parent
06762ccd1e
commit
06ca131d8b
@ -30,7 +30,7 @@ import {
|
|||||||
ANIME_SERIES_SEARCH_LINK,
|
ANIME_SERIES_SEARCH_LINK,
|
||||||
ANIME_SERIES_SEARCH_LINK2,
|
ANIME_SERIES_SEARCH_LINK2,
|
||||||
BILI_ARTICLE_INFO,
|
BILI_ARTICLE_INFO,
|
||||||
BILI_EP_INFO,
|
BILI_EP_INFO, BILI_NAV, BILI_NAV_STAT,
|
||||||
BILI_ONLINE,
|
BILI_ONLINE,
|
||||||
BILI_SSID_INFO,
|
BILI_SSID_INFO,
|
||||||
BILI_STREAM_FLV,
|
BILI_STREAM_FLV,
|
||||||
@ -54,6 +54,7 @@ import {
|
|||||||
WEISHI_VIDEO_INFO,
|
WEISHI_VIDEO_INFO,
|
||||||
XHS_REQ_LINK
|
XHS_REQ_LINK
|
||||||
} from "../constants/tools.js";
|
} from "../constants/tools.js";
|
||||||
|
import BiliInfoModel from "../model/bili-info.js";
|
||||||
import config from "../model/config.js";
|
import config from "../model/config.js";
|
||||||
import NeteaseModel from "../model/netease.js";
|
import NeteaseModel from "../model/netease.js";
|
||||||
import * as aBogus from "../utils/a-bogus.cjs";
|
import * as aBogus from "../utils/a-bogus.cjs";
|
||||||
@ -142,6 +143,11 @@ export class tools extends plugin {
|
|||||||
fnc: "biliScan",
|
fnc: "biliScan",
|
||||||
permission: 'master',
|
permission: 'master',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
reg: "^#(RBS|rbs)$",
|
||||||
|
fnc: "biliState",
|
||||||
|
permission: 'master',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
reg: "(bilibili.com|b23.tv|t.bilibili.com|^BV[1-9a-zA-Z]{10}$)",
|
reg: "(bilibili.com|b23.tv|t.bilibili.com|^BV[1-9a-zA-Z]{10}$)",
|
||||||
fnc: "bili",
|
fnc: "bili",
|
||||||
@ -640,6 +646,58 @@ export class tools extends plugin {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// B站状态
|
||||||
|
async biliState(e) {
|
||||||
|
if (!this.biliSessData) {
|
||||||
|
e.reply("未检测到 B 站登录信息,请填写 SessData");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 封装 fetch 请求为函数
|
||||||
|
const fetchData = async (url) => {
|
||||||
|
try {
|
||||||
|
const res = await fetch(url, {
|
||||||
|
headers: {
|
||||||
|
Cookie: `SESSDATA=${this.biliSessData}`
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const data = await res.json();
|
||||||
|
return data.data;
|
||||||
|
} catch (error) {
|
||||||
|
e.reply("请求失败,请稍后重试");
|
||||||
|
throw error; // 确保错误传播
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 并行请求用户基本信息和状态信息
|
||||||
|
const [biliData, biliStat] = await Promise.all([fetchData(BILI_NAV), fetchData(BILI_NAV_STAT)]);
|
||||||
|
|
||||||
|
// 解构所需的字段
|
||||||
|
const { face, uname, level_info, money, moral, vipStatus } = biliData;
|
||||||
|
const { following, follower, dynamic_count } = biliStat;
|
||||||
|
|
||||||
|
// 获取屏幕截图所需的数据
|
||||||
|
const screenData = await new BiliInfoModel(e).getData({
|
||||||
|
face,
|
||||||
|
uname,
|
||||||
|
level_info,
|
||||||
|
money,
|
||||||
|
moral,
|
||||||
|
vipStatus,
|
||||||
|
following,
|
||||||
|
follower,
|
||||||
|
dynamic_count
|
||||||
|
});
|
||||||
|
|
||||||
|
// 使用 puppeteer 生成截图
|
||||||
|
try {
|
||||||
|
let img = await puppeteer.screenshot("bili-info", screenData);
|
||||||
|
e.reply(img, true);
|
||||||
|
} catch (error) {
|
||||||
|
e.reply("截图生成失败,请稍后重试");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// B 站解析
|
// B 站解析
|
||||||
async bili(e) {
|
async bili(e) {
|
||||||
const urlRex = /(?:https?:\/\/)?www\.bilibili\.com\/[A-Za-z\d._?%&+\-=\/#]*/g;
|
const urlRex = /(?:https?:\/\/)?www\.bilibili\.com\/[A-Za-z\d._?%&+\-=\/#]*/g;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
- {
|
- {
|
||||||
version: 1.9.1,
|
version: 1.9.2,
|
||||||
data:
|
data:
|
||||||
[
|
[
|
||||||
|
新增<span class="cmd">RBS查看哔哩哔哩状态</span>功能,
|
||||||
|
新增<span class="cmd">自建ncm</span>功能,
|
||||||
新增<span class="cmd">直播切片</span>功能,
|
新增<span class="cmd">直播切片</span>功能,
|
||||||
优化<span class="cmd">队列下载和GPT</span>功能,
|
|
||||||
新增<span class="cmd">哔哩哔哩下载分辨率设置</span>功能,
|
|
||||||
支持<span class="cmd">锅巴</span>插件,方便查看和修改配置,
|
支持<span class="cmd">锅巴</span>插件,方便查看和修改配置,
|
||||||
输入<span class="cmd">#R帮助</span>获取插件帮助,
|
输入<span class="cmd">#R帮助</span>获取插件帮助,
|
||||||
输入<span class="cmd">#R更新</span>更新插件,
|
输入<span class="cmd">#R更新</span>更新插件,
|
||||||
|
@ -40,6 +40,13 @@ export const BILI_VIDEO_INFO = "http://api.bilibili.com/x/web-interface/view"
|
|||||||
*/
|
*/
|
||||||
export const BILI_NAV = "https://api.bilibili.com/x/web-interface/nav"
|
export const BILI_NAV = "https://api.bilibili.com/x/web-interface/nav"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录用户状态数(双端)
|
||||||
|
* https://github.com/SocialSisterYi/bilibili-API-collect?tab=readme-ov-file
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
export const BILI_NAV_STAT = "https://api.bilibili.com/x/web-interface/nav/stat";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 扫码登录的二维码生成
|
* 扫码登录的二维码生成
|
||||||
* https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/login/login_action/QR.md
|
* https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/login/login_action/QR.md
|
||||||
|
17
model/bili-info.js
Normal file
17
model/bili-info.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import Base from './base.js'
|
||||||
|
|
||||||
|
export default class BiliInfoModel extends Base {
|
||||||
|
constructor (e) {
|
||||||
|
super(e)
|
||||||
|
this.model = 'bili-info'
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 生成版本信息图片 */
|
||||||
|
async getData (biliInfoData) {
|
||||||
|
return {
|
||||||
|
...this.screenData,
|
||||||
|
saveId: 'bili-info',
|
||||||
|
biliInfoData: biliInfoData,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
0
resources/html/bili-info/bili-info.css
Normal file
0
resources/html/bili-info/bili-info.css
Normal file
203
resources/html/bili-info/bili-info.html
Normal file
203
resources/html/bili-info/bili-info.html
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Bilibili User Card - Full Screen</title>
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes float {
|
||||||
|
0% {
|
||||||
|
transform: translateY(0px);
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
transform: translateY(-20px);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
transform: translateY(0px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
body, html {
|
||||||
|
height: 100%;
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
background-color: #fb7299;
|
||||||
|
background-image: radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.2) 0%, transparent 20%),
|
||||||
|
radial-gradient(circle at 90% 80%, rgba(255, 255, 255, 0.2) 0%, transparent 20%),
|
||||||
|
linear-gradient(to bottom right, #fb7299, #fc9cba);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.background-text {
|
||||||
|
position: absolute;
|
||||||
|
color: rgba(255, 255, 255, 0.1);
|
||||||
|
font-size: 100px;
|
||||||
|
font-weight: bold;
|
||||||
|
pointer-events: none;
|
||||||
|
user-select: none;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-1 {
|
||||||
|
top: 5%;
|
||||||
|
left: -50px;
|
||||||
|
animation: float 8s infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-2 {
|
||||||
|
top: 40%;
|
||||||
|
right: -50px;
|
||||||
|
animation: float 10s infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-3 {
|
||||||
|
bottom: 10%;
|
||||||
|
left: 50%;
|
||||||
|
animation: float 9s infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fullscreen-card {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
padding: 20px;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
background-color: white;
|
||||||
|
border-radius: 20px;
|
||||||
|
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
|
||||||
|
padding: 30px;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 500px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar-container {
|
||||||
|
position: absolute;
|
||||||
|
top: -40px;
|
||||||
|
right: 30px;
|
||||||
|
width: 120px;
|
||||||
|
height: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 6px solid white;
|
||||||
|
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar-badge {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
background-color: #ff69b4;
|
||||||
|
color: white;
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: bold;
|
||||||
|
border: 3px solid white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.username {
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-info {
|
||||||
|
font-size: 18px;
|
||||||
|
color: #666;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.level {
|
||||||
|
display: inline-block;
|
||||||
|
background-color: #fb7299;
|
||||||
|
color: white;
|
||||||
|
font-size: 16px;
|
||||||
|
padding: 3px 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-top: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 15px;
|
||||||
|
text-align: center;
|
||||||
|
width: 30%;
|
||||||
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-value {
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-label {
|
||||||
|
font-size: 16px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="background-text text-1">哔哩哔哩</div>
|
||||||
|
<div class="background-text text-2">Bilibili</div>
|
||||||
|
<div class="background-text text-3">B站</div>
|
||||||
|
<div class="fullscreen-card">
|
||||||
|
<div class="card">
|
||||||
|
<div class="avatar-container">
|
||||||
|
<img src="{{ biliInfoData.face }}" alt="用户头像" class="avatar">
|
||||||
|
{{ if biliInfoData.vipStatus == '1' }}
|
||||||
|
<div class="avatar-badge">大</div>
|
||||||
|
{{ /if }}
|
||||||
|
</div>
|
||||||
|
<div class="username">{{ biliInfoData.uname }}</div>
|
||||||
|
<div class="user-info">
|
||||||
|
硬币: {{ biliInfoData.money }} B币: {{ biliInfoData.moral }}
|
||||||
|
</div>
|
||||||
|
<div class="level">LV{{ biliInfoData.level_info.current_level }}</div>
|
||||||
|
<div class="stats">
|
||||||
|
<div class="stat">
|
||||||
|
<div class="stat-value">{{ biliInfoData.following }}</div>
|
||||||
|
<div class="stat-label">关注</div>
|
||||||
|
</div>
|
||||||
|
<div class="stat">
|
||||||
|
<div class="stat-value">{{ biliInfoData.follower }}</div>
|
||||||
|
<div class="stat-label">粉丝</div>
|
||||||
|
</div>
|
||||||
|
<div class="stat">
|
||||||
|
<div class="stat-value">{{ biliInfoData.dynamic_count }}</div>
|
||||||
|
<div class="stat-label">动态</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
x
Reference in New Issue
Block a user