MikrySoft

KvIRC Twitch Whisper handlers

Nov 21st, 2015
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. Whisper scripts:
  2. Scripts require secondary connection to one of Twitch group chat servers - note that this connection can't be used for normal chat.
  3.  
  4.  
  5. "whisper" alias to handle sending whispers:
  6. ----------------START--------------------------------
  7. if ($context.networkName=="Twitch")
  8. {
  9. %curwind = $window
  10. if (%TwitchWhispers == 0)
  11. {
  12. foreach (%ic,$context.list)
  13. if ($context.networkName(%ic) == "TwitchWhispers")
  14. %TwitchWhispers = $console(%ic)
  15. }
  16. %w = $window($0,%TwitchContext)
  17. if (%w == 0)
  18. {
  19. %w = $window.open("i",$0,%TwitchContext,46)
  20. echo -w=%w Chat with $0
  21. echo -w=%w Common channels: %common_ch
  22. }
  23. echoprivmsg -w=%w $me "" "" $1-
  24.  
  25. rebind %TwitchWhispers
  26. raw PRIVMSG #jtv :/w $0 $1-
  27. rebind %curwind
  28. }
  29. ----------------END---------------------------------
  30. OnTextInput event handler to enable normal chatting in whisper window:
  31. ----------------START--------------------------------
  32. if ($context.networkName == "Twitch")
  33. {
  34. if ($window.type == "userwindow")
  35. {
  36. echoprivmsg $me * * $0
  37. %curwind = $window
  38. %rcpt = $window.caption
  39. if (%TwitchWhispers == 0)
  40. {
  41. foreach (%ic,$context.list)
  42. if ($context.networkName(%ic) == "TwitchWhispers")
  43. %TwitchWhispers = $console(%ic)
  44. }
  45. rebind %TwitchWhispers
  46. raw PRIVMSG #jtv :/w %rcpt $0
  47. rebind %curwind
  48. }
  49. }
  50. ----------------END---------------------------------
  51. OnUnhandledLiteral handler - parses incoming whispers, creates new window for each user
  52. ----------------START--------------------------------
  53. if ( $context.networkname == "TwitchWhispers" )
  54. {
  55. if ( $1 == "WHISPER")
  56. {
  57. %snd_ident[] = $str.split(!,$0)[0]
  58. %rcv_name = $2
  59. %msg_text = $3
  60. if (%TwitchContext == 0)
  61. {
  62. foreach (%ic,$context.list)
  63. if ($context.networkName(%ic) == "Twitch")
  64. %TwitchContext = %ic
  65. }
  66. %common_ch = $chan.common(%snd_ident,%TwitchContext)
  67. %w = $window(%snd_ident,%TwitchContext)
  68. if (%w == 0)
  69. {
  70. %w = $window.open("i",%snd_ident,%TwitchContext,46)
  71. echo -w=%w Chat with %snd_ident
  72. echo -w=%w Common channels: %common_ch
  73. }
  74. echoprivmsg -w=%w %snd_ident "" "" %msg_text
  75. halt
  76. }
  77. }
  78. ----------------END---------------------------------
Advertisement
Add Comment
Please, Sign In to add comment