Skip to content

Commit

Permalink
Fix invalid escape sequences, noisy since py3.12, deprecated since py3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
zer0def committed Jan 7, 2025
1 parent fd6640e commit c086533
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions twitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
import time
import string
import ast
import re

curlopt = {
"httpheader": "\n".join([
Expand Down Expand Up @@ -351,15 +352,15 @@ def twitch_clearchat(data, modifier, modifier_data, string):
if user:
if 'ban-duration' in tags:
if 'ban-reason' in tags and tags['ban-reason']:
bn=tags['ban-reason'].replace('\s',' ')
bn=re.sub(r'\s',' ', tags['ban-reason'])
weechat.prnt(buffer,"%s--%s %s has been timed out for %s seconds %sReason%s: %s" %
(pcolor, ccolor, user, tags['ban-duration'], ul, rul, bn))
else:
weechat.prnt(buffer,"%s--%s %s has been timed out for %s seconds" %
(pcolor, ccolor, user, tags['ban-duration']))
elif 'ban-reason' in tags:
if tags['ban-reason']:
bn=tags['ban-reason'].replace('\s',' ')
bn=re.sub(r'\s', ' ', tags['ban-reason'])
weechat.prnt(buffer,"%s--%s %s has been banned %sReason%s: %s" %
(pcolor, ccolor, user, ul, rul,bn))
else:
Expand Down Expand Up @@ -456,7 +457,7 @@ def twitch_usernotice(data, modifier, server, string):
"irc", "%s.%s" % (server, mp['channel']))
if mp['tags']:
tags = dict([s.split('=',1) for s in mp['tags'].split(';')])
msg = tags['system-msg'].replace('\s',' ')
msg = re.sub(r'\\s', ' ', tags['system-msg'])
if mp['text']:
msg += ' [Comment] '+mp['text']
weechat.prnt(buffer, '%s--%s %s' % (pcolor, ccolor, msg))
Expand Down

0 comments on commit c086533

Please sign in to comment.