feat(github_parser): 添加GitHub仓库信息查询功能

- 新增github_parser插件,支持通过命令或自动解析链接查询GitHub仓库信息
- 添加github_repo.html模板用于渲染仓库信息图片
- 优化图片管理器支持高质量截图和CSS缩放
- 重构消息事件类权限常量定义方式
- 更新帮助页面样式为三列布局并优化响应式设计
This commit is contained in:
2026-01-20 18:33:46 +08:00
parent 1ec066c9cb
commit 5f943c1792
6 changed files with 526 additions and 51 deletions

200
templates/github_repo.html Normal file
View File

@@ -0,0 +1,200 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GitHub仓库信息</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&display=swap');
body {
font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
margin: 0;
padding: 0;
color: #ffffff;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.container {
max-width: 100%;
width: 100%;
height: 100vh;
margin: 0;
padding: 60px;
background-color: rgba(26, 26, 46, 0.95);
border-radius: 0;
box-shadow: none;
border: none;
backdrop-filter: blur(10px);
display: flex;
flex-direction: column;
justify-content: center;
}
.repo-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 80px;
}
.repo-info {
flex: 1;
}
.repo-title {
font-size: 28px;
font-weight: 700;
color: #00d4ff;
margin: 0 0 24px 0;
text-transform: uppercase;
letter-spacing: 2.5px;
}
.repo-full-name {
font-size: 72px;
font-weight: 900;
color: #ffffff;
margin: 0 0 30px 0;
line-height: 1.1;
}
.repo-description {
font-size: 32px;
color: #ffffff;
margin: 0 0 36px 0;
line-height: 1.6;
}
.owner-avatar {
width: 240px;
height: 240px;
border-radius: 50%;
margin-left: 80px;
object-fit: cover;
border: 5px solid #00d4ff;
box-shadow: 0 12px 36px rgba(0, 212, 255, 0.5);
}
.stats-container {
display: flex;
justify-content: space-between;
gap: 40px;
margin-top: 80px;
padding-top: 40px;
border-top: 3px solid rgba(15, 52, 96, 0.8);
}
.stat-item {
text-align: center;
flex: 1;
min-width: 180px;
}
.stat-number {
font-size: 96px;
font-weight: 900;
color: #00d4ff;
display: block;
line-height: 1;
}
.stat-label {
font-size: 24px;
color: #ffffff;
margin-top: 16px;
text-transform: uppercase;
letter-spacing: 1.5px;
font-weight: 600;
}
.footer {
margin-top: 100px;
padding-top: 40px;
border-top: 3px solid rgba(15, 52, 96, 0.8);
text-align: center;
}
.bot-info {
font-size: 30px;
color: rgba(0, 212, 255, 1);
font-weight: 700;
text-transform: uppercase;
letter-spacing: 4px;
}
@media (max-width: 768px) {
body {
padding: 0;
}
.container {
padding: 20px;
}
.repo-header {
flex-direction: column;
align-items: center;
}
.owner-avatar {
margin-left: 0;
margin-bottom: 24px;
width: 160px;
height: 160px;
}
.repo-title {
font-size: 20px;
text-align: center;
}
.repo-full-name {
font-size: 48px;
text-align: center;
}
.repo-description {
text-align: center;
font-size: 24px;
}
.stats-container {
flex-direction: column;
gap: 20px;
}
.stat-item {
margin-bottom: 20px;
}
.stat-number {
font-size: 64px;
}
.stat-label {
font-size: 20px;
}
.bot-info {
font-size: 24px;
}
}
</style>
</head>
<body>
<div class="container">
<div class="repo-header">
<div class="repo-info">
<div class="repo-title">GitHub Repository</div>
<h1 class="repo-full-name">{{ full_name }}</h1>
<p class="repo-description">{{ description }}</p>
</div>
{% if owner_avatar %}
<img src="{{ owner_avatar }}" alt="Owner Avatar" class="owner-avatar">
{% endif %}
</div>
<div class="stats-container">
<div class="stat-item">
<span class="stat-number">{{ stargazers_count }}</span>
<div class="stat-label">Stars</div>
</div>
<div class="stat-item">
<span class="stat-number">{{ forks_count }}</span>
<div class="stat-label">Forks</div>
</div>
<div class="stat-item">
<span class="stat-number">{{ open_issues_count }}</span>
<div class="stat-label">Issues</div>
</div>
<div class="stat-item">
<span class="stat-number">{{ watchers_count }}</span>
<div class="stat-label">Watchers</div>
</div>
</div>
<div class="footer">
<div class="bot-info">by CalglauBOT</div>
</div>
</div>
</body>
</html>

View File

@@ -32,19 +32,22 @@
/* 居中布局 */
display: flex;
justify-content: center;
padding: 40px;
min-height: auto;
padding: 0;
min-height: 100vh;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* 窗口容器 */
.window {
width: 800px; /* 稍微收窄一点,更像手机/卡片比例 */
width: 100%;
height: 100vh;
background: var(--window-bg);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border-radius: 20px;
border: 1px solid var(--border-color);
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
border-radius: 0;
border: none;
box-shadow: none;
overflow: hidden;
display: flex;
flex-direction: column;
@@ -52,7 +55,7 @@
/* 顶部标题栏 */
.header {
padding: 24px 32px;
padding: 32px 40px;
border-bottom: 1px solid var(--border-color);
background: rgba(255, 255, 255, 0.02);
display: flex;
@@ -67,48 +70,50 @@
.green { background: #10b981; }
.title {
font-size: 14px;
font-size: 18px;
font-weight: 700;
letter-spacing: 1px;
letter-spacing: 1.5px;
color: var(--text-desc);
text-transform: uppercase;
}
/* 内容区域 */
.content {
padding: 32px;
padding: 40px;
display: flex;
flex-direction: column;
gap: 24px; /* 卡片之间的间距 */
gap: 32px; /* 卡片之间的间距 */
}
.page-title {
margin-bottom: 10px;
}
.page-title h1 {
font-size: 32px;
font-size: 48px;
background: linear-gradient(to right, #fff, #94a3b8);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.page-title p {
color: var(--text-desc);
font-size: 14px;
margin-top: 8px;
font-size: 20px;
margin-top: 12px;
}
/* 插件卡片 - 改为单列宽卡片 */
/* 插件卡片 - 改为三列布局 */
.plugin-card {
background: var(--card-bg);
border: 1px solid var(--border-color);
border-radius: 12px;
padding: 20px;
border-radius: 14px;
padding: 24px;
display: flex;
flex-direction: column; /* 垂直排列 */
gap: 16px;
transition: transform 0.2s;
position: relative;
overflow: hidden;
flex: 1;
min-width: 320px;
}
/* 左侧装饰线 */
@@ -129,41 +134,41 @@
}
.plugin-name {
font-size: 18px;
font-size: 24px;
font-weight: 700;
color: #fff;
display: flex;
align-items: center;
gap: 10px;
gap: 12px;
}
/* 装饰性Tag */
.plugin-tag {
font-size: 10px;
font-size: 14px;
background: rgba(99, 102, 241, 0.2);
color: #818cf8;
padding: 2px 6px;
border-radius: 4px;
padding: 4px 8px;
border-radius: 6px;
font-weight: 600;
text-transform: uppercase;
}
.plugin-desc {
font-size: 13px;
font-size: 18px;
color: var(--text-desc);
line-height: 1.5;
margin-top: 4px;
line-height: 1.6;
margin-top: 8px;
}
/* 指令代码块 - 核心修改区域 */
.cmd-block {
background: var(--cmd-bg);
border-radius: 8px;
padding: 16px;
border-radius: 10px;
padding: 20px;
border: 1px solid var(--border-color);
font-family: 'JetBrains Mono', monospace;
font-size: 13px;
line-height: 1.6;
font-size: 16px;
line-height: 1.8;
color: var(--text-cmd);
/* 处理长文本的关键 CSS */
@@ -179,15 +184,24 @@
color: #64748b;
user-select: none;
}
/* 插件网格布局 */
.plugin-grid {
display: flex;
flex-wrap: wrap;
gap: 24px;
justify-content: flex-start;
width: 100%;
}
/* 页脚 */
.footer {
padding: 20px 32px;
padding: 24px 40px;
border-top: 1px solid var(--border-color);
color: rgba(255, 255, 255, 0.2);
font-size: 12px;
font-size: 16px;
text-align: right;
background: rgba(0,0,0,0.1);
letter-spacing: 1px;
}
</style>
</head>
@@ -210,7 +224,8 @@
<p>Dashboard & Command List · {{ plugins|length }} Modules Loaded</p>
</div>
<!-- 插件列表 - 列流式布局 -->
<!-- 插件列表 - 列流式布局 -->
<div class="plugin-grid">
{% for plugin in plugins %}
<div class="plugin-card">
<div class="card-top">
@@ -227,10 +242,11 @@
<div class="cmd-block">{{ plugin.usage }}</div>
</div>
{% endfor %}
</div>
</div>
<div class="footer">
Generated by NeoBot Render Engine
by CalglauBOT
</div>
</div>
</body>