mIRC Home    About    Download    Register    News    Help

Print Thread
Wanting to add bot script for voiced users #266161 13/10/19 06:11 AM
Joined: Oct 2019
Posts: 2
S
Spottswoode Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
S
Joined: Oct 2019
Posts: 2
To summarize: I'm trying to use the my bot script for people who are voiced so they can moderate the channel. For my purposes, it's easier to voice them and have the bot do all the heavy lifting as opposed to raising their access level, which could let them commandeer the room. There isn't a halfop setup on this server, so voiced users is the method I'm using.


I need the bot to:
1. Remember which users are supposed to be voiced and voice them when they enter the room.
2. Respond to !commands only from voiced users.

Re: Wanting to add bot script for voiced users [Re: Spottswoode] #266166 13/10/19 10:22 AM
Joined: Feb 2011
Posts: 326
K
KindOne Offline
Fjord artisan
Offline
Fjord artisan
K
Joined: Feb 2011
Posts: 326
I guess you could use access levels for remembering users. I have never used access levels so I have no idea.

Here is some example code for commands only working on users that are voice:

Code
on *:text:!foobar:#channel:{
  if ($nick isvoice $chan) {
    msg $chan $nick is voice in $chan 
  }
}

If you want the !foobar to work for users that are voice or op you can replace "if ($nick isvoice $chan) {" with one of these:

Code
; User is voice or op.
if (($nick isvoice $chan) || ($nick isop $chan)) {

Code
; User is voice, halfop, or op.
if ($nick !isreg $chan) {


https://en.wikichip.org/wiki/mirc/operators

https://en.wikichip.org/wiki/mirc/access_levels


irc.swiftirc.net #msl (mIRC Scripting Language)
Re: Wanting to add bot script for voiced users [Re: KindOne] #266316 15/11/19 11:58 AM
Joined: Oct 2019
Posts: 2
S
Spottswoode Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
S
Joined: Oct 2019
Posts: 2
so for instance, if the user was named Nero in channel #Lobby:


on *:text:!foobar:#channel:{
if ($Nero isvoice $Lobby) {
msg $#Lobby $Nero is voice in $#Lobby
}
}


Do I have this more less right?


and so if I wanted Nero to use the bot to kick Dante, what would that look like? Just trying to make sure I have the formatting down pat.


I'll mention, it's inadvisable to raise access levels give the nature of this server.

Last edited by Spottswoode; 15/11/19 01:58 PM.
Re: Wanting to add bot script for voiced users [Re: Spottswoode] #266317 15/11/19 04:39 PM
Joined: Feb 2011
Posts: 326
K
KindOne Offline
Fjord artisan
Offline
Fjord artisan
K
Joined: Feb 2011
Posts: 326
Your code has multiple issues.

If you only want this code to work for #lobby, you only need the channel name on the first line. Everywhere else it can be replaced with "$chan"

"$" cannot touch the actual nick or channel name.

Code
; Anyone can run !foobar and see Nero is voice.
on *:text:!foobar:#lobby:{
  if (Nero isvoice $chan) {
    msg $chan Nero is voice in $chan 
  }
}


If you only want Nero to be able to kick people, simple version would look like this:

Code
; Syntax: !kick NICK message (message is optional)
; This will only kick normal and voice users. It will not kick ops.

on *:text:!kick *:#lobby:{
  ; Only kick people if Nero uses this command AND Nero is voice.
  if ($nick == Nero) && ($nick isvoice $chan) {
    ; Only kick voice and regular users. 
    if ($2 !isop $chan) { 
      kick $chan $2 $3-
    }
  }
}


[11:25:54] <@Bot> Hi.
[11:26:20] <+Nero> !kick Bot bye!
[11:26:37] <Dante> Nice try.
[11:26:44] <+Nero> !kick Dante bye!
[11:26:44] * Dante was kicked by Bot (bye!)

I was talking about access levels inside mIRC, not NickServ/ChanServ/Q/X/whatever services the network uses


irc.swiftirc.net #msl (mIRC Scripting Language)