Skip to content

Commit 7d7ac1d

Browse files
committed
优化功能&修复bug
1 parent 886171d commit 7d7ac1d

File tree

5 files changed

+20
-4
lines changed

5 files changed

+20
-4
lines changed

bot.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
scheme,
2929
hostname,
3030
port,
31-
cloudflare_cfg,
31+
cloudflare_cfg, member,
3232
)
3333
from tool.scheduler_manager import aps
3434
from tool.utils import is_admin, parse_cron
@@ -63,6 +63,8 @@
6363
# 开始
6464
@app.on_message(filters.command("start"))
6565
async def start(_, message: Message):
66+
if member and message.chat.id not in member:
67+
return
6668
await message.reply("发送 `/s+文件名` 进行搜索")
6769

6870

config/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def z_url():
3737

3838
# user
3939
admin = config["user"]["admin"]
40+
member = config["user"]["member"]
4041
alist_host = config["user"]["alist_host"].removesuffix("/")
4142
alist_web = config["user"]["alist_web"].removesuffix("/")
4243
alist_token = config["user"]["alist_token"]

module/cloudflare/cloudflare.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@
1515
)
1616

1717
from api.cloudflare_api import graphql_api
18-
from config.config import nodee, cronjob, cloudflare_cfg, chat_data, write_config
18+
from config.config import (
19+
nodee,
20+
cronjob,
21+
cloudflare_cfg,
22+
chat_data,
23+
write_config,
24+
member,
25+
)
1926
from tool.scheduler_manager import aps
2027
from tool.utils import is_admin
2128
from tool.utils import pybyte
@@ -233,6 +240,8 @@ async def send_node_status(query: CallbackQuery, day):
233240
# 使用指令查看节点信息
234241
@Client.on_message(filters.command("vb"))
235242
async def view_bandwidth(_, message: Message):
243+
if member and message.chat.id not in member:
244+
return
236245
chat_data["node_status_mode"] = "command"
237246
chat_data["packUp"] = True
238247
chat_data[f"cd_{message.chat.id}"] = {}

module/roll/roll.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
path,
2020
write_config,
2121
roll_cfg,
22-
alist_web,
22+
alist_web, member,
2323
)
2424
from module.roll.random_kaomoji import random_kaomoji
2525
from tool.utils import is_admin
@@ -55,6 +55,8 @@ async def sr_menu(_, message: Message):
5555
# 随机推荐
5656
@Client.on_message(filters.command("roll"))
5757
async def roll(_, message: Message):
58+
if member and message.chat.id not in member:
59+
return
5860
if not roll_disable():
5961
return
6062
roll_str = " ".join(message.command[1:])

module/search.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
)
1212

1313
from api.alist_api import AListAPI
14-
from config.config import config, per_page, z_url, alist_web, write_config
14+
from config.config import config, per_page, z_url, alist_web, write_config, member
1515
from tool.utils import is_admin
1616
from tool.utils import pybyte
1717

@@ -53,6 +53,8 @@ async def zl(_, message: Message):
5353
# 搜索
5454
@Client.on_message(filters.command("s"))
5555
async def s(_, message: Message):
56+
if member and message.chat.id not in member:
57+
return
5658
s_str = " ".join(message.command[1:])
5759
if not s_str or "_bot" in s_str:
5860
return await message.reply("请加上文件名,例:`/s 巧克力`")

0 commit comments

Comments
 (0)