So basically, I wanted to make a command so that moderators can add names to a list of subscribers so that I can make them immune to bans/kicks on twitch chat. However, this code only works with 2 words or more. For example, "!subs add asdf 1" works but "!subs add asdf" does not. I'm not sure what I could do. Any suggestions or fixes would be greatly appreciated! I'm pretty noob at coding ;w; Needed a LOT of help to get this done.
on $*:text:/^!subs\b/Si:*:{
if ($2 == add) && ($nick isop $chan) {
if ($3) {
writeini sub.ini $chan $3-
msg $chan " $+ $3- $+ " has been added to the list
}
}
if ($2 == remove) && ($nick isop $chan) {
if ($3) {
if ($readini(sub.ini,$chan,$3)) {
remini sub.ini $chan $3-
msg $chan Removed " $+ $3- $+ " from the list
}
}
else {
msg $chan That command is not available
}
}
if (!$2) && ($ini(sub.ini,$chan,0)) {
var %a 1, %z $ini(sub.ini,$chan,0)
.msg $chan $chan has %z sub(s)
}
elseif ($2 == list) && (!$ini(sub.ini,$chan,0)) {
.msg $chan No subs for $chan $+
}
}
on $:text:/^!subs\b/Si::{
if ($nick isop #) {
if ($2 == list) || (!$2) {
if ($ini(sub.ini,$chan,0)) {
var %a 1, %z $ini(sub.ini,$chan,0)
msg # # has %z sub(s)
}
else { msg # No subs for $chan $+ .
}
}
if ($2 == add) {
if (!$3) {
msg # please specify whom to add.
}
else { writeini sub.ini $chan $3 subbed
msg # " $+ $3- $+ " has been added to the list
}
}
if ($2 == remove) {
if (!$3) {
msg # please specify whom to remove.
}
else {
if ($readini(sub.ini,$chan,$3)) {
remini sub.ini $chan $3
msg # Removed " $+ $3 $+ " from the list
}
}
}
}
}
I think this should do what you want. I hope.
What your problem what, is you weren't adding a identifier to the names. Which the ini files calls for one. So when you did the ADSGF 1 the 1, I assume would go as an Identifier.
as ini files appear somewhat as
Subs.ini <- file
Channel
NICK=Identifier
So without that identifier it didn't know how to write it.