mIRC Homepage

-ul=mod

Posted By: Spike

-ul=mod - 13/10/14 10:06 PM

I know this might not be the right place to ask this as its most used on twitch bots, But some bots on twitch have a thing like -ul=mod so like !addcom !modonly -ul=mod Mod only Command!

If anyone knows how to do this please tell me.
Posted By: Spike

Re: -ul=mod - 14/10/14 12:24 AM

No one?
Posted By: westor

Re: -ul=mod - 14/10/14 12:32 AM

First of all where do you want to save your command, second do you already have any !addcom command code?
Posted By: Spike

Re: -ul=mod - 14/10/14 02:26 AM

I have a !addcom code thing setup, And my commands are saved in a file called commands.txt
Posted By: Spike

Re: -ul=mod - 14/10/14 01:52 PM

Originally Posted By: westor
First of all where do you want to save your command, second do you already have any !addcom command code?

Sorry for the two replys, Forgot to do a quote,
I save my commands in a file called commands.txt and yes i have a !addcom command code.
Posted By: westor

Re: -ul=mod - 14/10/14 03:45 PM

Can you please paste here the currently code that you have? to improve it
Posted By: Spike

Re: -ul=mod - 14/10/14 04:04 PM

Originally Posted By: westor
Can you please paste here the currently code that you have? to improve it

Heres the !addcom code.


Code:
on *:text:!addcom *:#: {
  if ($nick isop #) {
    write commands.txt $2-
    msg $chan /me + Command $2 has been created!
  }
}
on *:text:!delcom *:#: {
  if ($nick isop #) {
    if ($read(commands.txt, ns, $2)) {
      write -dl $+ $readn commands.txt
      msg $chan /me - Command $2- has been removed!
    }
  }
}
on *:text:!editcom & *:#: {
  if ($nick isop #) {
    if ($read(commands.txt, ns, $2)) {
      write -l $+ $readn commands.txt $2-
      msg $chan /me -> Command $2 has been edited!
    }
  }
}
on *:text:*:#: {
  if ($read(commands.txt, ns, $1)) {
    msg $chan $v1
  }
}
Posted By: westor

Re: -ul=mod - 14/10/14 04:48 PM

Try using this code:

Syntax: !addcom <command> [-ul=mod] <text>
Example: !addcom !test -ul=mod This is an test command.
Example 2: !addcom !test2 This is an test2 command.

Code:
on *:text:!addcom *:#: {
  if ($nick isop #) {
    write commands.txt $2-
    msg $chan /me + Command $2 has been created!
  }
}
on *:text:!delcom *:#: {
  if ($nick isop #) {
    if ($read(commands.txt, ns, $2)) {
      write -dl $+ $readn commands.txt
      msg $chan /me - Command $2- has been removed!
    }
  }
}
on *:text:!editcom & *:#: {
  if ($nick isop #) {
    if ($read(commands.txt, ns, $2)) {
      write -l $+ $readn commands.txt $2-
      msg $chan /me -> Command $2 has been edited!
    }
  }
}
on *:text:*:#: {
  tokenize 32 $strip($1-,burci)
  if ($read(commands.txt, ns, $1)) {
    var %com = $v1
    if (-ul=mod == $gettok(%com,1,32)) && ($nick !isop $chan) { msg $chan [ $+ $nick $+ ]: Error, You are NOT an channel operator! | return }
    msg $chan $gettok(%com,2-,32)
  }
}
Posted By: Spike

Re: -ul=mod - 14/10/14 05:06 PM

Originally Posted By: westor
Try using this code:

Syntax: !addcom <command> [-ul=mod] <text>
Example: !addcom !test -ul=mod This is an test command.
Example 2: !addcom !test2 This is an test2 command.

Code:
on *:text:!addcom *:#: {
  if ($nick isop #) {
    write commands.txt $2-
    msg $chan /me + Command $2 has been created!
  }
}
on *:text:!delcom *:#: {
  if ($nick isop #) {
    if ($read(commands.txt, ns, $2)) {
      write -dl $+ $readn commands.txt
      msg $chan /me - Command $2- has been removed!
    }
  }
}
on *:text:!editcom & *:#: {
  if ($nick isop #) {
    if ($read(commands.txt, ns, $2)) {
      write -l $+ $readn commands.txt $2-
      msg $chan /me -> Command $2 has been edited!
    }
  }
}
on *:text:*:#: {
  tokenize 32 $strip($1-,burci)
  if ($read(commands.txt, ns, $1)) {
    var %com = $v1
    if (-ul=mod == $gettok(%com,1,32)) && ($nick !isop $chan) { msg $chan [ $+ $nick $+ ]: Error, You are NOT an channel operator! | return }
    msg $chan $gettok(%com,2-,32)
  }
}


Works great thanks laugh
Posted By: Spike

Re: -ul=mod - 14/10/14 09:11 PM

Originally Posted By: westor
Try using this code:

Syntax: !addcom <command> [-ul=mod] <text>
Example: !addcom !test -ul=mod This is an test command.
Example 2: !addcom !test2 This is an test2 command.

Code:
on *:text:!addcom *:#: {
  if ($nick isop #) {
    write commands.txt $2-
    msg $chan /me + Command $2 has been created!
  }
}
on *:text:!delcom *:#: {
  if ($nick isop #) {
    if ($read(commands.txt, ns, $2)) {
      write -dl $+ $readn commands.txt
      msg $chan /me - Command $2- has been removed!
    }
  }
}
on *:text:!editcom & *:#: {
  if ($nick isop #) {
    if ($read(commands.txt, ns, $2)) {
      write -l $+ $readn commands.txt $2-
      msg $chan /me -> Command $2 has been edited!
    }
  }
}
on *:text:*:#: {
  tokenize 32 $strip($1-,burci)
  if ($read(commands.txt, ns, $1)) {
    var %com = $v1
    if (-ul=mod == $gettok(%com,1,32)) && ($nick !isop $chan) { msg $chan [ $+ $nick $+ ]: Error, You are NOT an channel operator! | return }
    msg $chan $gettok(%com,2-,32)
  }
}


Wait, One thing i wanna ask can you like use !editcom to make it so you can make a non mod only command, A mod only command
Like for example,
!addcom !test Hello
Then i was like Oh, I forgot the mod only part.
So then i could do
!editcom !test -ul=mod Hello
Posted By: westor

Re: -ul=mod - 15/10/14 12:19 AM

Try use this code:

Code:
on *:text:!addcom *:#: {
  if ($nick isop #) {
    var %r = $read(commands.txt,ns,$2)
    if (%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) is already exist into the database! | return }
    write commands.txt $2-
    msg $chan /me + Command $2 has been created!
  }
}
on *:text:!delcom *:#: {
  if ($nick isop #) {
    var %r = $read(commands.txt,ns,$2)
    if (!%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) does NOT exist into the database! | return }
    write -dl $+ $readn commands.txt
    msg $chan /me - Command $2- has been removed!
  }
}
on *:text:!editcom & *:#: {
  if ($nick isop #) {
    var %r = $read(commands.txt,ns,$2)
    if (!%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) does NOT exist into the database! | return }
    write -l $+ $readn commands.txt $2-
    msg $chan /me -> Command $2 has been edited!
  }
}
on *:text:*:#: {
  tokenize 32 $strip($1-,burci)
  if ($read(commands.txt, nts, $1)) {
    var %com = $v1
    if (-ul=mod == $gettok(%com,1,32)) && ($nick !isop $chan) { msg $chan [ $+ $nick $+ ]: Error, You are NOT an channel operator! | return }
    msg $chan $iif(-ul=mod == $gettok(%com,1,32),$gettok(%com,2-,32),$gettok(%com,1-,32))
  }
}
Posted By: Spike

Re: -ul=mod - 15/10/14 12:32 AM

Originally Posted By: westor
Try use this code:

Code:
on *:text:!addcom *:#: {
  if ($nick isop #) {
    var %r = $read(commands.txt,ns,$2)
    if (%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) is already exist into the database! | return }
    write commands.txt $2-
    msg $chan /me + Command $2 has been created!
  }
}
on *:text:!delcom *:#: {
  if ($nick isop #) {
    var %r = $read(commands.txt,ns,$2)
    if (!%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) does NOT exist into the database! | return }
    write -dl $+ $readn commands.txt
    msg $chan /me - Command $2- has been removed!
  }
}
on *:text:!editcom & *:#: {
  if ($nick isop #) {
    var %r = $read(commands.txt,ns,$2)
    if (!%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) does NOT exist into the database! | return }
    write -l $+ $readn commands.txt $2-
    msg $chan /me -> Command $2 has been edited!
  }
}
on *:text:*:#: {
  tokenize 32 $strip($1-,burci)
  if ($read(commands.txt, nts, $1)) {
    var %com = $v1
    if (-ul=mod == $gettok(%com,1,32)) && ($nick !isop $chan) { msg $chan [ $+ $nick $+ ]: Error, You are NOT an channel operator! | return }
    msg $chan $iif(-ul=mod == $gettok(%com,1,32),$gettok(%com,2-,32),$gettok(%com,1-,32))
  }
}


Could you give me an example of how i would use the command to make it mod only?
Posted By: westor

Re: -ul=mod - 15/10/14 12:45 AM

Yes.

Add command: !addcom <command> [-ul=mod] <text>
example: !addcom !test test here with mod
example2 !addcom !testmod -ul=mod test here with moderation

Del command: !delcom <command>
example: !delcom !test

Edit command: !editcom <command> [-ul=mod] <text>
example: !editcom !test test here with mod
example2 !editcom !testmod -ul=mod test here with moderation
© 2019 mIRC Discussion Forums