1. The $1- identifier in ON TEXT contains all the parameters from $1 through the end of the line. You can verify what is in these variables by inserting debug messages within the script like:

echo $chan nick $nick debug: 1- is: $1-

2. Yes, (subscribed isin $1-) is the same thing as searching for wildcard *subscribed* within the $1- string. This is not searching for a whole word, so this would also match a line containing unsubscribed.

If it's possible for nick twitchnotify to say the word unsubscribed, and if the word subscribed is never touching anything besides a space, you can match only the whole word subscribed with:

32 is ASCII number of the space character, so $istok is looking for an exact match of the entire space-delimited word.

3. Inside the TEXT event, $chan and # both mean the same thing, and refers to the channel where the TEXT event happened. In the top line of the event where :#CHANNELNAME: is located, that decides which channels will cause this code to be triggered. If you changed that to :#: it would respond to all channels.

Matching the word "subscribe" is not going to work for gifted subs. The system message is "User1 gifted a $4.99 sub to User2!"

I think it makes much more sense to just read the RAW data being sent from Twitch in your case. More info can be found here. Note that as of this writing the official Twitch docs linked here don't have the "subgift" message tag documented yet, but I did cover the new tags in a previous thread on here already.

Two examples. I prefer the first one because it will match exactly the following message tags in "msg-id": sub, resub, or subgift. The second example would work by matching the word "sub" in the "msg-id" tag because they all have "sub" in the tag.

I fixed this problem a while back on my own bot. I crudely striped down my own code and pasted here for sharing. Hopefully you can figure out some of this and apply it to your own bot. I'll try to explain some of it to help.

Basically, the way the code works here is that your bot will only reply once for mass sub gifting. The way it achieves this is as follows. When a user performs a mass sub gift on Twitch, a message tag of submysterygift is sent in the message from Twitch saying that a user has mass sub gifted. This message also contains the number of gifted subs in the message tag of msg-param-mass-gift-count. This script keeps track of that number. Using this info, for each individual sub gift message from Twitch (gifted from the user who mass sub gifted), we reduce this number by one until it reaches zero. This way, the bot knows to only reply once for the mass sub gift message and not for each individual sub gift message.

If your bot usually performs other tasks when a sub/resub/gift sub happens, you can put that code under the line beginning with "IF (%run_extras) {" near the end of the script. Likewise, any code here will also only run once per sub/resub/gift sub and only once for a mass sub gift.

Of course change the ???????? on line 2 with your own room-id if you use that part of the code. Hope this helps.