PMC - Set initiative to true by default (v2.22)

This commit is contained in:
Sam 2022-07-08 11:13:33 +08:00 committed by GitHub
parent 640778a10a
commit 350b678149
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -72,7 +72,7 @@
}, },
{ {
"name": "pmcaptcha", "name": "pmcaptcha",
"version": "2.21", "version": "2.22",
"section": "chat", "section": "chat",
"maintainer": "cloudreflection,01101sam", "maintainer": "cloudreflection,01101sam",
"size": "2.1k line", "size": "2.1k line",

View File

@ -783,17 +783,17 @@ class Command:
await self._edit(lang('chat_history_curr_rule') % count) await self._edit(lang('chat_history_curr_rule') % count)
async def initiative(self, toggle: Optional[str]): async def initiative(self, toggle: Optional[str]):
"""设置对主动进行对话的用户添加白名单,默认为 <code>关闭</code> """设置对主动进行对话的用户添加白名单,默认为 <code>开启</code>
:param opt toggle: 开关 (y / n) :param opt toggle: 开关 (y / n)
""" """
if not toggle: if not toggle:
return await self._display_value( return await self._display_value(
display_text=lang('initiative_curr_rule') % lang( display_text=lang('initiative_curr_rule') % lang(
'enabled' if setting.get('initiative', False) else 'disabled'), 'enabled' if setting.get('initiative', True) else 'disabled'),
sub_cmd="initiative", sub_cmd="initiative",
value_type="vocab_bool") value_type="vocab_bool")
await self._set_toggle("initiative", toggle) await self._set_toggle("initiative", toggle, reverse=True)
async def silent(self, toggle: Optional[str]): async def silent(self, toggle: Optional[str]):
"""减少信息发送,默认为 <code>关闭</code> """减少信息发送,默认为 <code>关闭</code>
@ -980,7 +980,7 @@ class Command:
("premium", bold(lang('premium_set_none'))), ("premium", bold(lang('premium_set_none'))),
("groups_in_common", text_none), ("groups_in_common", text_none),
("chat_history", -1), ("chat_history", -1),
("initiative", bold(lang("disabled"))), ("initiative", bold(lang("enabled"))),
("silent", bold(lang("disabled"))), ("silent", bold(lang("disabled"))),
("flood", 5), ("flood", 5),
("flood_username", bold(lang("disabled"))), ("flood_username", bold(lang("disabled"))),
@ -1976,7 +1976,7 @@ class Rule:
async def initiative(self) -> bool: async def initiative(self) -> bool:
"""outgoing""" """outgoing"""
initiative = setting.get("initiative", False) initiative = setting.get("initiative", True)
initiative and not setting.whitelist.check_id(self.msg.chat.id) and setting.whitelist.add_id(self.msg.chat.id) initiative and not setting.whitelist.check_id(self.msg.chat.id) and setting.whitelist.add_id(self.msg.chat.id)
return initiative return initiative