Skip to content

Commit a689ea0

Browse files
committed
cqhttp,satori: support disable !!stats or !!online command
1 parent 51cb4f2 commit a689ea0

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

chatbridge/impl/cqhttp/entry.py

+10
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ def on_message(self, _, message: str):
6060

6161
if len(args) == 1 and args[0] == '!!online':
6262
self.logger.info('!!online command triggered')
63+
if not self.config.client_to_query_online:
64+
self.logger.info('!!online command is not enabled')
65+
self.send_text('!!online 指令未启用')
66+
return
67+
6368
if chatClient.is_online():
6469
command = args[0]
6570
client = self.config.client_to_query_online
@@ -70,6 +75,11 @@ def on_message(self, _, message: str):
7075

7176
if len(args) >= 1 and args[0] == '!!stats':
7277
self.logger.info('!!stats command triggered')
78+
if not self.config.client_to_query_stats:
79+
self.logger.info('!!stats command is not enabled')
80+
self.send_text('!!stats 指令未启用')
81+
return
82+
7383
command = '!!stats rank ' + ' '.join(args[1:])
7484
if len(args) == 0 or len(args) - int(command.find('-bot') != -1) != 3:
7585
self.send_text(StatsHelpMessage)

chatbridge/impl/satori/entry.py

+10
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ async def send_text(s: str):
8080

8181
if len(args) == 1 and args[0] == '!!online':
8282
self.logger.info('!!online command triggered')
83+
if not config.client_to_query_online:
84+
self.logger.info('!!online command is not enabled')
85+
await send_text('!!online 指令未启用')
86+
return
87+
8388
if cb_client.is_online():
8489
command = args[0]
8590
client = config.client_to_query_online
@@ -90,6 +95,11 @@ async def send_text(s: str):
9095

9196
if len(args) >= 1 and args[0] == '!!stats':
9297
self.logger.info('!!stats command triggered')
98+
if not config.client_to_query_stats:
99+
self.logger.info('!!stats command is not enabled')
100+
await send_text('!!stats 指令未启用')
101+
return
102+
93103
command = '!!stats rank ' + ' '.join(args[1:])
94104
if len(args) == 0 or len(args) - int(command.find('-bot') != -1) != 3:
95105
await send_text(StatsHelpMessage)

0 commit comments

Comments
 (0)