|
Joined: Sep 2016
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2016
Posts: 33 |
So im using a shoutout command but every time i try to use it, it keeps saying that the user im shouting out is not a valid user  anyone could help? ON $*:TEXT:/^!(follow|caster|so|shoutout|streamer|ally)\s/iS:#lmpred: {
IF (($nick isop $chan) && ($2) && (!%follow.cd)) {
IF (!$3) {
VAR %follow.name $twitch_name($remove($2, @))
IF (%follow.name != $null) {
SET -eu3 %follow.cd On
DESCRIBE $chan Everyone just take just a few seconds and follow %follow.name $+ : twitch.tv/ $+ %follow.name and press the follow button! sodaL
}
ELSE MSG $chan $nick $+ , $2 is not a valid user on Twitch. FailFish
}
ELSE {
SET -eu3 %follow.cd On
VAR %follow.total $calc($0 - 1)
VAR %x = 1
WHILE (%x <= %follow.total) {
VAR %follow.name [ $+ [ %x ] ] $twitch_name($remove($ [ $+ [ $calc(%x + 1) ] ], @))
IF (%follow.name [ $+ [ %x ] ] != $null) VAR %follow.names %follow.names twitch.tv/ $+ %follow.name [ $+ [ %x ] ] |
INC %x
}
VAR %follow.names $left(%follow.names, -1)
IF ($numtok(%follow.names,32) >= 2) DESCRIBE $chan Everyone go and give all these amazing people a follow: %follow.names sodaL
ELSEIF ($numtok(%follow.names,32) == 1) DESCRIBE $chan Everyone just take just a few seconds and follow %follow.name $+ : twitch.tv/ $+ %follow.names and press the follow button! sodaL
ELSE MSG $chan $nick $+ , none of those names are valid Twitch users. FailFish
}
}
}
|
|
|
|
Joined: Feb 2003
Posts: 2,812
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 2,812 |
You should ask the person who wrote this script.
Specifically, the person who wrote the function $twitch_name($remove($2, @)), as it does not appear to be working as expected.
Well. At least I won lunch. Good philosophy, see good in bad, I like!
|
|
|
|
Joined: Oct 2015
Posts: 112
Vogon poet
|
Vogon poet
Joined: Oct 2015
Posts: 112 |
Do you have my BlasBot.mrc script and SReject's JSONForMirc.mrc scripts loaded? That script is designed to be used with both of those. If you have no use for all the other stuff in BlasBot.mrc, you can just use the $twitch_name alias from it. You'll still need SReject's JSONForMirc.mrc script for the actual JSON parsing that is required with the $twitch_name alias. If you don't want/need BlasBot.mrc, just paste this $twitch_name alias into your script: alias twitch_name {
INC %bb
VAR %nick,%nick $IIF($1,$1,$nick)
JSONOpen -uw twitch_name $+ %bb https://api.twitch.tv/kraken/channels/ $+ %nick
JSONHttpHeader twitch_name $+ %bb Client-ID avm4vi7zv0xpjkpi3d4x0qzk8xbrdw8
JSONHttpFetch twitch_name $+ %bb
VAR %x $json(twitch_name $+ %bb, display_name).value
JSONClose twitch_name $+ %bb
IF ($1 == %x) RETURN %x
ELSEIF (%x != $null) RETURN %nick
} Then, if you don't have it already, get SReject's JSON Parser at https://github.com/SReject/JSON-For-Mirc. The reason I use that alias for a shoutout command is because I like the feature of being able to for example type "!so blasman13" and have the bot check to make sure that the user exists first before posting the name in chat while also grabbing their proper "display name" from Twitch (eg "blasman13" would be returned as "Blasman13" with the capital B). If anyone is wondering, the %bb alias is in there because sometimes I need to use multiple $twitch_name's on one line, and $ticks isn't useful for this (only the first name often gets returned) and I don't want to use $rand.
|
|
|
|
Joined: Feb 2003
Posts: 2,812
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 2,812 |
if Twitch is worth so much money, why don't they make these infos available via IRC command instead? IE, NickServ or /WHOX or /WHOIS or Extended Join or something.
Then again, every time I look at a Twitch channel with its chat rolling 90 miles per second, I realize it's not really IRC and nobody reads any of it.
Well. At least I won lunch. Good philosophy, see good in bad, I like!
|
|
|
|
Joined: Feb 2015
Posts: 243
Fjord artisan
|
Fjord artisan
Joined: Feb 2015
Posts: 243 |
@Raccoon They don't care about the headache they're causing to non-twitch people
Last edited by OrFeAsGr; 06/03/17 02:02 AM.
|
|
|
|
Joined: Feb 2003
Posts: 2,812
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 2,812 |
Well, I was specifically talking about Twitch chat on Twitch.tv. All those 9 year olds only type are flashing gifs. Not even words. No 2-way exchange of dialog of any kind. So it kind of surprises me that people write bots for it.
I'd like to understand.
Well. At least I won lunch. Good philosophy, see good in bad, I like!
|
|
|
|
Joined: Oct 2015
Posts: 112
Vogon poet
|
Vogon poet
Joined: Oct 2015
Posts: 112 |
There are many types of channels on Twitch with all sorts of different people and communities. Some of them are toxic, yes, but in my experience of being on Twitch for two years, most communities are filled with amazing people and I have met a lot of real life friends through using Twitch.
Anyways... Twitch does have "$msgtags" that do contain the user's display name ($msgtags(display-name).key). However, with the script in question, you are "shouting out" users that may have not typed anything in chat, therefor you wouldn't be able to check the $msgtags for the display name. Because of this, a simple call to the Twitch API is sufficient and also doubles as a way to verify that the user is valid (in case a moderator types the name wrong by accident).
|
|
|
|
Joined: May 2015
Posts: 249
Fjord artisan
|
Fjord artisan
Joined: May 2015
Posts: 249 |
Thanks God, they have group-chats and made priv msg.
Dont give a fish - teach to fish!
|
|
|
|
Joined: Sep 2016
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2016
Posts: 33 |
ive tried to do what you've suggested but it still says user is invalid ive tried loading BlasBot.mrc to see if that would help and ive got JSONForMirc.mrc too, but ive had no luck getting it to work
|
|
|
|
Joined: Oct 2015
Posts: 112
Vogon poet
|
Vogon poet
Joined: Oct 2015
Posts: 112 |
ive tried to do what you've suggested but it still says user is invalid ive tried loading BlasBot.mrc to see if that would help and ive got JSONForMirc.mrc too, but ive had no luck getting it to work I'm not sure what to tell you then. The following is what I can think of right now. - Make sure you're using the most recent version of JSONForMirc from SReject's GitHub, as the older version isn't compatible.
- Make sure that you're not still running the old version once you load the new version.
- Make sure that you're running the latest version of mIRC. Ideally the latest beta version.
- Seems silly to say, but also make sure that the user that you're trying to shout out is actually a valid user

|
|
|
|
Joined: Sep 2016
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2016
Posts: 33 |
i got it to work now restarted my mIRC and it started to work, thanks for the help tho and was wondering i have this twitch account created script and im using datexpander with it and when its an invalid user it says 47years ago and i dk how id get it to say invalid user instead [code][/code]on *:TEXT:!created*:#: { if ($$0 == 2) { msg # The account $2 was created $DateXpander($twitch_accountage($2)) ago. } else { msg # $nick your account was created $DateXpander($twitch_accountage($nick)) ago. } } alias twitch_accountage { var %result JSONOpen -uw accountage https://api.twitch.tv/kraken/users/ $+ $$1 JSONUrlHeader accountage Client-ID e8e68mu4x2sxsewuw6w82wpfuyprrdx JSONUrlGet accountage if (!$JSONError) { %result = $TwitchTime($JSON(accountage, created_at)) %result = $calc($ctime - %result) } JSONClose accountage return %result } i have it set so it can be used to check a name put after the command or uses the users nick when they use the command without text after it
|
|
|
|
Joined: Oct 2015
Posts: 112
Vogon poet
|
Vogon poet
Joined: Oct 2015
Posts: 112 |
A few things, it looks like the JSON part of your script is written for SReject's older JSONForMirc. You should really write it for use with the new format, as compatibility will eventually be broken for it. I did a quick edit of your script and changed it to the new format. You could have just used the $twitch_name alias to check to see if the user is valid. However, since you're already polling the API once to get the created_at date, you might as well also use that as your validity check and get the display_name from that alias and use it in your command (so if you type "!created predatorfusion" the bot will reply with "Predatorfusion" instead of the lower case version). It's a pet peeve of mine to see all lowercase characters for all user's names lol. To do all that, I made the %result that the twitch_accountage alias returns to be "username created at date" (example: Blasman13 2 years, and 1 week). Then in your !created command I made the validity check to see if the twitch_accountage actually returned any data, if it did NOT, then the "user is not valid" message is displayed. If the user IS valid, then the command gets the first token from the %result which is the persons name, and then gets the second token and everything after it, which is the length of time. on *:TEXT:!created*:#: {
if ($$0 == 2) {
if ($twitch_accountage($2)) msg # The account $gettok($v1,1,32) was created $gettok($v1,2-,32) ago.
else msg # $2 is not a valid user on Twitch.
}
else { msg # $nick your account was created $gettok($twitch_accountage($nick),2-,32) ago. }
}
alias twitch_accountage {
var %result
JSONOpen -uw accountage https://api.twitch.tv/kraken/users/ $+ $$1
JSONHttpHeader accountage Client-ID e8e68mu4x2sxsewuw6w82wpfuyprrdx
JSONHttpFetch accountage
if (!$JSONError) {
%result = $TwitchTime($JSON(accountage, created_at).value)
if (%result) %result = $DateXpander($calc($ctime - %result))
if (%result) %result = $JSON(accountage, display_name).value %result
}
JSONClose accountage
return %result
}
|
|
|
|
Joined: Sep 2016
Posts: 33
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2016
Posts: 33 |
Ahh i should of thought about that but thanks dude :P and yeahh i hate seeing the lowercase names lol
|
|
|
|
|