יוצר: Ohad
גירסא: 1.31
תיאור: הקוד נותן ומוריד הזמנות לערוצים בשרת QuakeNet.
הפעלה: מפורט בתחילת הקוד.
קוד: בחר הכל
; ——————————————————————————————————————————————— ;
; Invite bot by Ohad v1.31.
; This invite bot work only on QuakeNet (Q-Chanlev).
;
; Usefull commands:
; 1) !set chan <#channel> - set invite channel.
; 2) !unset chan - unset invite channel.
; 3) !invite <nick> [+av] - invite <nick> [+av is optional, if you enter it the nick wiil get auto voice].
; 4) !remove <nick> - remove invite to <nick>.
; 4) !list - get invited list (from Q-Chanlev).
; 5) +av <nick> - give auto voice to <nick>.
; 6) -av <nick> - remove auto voice to <nick>.
; 7) !adduser <admin|owner|manager> <nick> - add <nick> to access list in invite bot.
; 8) !deluser <nick> - remove <nick> from access list in invite bot.
; 9) !users - get users list of invite bot.
; 10) !set logchan [log channel] - show the log channel ['log channel' is optional, if you enter it the log channel will set to [log channel].
; 11) !unset logchan - unset the invite log channel.
; 12) !set show-nick [status] - show the status of 'show-nick' ['status' is optional, if you enter it (on|off) the status will change].
; 13) !commands - send commands for use.
;
; This bot need to be a master in invite channel to use this bot.
; You can add/remove user in right click (in nicklist/query) —› Invite bot —› Set as.
; All the users in the bot must be auth to Q and have the user mode x (//mode $me +x)
; When you will set a channel, the bot will set the chanflag +k.
; ——————————————————————————————————————————————— ;
on *:text:*:*:{
unset %acc %acc2
var %t = $iif(#,#,$nick)
if ($ulist($wildsite,InvAdmin,1)) { var %acc 1 }
elseif ($ulist($wildsite,InvOwner,1)) { var %acc 2 }
elseif ($ulist($wildsite,InvMang,1)) { var %acc 3 }
if (%acc) {
if ($chan == %invite.chan || $left(%t,1) != $chr(35)) {
if (!%invite.chan && $regex($1,/^(!invite|!remove|!list|!adduser|\+av|-av)$/i)) { msg %t $theme(INVITE-ERROR) channel is not seted yet }
elseif ($1 == !invite) {
if ($2) {
.msg q chanlev %invite.chan $2 +k $+ $iif(+av == $3 || +gv == $3 || +v == $3,gv)
.invite $2 %invite.chan
msg $2 Hello $+(,$2,) $+ , you are invited to $+(,%invite.chan,) $iif(%invite.by,by $+(,$nick,)) $iif(+av == $3 || +gv == $3 || +v == $3,with voice)
.timer 1 1 msg %t $theme(INVITE) Done, invite sent to $2 $+
if (#* iswm %invite.log) { .timer 1 2 msg %invite.chan.log $theme(INVITE) $+(,$2,) was invited to $+(,%invite.chan,) $iif(%invie.by,by $+(,$nick,)) }
}
else { msg %t $theme(INVITE-ERROR) Usage: !invite <nick> }
}
elseif ($1 == !remove) {
if ($2) {
.msg q chanlev %invite.chan $2 -kgv
msg %t $theme(INVITE) Done, $2 was removed from invited list
if (#* iswm %invite.chan.log) { .timer 1 1 msg %invite.log $theme(INVITE) $+(,$2,) was removed from $+(,%invite.chan,) $iif(%invie.by,by $+(,$nick,)) }
}
else { msg %t $theme(INVITE-ERROR) Usage: !remove <nick> }
}
elseif ($1 == +av) {
if ($2) { .msg q chanlev %invite.chan $2 +gv | msg %t $theme(INVITE) Done. }
else { msg %t $theme(INVITE-ERROR) Usage: +av <nick> }
}
elseif ($1 == -av) {
if ($2) { .msg q chanlev %invite.chan $2 -gv | $iif($2 ison %invite.chan,mode %invite.chan -v $2) | msg %t $theme(INVITE) Done. }
else { msg %t $theme(INVITE-ERROR) Usage: -av <nick> }
}
elseif ($1 == !list) { unset %invite.list | set %invite.getting.list %t | .msg q chanlev %invite.chan }
}
if ($left(%t,1) != $chr(35)) {
if ($1 == !commands || $1 == !help) {
msg %t $theme(INVITE-COMMANDS) !set chan <#channel> $chr(124) !unset chan $chr(124) !invite <nick> [+av] $chr(124) !remove <nick> $chr(124) +av <nick> $chr(124) -av <nick>
if (%acc >= 2) { .timer 1 1 msg %t $theme(INVITE-COMMANDS) !adduser <admin|owner|manager> <nick> $!chr(124) !deluser <nick> $!chr(124) !users $!chr(124) !set logchan [log channel] $!chr(124) !unset logchan $!chr(124) !set show-nick [on|off] }
}
if (%acc >= 2) {
if ($1 == !set) && (%acc == 3) {
if ($2 == chan) {
if ($3 == %invite.chan) { msg %t $theme(INVIE-ERROR) channel is already %invite.chan }
elseif ($3) { set %invite.chan $3 | .msg q chanflags %invite.chan +k | msg $nick $theme(INVITE) Done, the invite channel seted to: $3 $+ }
else { msg $nick $theme(INVITE-ERROR) Usage: !setchan <#channel> }
}
elseif ($2 == show-nick) {
if ($3 == on) { set %invite.by 1 | msg %t $theme(INVITE) 'show invite nick' set to on }
elseif ($3 == off) { unset %invite.by | msg %t $theme(INVITE) 'show invite nick' set to off }
else { msg %t $theme(INVITE) 'show invite nick' is $+(,$iif(%invite.by,on,off),) right now }
}
elseif ($2 == logchan) {
if ($3) { set %invite.chan.log $3 | msg %t $theme(INVITE) invite log channel set to $+(,$3,) }
elseif (#* !iswm %invite.chan.log) { msg %t $theme(INVITE) there is no invite log channel right now }
else { msg %t $theme(INVITE) invite log channel is $+(,$iif($3,$3,$iif(%invite.by,on,off)),) }
}
}
elseif ($1 == !unset) && (%acc == 3) {
if ($2 == chan) {
if (%invite.chan) { .msg q chanflags %invite.chan -k | msg %t $theme(INVITE) Done, the invite channel unseted | unset %invite.chan }
else { msg $nick $theme(INVITE-ERROR) channel is not seted yet. }
}
elseif ($2 == logchan) { unset %invite.chan.log | msg %t $theme(INVITE) Done, the invite log channel unseted }
}
elseif ($1 == !adduser) {
if ($2 != admin) && ($2 != owner) && ($2 != manager) { msg $nick $theme(INVITE-ERROR) wrong syntax: !adduser <admin|owner|manager> <nick> }
elseif ($2 == manager) && (%acc != 3) { msg $nick $theme(INVITE-ERROR) you have not the right access to set a managers }
else {
.adduser $3 $2 $nick
}
}
elseif ($1 == !deluser) {
if (!$ulist($2) && !$ulist($address($2,2))) { msg $nick $theme(INVITE-ERROR) $+(,$2,) not found in invite-bot access list }
else {
if ($ulist($address($2,2))) { var %ulist $v1 }
else { var %ulist $2 }
if ($ulist(%ulist,InvAdmin,1)) { var %acc2 1 }
elseif ($ulist(%ulist,InvOwner,1)) { var %acc2 2 }
elseif ($ulist(%ulist,InvMang,1)) { var %acc2 3 }
if (%acc2 != 1 && %acc == 2) { msg $nick $theme(INVITE-ERROR) You dont have the required access. }
else {
if ($ulist($address($2,2))) { .ruser Inv $+ $replace(%acc2,1,Admin,2,Owner,3,Mang) $2 2 }
else { .ruser Inv $+ $replace(%acc2,1,Admin,2,Owner,3,Mang) $2 }
msg $nick $theme(INVITE) Done, $2 removed from invite-bot $replace(%acc2,1,admins,2,owners,3,managers) list.
}
}
}
elseif ($1 == !users) {
var %x 1,%y 1,%z 1,%admins,%owners,%managers
while ($ulist(*,InvAdmin,%x)) { var %admins $addtok(%admins,$v1,44) | inc %x }
while ($ulist(*,InvOwner,%y)) { var %owners $addtok(%owners,$v1,44) | inc %y }
while ($ulist(*,InvMang,%z)) { var %managers $addtok(%managers,$v1,44) | inc %z }
msg $nick $theme(INVITE) Admins: %admins
.timer 1 1 msg $nick $theme(INVITE) Owners: %owners
if (%acc == 3) { .timer 1 2 msg $nick $theme(INVITE) Managers: %managers }
}
}
}
}
elseif ($1 == !credits) && (!%invite.credits.flood) && ($nick ison %invite.chan) { msg %t $theme(INVITE) Invite bot v1.31 created by Ohad. | set -u6 %invite.credits.flood 1 }
}
on ^*:notice:*:*:{
if (%invite.getting.list && $nick == q) {
if (%qchan.error) { halt }
if (end of list. == $1-3) { unset %qchan.getting }
elseif ($1 == total:) { $iif(%invite.list,msg %invite.getting.list $theme(INVITED-LIST) $replace(%invite.list,$chr(32),$chr(44))) | unset %invite.list | unset %invite.getting.list }
elseif ($1-2 == Can't find) { .timer 1 0 qchan.error %qchan.target its unknown or suspended channel. | set %qchan.error 1 }
elseif ($1-2 == You do) { .timer 1 0 qchan.error You dont have sufficient access on $8 to use chanlev. | set %qchan.error 1 }
elseif ($1-2 == account, or) { .timer 1 0 qchan.error You must be authed to use this dialog. | set %qchan.error 1 }
elseif (!$regex($1-,/^(Known users|End of|Username.*flags)/i)) && (k isin $2 || v isin $2) && (*a*o* !iswm $2) {
set %invite.list %invite.list $1
if ($len(%invite.list) >= 800) { msg %invite.getting.list $theme(INVITED-LIST) $replace(%invite.list,$chr(32),$chr(44)) }
}
halt
}
}
menu channel,menubar,status,nicklist,query {
Invite bot
.Set invite channel $iif(%invite.chan,$+($chr(40),%invite.chan,$chr(41))) :set %invite.chan $$input(Enter a channel,e,Invite bot,$iif(#* iswm $active,$active)) | echo -at $theme(INVITE) Done, %invite.chan set as invite channel.
.$iif(%invite.chan,Remove invite channel) :unset %invite.chan | echo -at $theme(INVITE) Done, there is no invite channel right now.
.-
.Set invite log channel $iif(%invite.chan.log,$+($chr(40),%invite.chan.log,$chr(41))) :set %invite.chan.log $$input(Enter a log channel,e,Invite bot,$iif(#* iswm $active,$active)) | echo -at $theme(INVITE) Done, %invite.chan.log set as invite log channel.
.$iif(%invite.chan.log,Remove invite log channel) :unset %invite.chan.log | echo -at $theme(INVITE) Done, there is no invite log channel right now.
.-
.$iif(%invite.by,$style(1)) Show the nick of the inviter:$iif(!%invite.by,set %invite.by 1,unset %invite.by)
.-
.$iif($istok(query nicklist,$menu,32) && %invite.chan,Set as)
..$iif(!$ulist($address($$1,2),InvAdmin,1),Admin): add.user admin $1
..$iif(!$ulist($address($$1,2),InvOwner,1),Owner): add.user owner $1
..$iif(!$ulist($address($$1,2),InvMang,1),Manager): add.user manager $1
..-
..$iif($ulist($address($$1,2),InvAdmin,1) || $ulist($address($$1,2),InvOwner,1) || $ulist($address($$1,2),InvMang,1),No access):{
.ruser InvAdmin $1 2
.ruser InvOwner $1 2
.ruser InvMang $1 2
echo -at $theme(INVITE) Done, $$1 has no access right now in the invite bot.
}
}
on me:*:join:%invite.chan:{ who $chan }
alias add.user {
if ($address($$2,4) == *!*@*.users.quakenet.org) && ($2 ison %invite.chan) {
.guser $replace($1,admin,InvAdmin,owner,InvOwner,manager,InvMang) $2 2
$iif($show,echo -at,msg $3) $theme(INVITE) Done, $2 was added to invite-bot $1 $+ s list by the address $+(,$address($2,2),)
}
else {
if ($show) { echo -at $theme(INVITE-ERROR) $+(,$2,) doesnt in $+(,%invite.chan,) or doesnt auth to Q }
else { msg $3 $theme(INVITE-ERROR) $+(,$2,) doesnt in $+(,%invite.chan,) or doesnt auth to Q }
}
}
alias -l theme { return 2(12 $+ $1- $+ 2)1 }