Skip to content

Commit

Permalink
Run pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
DoroWolf committed Aug 3, 2024
1 parent 8d66103 commit 465573f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bots/aiocqhttp/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ async def _(event: Event):
async def _(event: Event):
if event.user_id == int(qq_account):
unfriendly_actions = BotDBUtil.UnfriendlyActions(target_id=event.group_id,
sender_id=event.operator_id)
sender_id=event.operator_id)
sender_info = BotDBUtil.SenderInfo('QQ|' + str(event.operator_id))
unfriendly_actions.add('mute', str(event.duration))
result = unfriendly_actions.check_mute()
Expand Down
7 changes: 3 additions & 4 deletions bots/api/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ async def get_target(target_id: str):

dice_dc_reversed = target.get_option('dice_dc_reversed', False)
dice_default_sides = target.get_option('dice_default_sides', 0)


wiki_target = WikiTargetInfo(target_id)
wiki_headers = wiki_target.get_headers()
Expand Down Expand Up @@ -155,7 +154,7 @@ async def enable_modules(target_id: str, request: Request):
"detail": "Not Found"
})
target_from = '|'.join(target_id.split('|')[:-2])

body = await request.json()
modules = body["modules"]
modules = modules if isinstance(modules, list) else [modules]
Expand All @@ -167,7 +166,7 @@ async def enable_modules(target_id: str, request: Request):
"detail": "Bad Request",
"message": "error"
})


@app.post('/modules/{target_id}/disable')
async def enable_modules(target_id: str, request: Request):
Expand All @@ -178,7 +177,7 @@ async def enable_modules(target_id: str, request: Request):
"detail": "Not Found"
})
target_from = '|'.join(target_id.split('|')[:-2])

body = await request.json()
modules = body["modules"]
modules = modules if isinstance(modules, list) else [modules]
Expand Down
3 changes: 2 additions & 1 deletion core/parser/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ async def remove_temp_ban(target):


async def tos_abuse_warning(msg: Bot.MessageSession, e):
if enable_tos and Config('tos_warning_counts', 5) >= 1 and not msg.check_super_user() and not msg.target.sender_info.is_in_allow_list:
if enable_tos and Config('tos_warning_counts', 5) >= 1 and not msg.check_super_user(
) and not msg.target.sender_info.is_in_allow_list:
await warn_target(msg, str(e))
temp_ban_counter[msg.target.sender_id] = {'count': 1,
'ts': datetime.now().timestamp()}
Expand Down
10 changes: 5 additions & 5 deletions database/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def __init__(self, sender_id):
@property
def query_SenderInfo(self):
return session.query(SenderInfo).filter_by(id=self.sender_id).first()

@retry(stop=stop_after_attempt(3))
@auto_rollback_error
def init(self):
Expand All @@ -251,25 +251,25 @@ def is_in_block_list(self):
if not self.query:
return False
return self.query.isInBlockList

@property
def is_in_allow_list(self):
if not self.query:
return False
return self.query.isInAllowList

@property
def is_super_user(self):
if not self.query:
return False
return self.query.isSuperUser

@property
def warns(self):
if not self.query:
return 0
return self.query.warns

@property
def disable_typing(self):
if not self.query:
Expand Down

0 comments on commit 465573f

Please sign in to comment.