Skip to content

Commit

Permalink
Fixed logging APPROVE_UNBAN_REQUEST
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaserlang committed Mar 9, 2022
1 parent 76ad68b commit 01017f4
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions tbot/twitch_bot/modlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ def get_target_user():
return data['target_user_login']
if data.get('args'):
return data['args'][0]
def get_created_by():
if data.get('created_by'):
return data['created_by']
if data.get('created_by_login'):
return data['created_by_login']
return 'twitch'
def created_by_user_id():
if data.get('created_by_user_id'):
return data['created_by_user_id']
if data.get('created_by_id'):
return data['created_by_id']
return 0

try:
if data['moderation_action'] == 'delete':
data['args'] = [data['args'][0], data['args'][-1]]
Expand All @@ -41,8 +54,8 @@ def get_target_user():
''', (
datetime.utcnow(),
c[2],
data['created_by'] if 'created_by' in data and data['created_by'] else 'twitch',
data['created_by_user_id'] if 'created_by_user_id' in data and data['created_by_user_id'] else 0,
get_created_by(),
created_by_user_id(),
data['moderation_action'],
' '.join(data['args']).strip()[:200] if data.get('args') else '',
get_target_user(),
Expand All @@ -60,8 +73,9 @@ def get_target_user():
data['target_user_id'],
'<{}{} (by {})>'.format(
data['moderation_action'],
' '+' '.join(data['args']).strip() if data.get('args') else '',
data['created_by'] or 'twitch',
' '+(' '.join(data['args']).strip() if data.get('args') else '')+
' '+data['moderator_message'] if data.get('moderator_message') else '',
get_created_by(),
),
)))

Expand Down

0 comments on commit 01017f4

Please sign in to comment.