|
Joined: Sep 2014
Posts: 46
Ameglian cow
|
OP
Ameglian cow
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.
|
|
|
|
Joined: Sep 2014
Posts: 46
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2014
Posts: 46 |
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
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?
|
|
|
|
Joined: Sep 2014
Posts: 46
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2014
Posts: 46 |
I have a !addcom code thing setup, And my commands are saved in a file called commands.txt
|
|
|
|
Joined: Sep 2014
Posts: 46
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2014
Posts: 46 |
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.
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
Hoopy frood
Joined: Dec 2008
Posts: 1,515 |
Can you please paste here the currently code that you have? to improve it
|
|
|
|
Joined: Sep 2014
Posts: 46
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2014
Posts: 46 |
Can you please paste here the currently code that you have? to improve it Heres the !addcom 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
}
}
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
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.
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.
|
|
|
|
Joined: Sep 2014
Posts: 46
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2014
Posts: 46 |
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.
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 laugh](/images/graemlins/mirc/laugh.gif)
|
|
|
|
Joined: Sep 2014
Posts: 46
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2014
Posts: 46 |
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.
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
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
Hoopy frood
Joined: Dec 2008
Posts: 1,515 |
Try use this 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))
}
}
|
|
|
|
Joined: Sep 2014
Posts: 46
Ameglian cow
|
OP
Ameglian cow
Joined: Sep 2014
Posts: 46 |
Try use this 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?
|
|
|
|
Joined: Dec 2008
Posts: 1,515
Hoopy frood
|
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
|
|
|
|
|