Skip to content

Commit

Permalink
Merge weechat-scripts version
Browse files Browse the repository at this point in the history
While backporting the eval expression to weechat-scripts:

weechat/scripts#555

I did notice that both version have diverged slightly.

This MR merge back it upstream here.
  • Loading branch information
stacyharper committed Jun 21, 2024
1 parent 19da641 commit db40b7c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions twitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#
# # History:
#
# 2024-06-20, stacyharper
# v0.10: eval client_id and token expressions. Usefull when used with weechat secures values.
# 2020-07-27,
# v0.9: added support for Oauth token to support twitch APIs requirement -mumixam
# fix bug for when api returns null for game_id -mas90
Expand Down Expand Up @@ -336,7 +338,7 @@ def twitch_clearchat(data, modifier, modifier_data, string):
user = mp['text']
channel = mp['channel']
try:
tags = dict([s.split('=',1) for s in mp['tags'].split(';')])
tags = dict([s.split('=') for s in mp['tags'].split(';')])
except:
tags = ''
buffer = weechat.buffer_search("irc", "%s.%s" % (server, channel))
Expand Down Expand Up @@ -377,7 +379,7 @@ def twitch_clearmsg(data, modifier, modifier_data, string):
server = modifier_data
channel = mp['channel']
try:
tags = dict([s.split('=',1) for s in mp['tags'].split(';')])
tags = dict([s.split('=') for s in mp['tags'].split(';')])
except:
tags = ''
buffer = weechat.buffer_search("irc", "%s.%s" % (server, channel))
Expand Down Expand Up @@ -452,7 +454,7 @@ def twitch_usernotice(data, modifier, server, string):
buffer = weechat.buffer_search(
"irc", "%s.%s" % (server, mp['channel']))
if mp['tags']:
tags = dict([s.split('=',1) for s in mp['tags'].split(';')])
tags = dict([s.split('=') for s in mp['tags'].split(';')])
msg = tags['system-msg'].replace('\s',' ')
if mp['text']:
msg += ' [Comment] '+mp['text']
Expand Down Expand Up @@ -496,7 +498,7 @@ def twitch_in_privmsg(data, modifier, server_name, string, prefix=''):
if '#' + mp['nick'] == mp['channel']:
return mp['message_without_tags'].replace(mp['nick'], '~' + mp['nick'], 1)

tags = dict([s.split('=',1) for s in mp['tags'].split(';')])
tags = dict([s.split('=') for s in mp['tags'].split(';')])
if tags['user-type'] == 'mod':
prefix += '@'
if tags['subscriber'] == '1':
Expand Down Expand Up @@ -642,7 +644,7 @@ def config_change(pointer, name, value):
" /set plugins.var.python.twitch.ssl_verify off\n"
"\n\n"
" Required server settings:\n"
" /server add twitch irc.chat.twitch.tv\n"
" /server add twitch irc.twitch.tv\n"
" /set irc.server.twitch.capabilities \"twitch.tv/membership,twitch.tv/commands,twitch.tv/tags\"\n"
" /set irc.server.twitch.nicks \"My Twitch Username\"\n"
" /set irc.server.twitch.password \"oauth:My Oauth Key\"\n"
Expand Down

0 comments on commit db40b7c

Please sign in to comment.