Hello, this is my first post! =)
There are a few things for this...
Thanks to Wariopower for some tips. Enjoy!
~ Rayquaza ~
alias setbot { set %botnick $$?="What's your bot's name?" }
on *:TEXT:!topic*:#: {
if ($nick isop $chan) && ($me == %Botnick) {
topic # $2-
}
elseif ($nick !isop $chan) && ($me == %Botnick) {
notice $nick You aren't an op. No topic for you.
}
}
on $*:text:/^[.!@]topic\b/iS:#: {
if ($nick isop $chan) && ($nick == $me) {
This will never trigger as you can't trigger your own text event.
My guess is the original code ($me == %Botnick) is usefull if you
wish to chat normally and then when you decide to play bot then
renick to the botnick and let it do it's thing.
ffs Bielie why so many damn trigger prefixes? instead of turning topic lock off "this is assuming if they have anope services on the server" you can have chanserv set it without turning the lock off if you run this on a client with the right access.
Bielie the one you made is missing a bracket. here is the one you made cleaned up a bit
on $*:text:/^!topic\b/iS:#: {
if ($nick isop # && $2) { .cs topic # $2- }
else { .notice $nick $iif($nick !isop #,Error: You have to be a op to use this command. $&
,$iif(!$2,Error: Please provide a topic Syntax: !topic Topic here)) }
}
but for something like this i would go with one that Jethro_ made
nice edit on the code there Bielie.. sorry for my last. i am in middle of advanced Excel at college atm and was shirking for a few mins.
just a couple minor edits i can see.. you can remove the noisy chanserv event and make it quiet.
/cs set $chan topiclock off
to
.cs set $chan topiclock off
then reset the topiclock after it has been set. i wont do the edit for that though as it should be straight forward
I suggest using this: (Works better and always returns something.)
on $*:text:/^[.!@]topic\b/iS:#: {
if ($nick isop $chan) && ($address($nick,3) == $address($me) {
.cs set $chan topiclock off
topic $chan $2-
return
}
elseif ($nick !isop $chan) && ($address($nick,3) != $address($me) {
notice $nick Error: You have to be a op to use this command.
return
}
if ($2 == $null) {
notice $nick Error: Please provide a topic (Syntax: !topic (Topic)
return
}
Why $me = %botnick? I don't think it's needed unless you want your bot to be that of a certain nickname...
You only need one check for ops, rather than using two operators. An if and then else condition will do the trick.
You can do these in a couple of ways:
on *:TEXT:!topic*:#: {
if ($nick isop $chan) {
topic # $$2-
}
else {
notice $nick You aren't an op. No topic for you.
}
}
Or:
on *:TEXT:!topic *:#: {
if ($nick !isop #) {
notice $nick You aren't an op. No topic for you.
}
else {
topic # $2-
}
}
Or:
on *:TEXT:!topic *:#: {
$iif($nick !isop #,notice $nick You aren't an op. No topic for you.,topic # $2-)
}
I'll recommend you add a flood protection to this, in case somebody tampers with the code by way of trigger flood. For instance:
on *:TEXT:!topic*:#: {
if (!%f) {
inc -u5 %f
if ($nick isop $chan) {
topic # $$2-
}
else {
notice $nick You aren't an op. No topic for you.
}
}
}