mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2014
Posts: 32
S
Sparkz Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Aug 2014
Posts: 32
I am currently trying to make a twitch chat bot but there are some issues. There is a problem with [if ($nick isop #)] For that to work, mirc needs to refresh (only does it every minute or so) So if a mod join and tries something straight away, it wont work. Is there a script I can use that reads a file and if a mods name is in the file, it allows them to use it. Thank you.

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Code:
alias -l mod {
var %file mods.ini, %nick $iif($1 == add,$2,$1)
if ($1 == add) if (!$readini(%file,#,%nick)) writeini %file # %nick 1
else return $iif(($readini(%file,#,%nick) || (%nick isop #)),1)
}
on *:op:#: mod add $nick
on *:text:*:#: mod add $nick

In your scripts you can now use
Code:
on *:text:!test:#: { 
;if ($mod($nick)) { do stuff }
;else { don't do stuff }
}


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Apr 2014
Posts: 170
Vogon poet
Offline
Vogon poet
Joined: Apr 2014
Posts: 170
This isn't working for me.

I put the alias into a new remote then did

on *:text:!test:#: {
if ($mod($nick)) { msg # yes }
else { msg # no }
}

It keeps returning no. And anything I put "if ($mod($nick))" on doesn't work.

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Try removing the "-l" from the alias. What I can think of is that your events aren't being called from the same scriptfile.
Sorry, that was my miss.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Apr 2014
Posts: 170
Vogon poet
Offline
Vogon poet
Joined: Apr 2014
Posts: 170
That worked smile Thanks Nillen.

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Btw, I just realized when I checked this that there was no check at all for if nick was op to add him to the ini originally in the text event.
Replace what you have with this, and you should probably delete the ini file you have right now, considering that it has everyone who's written in the channel added to it currently.
You can simply type: /remove mods.ini
Code:
alias mod {
var %file mods.ini, %nick $iif($1 == add,$2,$1)
if ($1 == add) if (!$readini(%file,#,%nick)) writeini %file # %nick 1
else return $iif(($readini(%file,#,%nick) || (%nick isop #)),1)
}
on *:op:#: mod add $nick
on *:text:*:#: if ($nick isop #) mod add $nick


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Apr 2014
Posts: 170
Vogon poet
Offline
Vogon poet
Joined: Apr 2014
Posts: 170
Done. Thanks again smile

Quick question though, is my username supposed to be the only one in the ini file?

[#myname]
myname=1


^^that's how it looks.

It's still saying other's are mods when I check them using a quick !ismod* command after they join/type but they're not showing up in the file itself. Guess it's not a big deal since either way it's working. Just curious as to why that would be.

Last edited by Bramzee; 09/11/14 05:13 PM.
Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
They should get added to the ini file as soon as their either say something in the channel or if they get opped in the channel. Until either of those happen, they won't be in the list. But they will still be counted in in the $mod($nick) since it checks for either in the inifile or as an op in the channel for just this kind of situation.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net

Link Copied to Clipboard