mIRC Home    About    Download    Register    News    Help

Print Thread
#248617 13/10/14 10:06 PM
Joined: Sep 2014
Posts: 46
S
Spike Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Sep 2014
Posts: 46
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.

Spike #248624 14/10/14 12:24 AM
Joined: Sep 2014
Posts: 46
S
Spike Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Sep 2014
Posts: 46
No one?

Spike #248625 14/10/14 12:32 AM
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
First of all where do you want to save your command, second do you already have any !addcom command code?


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
westor #248626 14/10/14 02:26 AM
Joined: Sep 2014
Posts: 46
S
Spike Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Sep 2014
Posts: 46
I have a !addcom code thing setup, And my commands are saved in a file called commands.txt

westor #248631 14/10/14 01:52 PM
Joined: Sep 2014
Posts: 46
S
Spike Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Sep 2014
Posts: 46
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.

Spike #248632 14/10/14 03:45 PM
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Can you please paste here the currently code that you have? to improve it


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
westor #248635 14/10/14 04:04 PM
Joined: Sep 2014
Posts: 46
S
Spike Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Sep 2014
Posts: 46
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
  }
}

Spike #248636 14/10/14 04:48 PM
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
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)
  }
}

Last edited by westor; 14/10/14 04:50 PM.

Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
westor #248638 14/10/14 05:06 PM
Joined: Sep 2014
Posts: 46
S
Spike Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Sep 2014
Posts: 46
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

westor #248647 14/10/14 09:11 PM
Joined: Sep 2014
Posts: 46
S
Spike Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Sep 2014
Posts: 46
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

Spike #248655 15/10/14 12:19 AM
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
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))
  }
}


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
westor #248656 15/10/14 12:32 AM
Joined: Sep 2014
Posts: 46
S
Spike Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Sep 2014
Posts: 46
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?

Spike #248657 15/10/14 12:45 AM
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
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


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-

Link Copied to Clipboard