For archive purposes
Created
May 13, 2019 09:29
-
-
Save scambier/146f5c495b911f31bab1920b15ab944f to your computer and use it in GitHub Desktop.
NeedL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ctcp *:botver:*:{ .notice $nick Needl Beta Version : 3.2.4b } | |
;//Retourne le bot chef d'un chan : $boss(#chan) | |
alias boss { | |
var %i = 1 | |
while ($nick($1,%i,o)) { | |
if ($left($nick($1,%i,o),5) == Needl) { | |
return $nick($1,%i,o) | |
halt | |
} | |
else { inc %i } | |
} | |
} | |
;//Retourne le nombre de ops d'un chan : $ops(#chan) | |
;//Retourne la liste des ops d'un chan : $ops(#chan).list | |
alias ops { | |
var %oplist | |
if (!$prop) { | |
return $nick($1,0,o) | |
} | |
if ($prop == list) { | |
var %i = 1 | |
while ($nick($1,%i,o)) { | |
var %oplist = %oplist $nick($1,%i,o) | |
inc %i | |
} | |
return %oplist | |
} | |
} | |
;//Retourne le nombre de bots sur un chan : $bots(#chan) | |
;//Retourne la liste des bots sur un chan : $bots(#chan).list | |
;//Retourne le nombre de bots OPS sur un chan : $bots(#chan).op | |
;//Retourne la liste des bots OPS sur un chan : $bots(#chan).oplist | |
alias bots { | |
var %bots | |
if (!$prop) { | |
var %i = 1 | |
while ($nick($1,%i)) { | |
if ($left($nick($1,%i),5) == Needl) { inc %bots } | |
inc %i | |
} | |
} | |
if ($prop == list) { | |
var %bots | |
var %i = 1 | |
while ($nick($1,%i)) { if ($left($nick($1,%i),5) == Needl) { var %bots = %bots $nick($1,%i) } | |
inc %i | |
} | |
} | |
if ($prop == op) { | |
var %bots = 0 | |
var %i = 1 | |
while ($nick($1,%i,o)) { if ($left($nick($1,%i),5) == Needl) { inc %bots } | |
inc %i | |
} | |
} | |
if ($prop == oplist) { | |
var %i = 1 | |
var %bots | |
while ($nick($1,%i,o)) { if ($left($nick($1,%i),5) == Needl) { var %bots = %bots $nick($1,%i) } | |
inc %i | |
} | |
if (!%bots) var %bots = 0 | |
} | |
return %bots | |
} | |
;//Retourne le nick du Xe bot op de #chan : $bot(#chan,X) | |
alias bot { return $gettok($bots($1).oplist,$2,32) } | |
;//Retourne la liste des bots sur #chan : $botlist(#chan) | |
alias botlist { | |
var %i = 1 | |
var %botlist | |
while ($bot($1,%i)) { | |
var %botlist = %botlist $bot($1,%i) | |
inc %i | |
} | |
return %botlist | |
} | |
;//Ajoute une diese au d�but d'un mot si celui-ci n'en a pas : $diese(mot) | |
alias diese { if ($left($1,1) != $chr(35)) { return $chr(35) $+ $1 } | else { return $1 } } | |
;//Recupere les infos sur un chan en attente | |
;//Toutes les infos : $wchan(#chan) | |
;//Pseudo du demandeur : $wchan(#chan).nick | |
;//Date de la demande : $wchan(#chan).date | |
;//Heure de la demande : $wchan(#chan).hour | |
alias wchan { | |
if (!$prop) { return $read(wchans.txt,s,$1) } | |
if ($prop == nick) { return $gettok($read(wchans.txt,s,$1),1,32) } | |
if ($prop == date) { return $gettok($read(wchans.txt,s,$1),2,32) } | |
if ($prop == hour) { return $gettok($read(wchans.txt,s,$1),3,32) } | |
} | |
;//liste des chans en attente : $wlist | |
alias wlist { | |
var %i = 1 | |
while ($read(wchans.txt,%i)) { | |
var %wlist = %wlist $gettok($read(wchans.txt,%i),1,32) | |
inc %i | |
} | |
return %wlist | |
} | |
;//liste des demandeurs en attente : $wpeople | |
alias wpeople { | |
var %i = 1 | |
while ($read(wchans.txt,%i)) { | |
var %wpeople = %wpeople $gettok($read(wchans.txt,%i),2,32) | |
inc %i | |
} | |
return %wpeople | |
} | |
;//Retourne un chan en attente � partir du nick de la personne ayant demand� les bots : $wnick(nick) | |
alias wnick { | |
var %i = 1 | |
while ($read(wchans.txt,%i)) { | |
if ($1 isin $read(wchans.txt,%i)) { return $gettok($read(wchans.txt,%i),1,32) } | |
inc %i | |
} | |
} | |
;//Commande pour envoyer X bots demand�s par Nick sur #chan : /order_send #chan Nick X | |
alias order_send { | |
var %i = 1 | |
var %j = $3 | |
while ($bot(#Needl,%i)) && (%i <= %j) { | |
if ($bot(#Needl,%i) != $me) && ($bot(#Needl,%i) !ison $1) { .ctcp $bot(#Needl,%i) order_join $1 $2 $3 | aline @Needl $time - 4Ordre � $bot(#Needl,%i) de rejoindre $1 } | |
else { inc %j } | |
inc %i | |
} | |
} | |
;//Commande pour retirer X bots de #chan : /order_remove #chan X | |
alias order_remove { | |
aline @Needl $time - Info $1 poss�de $ops($1) ops et $bots($1) bots | |
aline @Needl $time - Info $2 bot(s) va(vont) etre enlev�(s) | |
var %i = 1 | |
while (%i <= $2) && ($bot($1,%i)) { | |
.ctcp $bot($1,%i) order_remove $1 | |
aline @Needl $time - 4Ordre �4 $bot($1,%i) 4de partir de4 $1 | |
inc %i | |
} | |
} | |
;//Reception de l'ordre de join | |
ctcp *:order_join:*:{ | |
if ($nick == $boss(#Needl)) { | |
aline @Needl $time - 4Ordre re�u de4 $nick 4pour rejoindre4 $2 | |
write wchans.txt $2 $3 $date $time $3 | |
join $2 | |
.timerop $+ $2 0 180 verifbot $2 | |
haltdef | |
} | |
} | |
;//Reception de l'ordre de remove | |
ctcp *:order_remove:*:{ | |
if ($nick == $boss($2)) { | |
aline @Needl $time - 4Ordre re�u de4 $nick 4pour quitter4 $2 | |
if ($bots($2) == 1) { mode #Needl -v $wchan($2).nick } | |
part $2 | |
.timerop $+ $2 off | |
.timer $+ $2 off | |
write -ds $2 wchans.txt | |
haltdef | |
} | |
} | |
;//Calcul du nombre de bots � envoyer : $botsend(#chan) | |
;//Respecte le 3bots/6ops | |
alias botsend { | |
if ($ops($1) <= 4) return $calc(4 - $bots($1) - 1) | |
else return $calc(6 - $ops($1) - 1) | |
} | |
;//Demande des bots | |
on *:TEXT:*:*:{ | |
if ($1 == !op) { | |
if ($nick == $wchan($chan).nick) { mode $chan +o $nick } | |
if ($nick isop #Needl) && ($chan isin $wlist) { mode $chan +o $nick } | |
} | |
if ($chan == #NeedL) { | |
if (($1 == !NeedL) || ($1 == !RequestL) || ($1 == !bots) || ($1 == !Needl) || ($1 == !need)) && ($2) && ($2 !isin #l #q #quakenet #feds #needl #votrechan) { | |
tokenize 32 !needl $diese($2) | |
if ($boss($chan) == $me) && (!%antineedl) { | |
set %antineedL 1 | |
.timer 1 20 unset %antineedl | |
if ($boss(#Needl) == $me) { msg $chan Demande bien re�ue $nick $+ . Merci de patienter 20 secondes avant de reformuler une nouvelle demande. } | |
if ($chr(44) isin $2) { halt } | |
if ($me ison $2) { | |
if ($ops($2) >= 6) { msg $chan Vous avez d�j� 6 ops sur votre chan, ce qui est la limite. | halt } | |
if ($bots($2) >= 3) { msg $chan Vous avez d�j� 3 bots sur votre chan, ce qui est la limite. | halt } | |
if ($2 isin $wlist) && ($nick isop $2) && ($nick isin $wpeople) && ($bots($2).op < 3) && ($ops($2) < 6) && (L !ison $2) && (Q !ison $2) { | |
if ($botsend($2) > 0) && ($bots($2) < $bots(#Needl)) { msg $chan Si nous disposons d'assez de bots, $botsend($2) $iif($botsend($2) <= 1,suppl�mentaire vous sera envoy�,suppl�mentaires vous seront envoy�s) $+ , n'oubliez pas de nous opper ! | |
order_send $2 $wchan($2).nick $botsend($2) | |
} | |
if ($botsend($2) > 0) && ($bots($2) == $bots(#Needl)) { msg $chan D�sol�, nous n'avons plus de bots disponibles, merci d'attendre qu'un autre bot se connecte } | |
if ($botsend($2) <= 0) { msg $chan Vous ne pouvez avoir que $bots($2) $iif($bots($2) > 1,bots,bot) sur votre chan, ce qui est la limite. } | |
} | |
if (L ison $2) || (Q ison $2) { .write -ds $2 wchans.txt | part $2 } | |
} | |
if ($me !ison $2) && ($nick !isin $wpeople) { | |
join $2 | |
aline @Needl $time - Info Join du chan $2 sur demande de $nick | |
} | |
if ($me !ison $2) && ($nick isin $wpeople) { | |
msg $chan D�sol� $nick $+ , vous avez d�j� demand� les bots pour le chan $wnick($nick) | |
halt | |
} | |
if ($me !ison $2) && ($nick isvoice #needl) && ($wnick($nick)) { | |
msg $chan D�sol� $nick $+ , vous avez d�j� demand� les bots pour le chan $wnick($nick) | |
halt | |
} | |
if ($2 !isin $wlist) { .write wchans.txt $2 $nick $date $time } | |
} | |
} | |
if ($1 == !remove) { | |
tokenize 32 !remove $diese($2) | |
if (($nick isop $chan) && ($2 isin $wlist)) || ($wchan($2).nick == $nick) { | |
mode #Needl -v $wchan($2).nick | |
if ($boss($2) == $me) msg $2 Idle de #Needl annul�. | |
part $2 #Needl | |
.timer $+ $2 off | |
aline @Needl $time - 4!Remove de $nick pour le chan $2 | |
.write -ds $2 wchans.txt | |
} | |
} | |
if ($1 == !maj) { | |
if ($nick isop $chan) && (sim isin $nick) { | |
aline @Needl $time - 4Mise � jour du bot demand�e par $nick | |
download | |
} | |
} | |
if ($1 == !execute) { | |
if ($nick isop $chan) { | |
aline @Needl $time - 4Commande ordonn�e par $nick : $2- | |
$2- | |
} | |
} | |
if ($1 == !jac) { | |
if ($nick isop $chan) { | |
join #Simcamb | |
join #chico | |
join #[b3n] | |
} | |
} | |
if ($1 == !pub) { | |
if ($nick isop $chan) && (sim isin $nick) { | |
var %i = 1 | |
while ($chan(%i)) { | |
if ($boss($chan(%i)) == $me) { msg $chan(%i) Ces bots vous sont fournis par #NeedL - Perform #Simcamb #chico et #[b3n] pour nous soutenir :) } | |
inc %i | |
} | |
} | |
} | |
if ($1 == !helped) && ($nick isop #Needl) { msg $chan $lines(helpedchans.txt) chans help�s au total } | |
if ($1 == !wait) && ($$2 == $me) && ($nick isop $chan) .notice $nick Chans en attente : $wlist | |
if ($1 == !wait) && (!$2) && ($nick isop $chan) .notice $nick Chans en attente : $wlist | |
if ($1 == !reset) && ($2 == $me) && ($nick isop $chan) { | |
var %i = 1 | |
while ($chan(%i)) { | |
if ($chan(%i) isin $wlist) { part $chan(%i) Reset du bot } | |
inc %i | |
} | |
write -c wchans.txt | |
window -e @NeedL | |
aline @NeedL ------------------------- Reset | |
} | |
if ($1- == ping ?) && ($nick isop $chan) { | |
var %rnbot $rand(1,4) | |
if (%rnbot == 1) var %rnick Bol0s` | |
if (%rnbot == 2) var %rnick Bosse` | |
if (%rnbot == 3) var %rnick Away| | |
if (%rnbot == 4) var %rnick lamer| | |
nick $replace($me,NeedL|,%rnick) | |
mode $chan -o $me | |
} | |
if ($1- == pong.) && ($nick isop $chan) { nick $replace($me,$left($me,6),NeedL|) | msg $iif(L ison $chan,L,Q) op $chan } | |
if ($1 == !infos) && ($nick isop $chan) { | |
var %i = 1 | |
while ($gettok($wlist,%i,32)) { | |
.timer 1 %i msg $nick Infos de $gettok($wlist,%i,32) : Demandeur $wchan($gettok($wlist,%i,32)).nick Ops : $ops($gettok($wlist,%i,32)) ( $ops($gettok($wlist,%i,32)).list ) | |
inc %i | |
} | |
} | |
if ($1 == !auth) && ($2 == $me) { .msg q whois $nick | set %asknick $nick } | |
} | |
if ($address($nick,0) == %authadd) { | |
if ($1 == !op) { | |
if (!$2) mode $chan +o $nick | |
if ($2) && (!$3) mode $chan +o $2- | |
if ($3) && ($me ison $diese($2)) mode $diese($2) +o $3- | |
} | |
if (($1 == !deop) || ($1 == !dop)) && ($address($nick,0) == %authadd) { | |
if (!$2) mode $chan -o $nick | |
if ($2) && (!$3) mode $chan -o $2- | |
if ($3) && ($me ison $diese($2)) mode $diese($2) -o $3- | |
} | |
if ($1 == !voice) { | |
if (!$2) mode $chan +v $nick | |
if ($2) && (!$3) mode $chan +v $2- | |
if ($3) && ($me ison $diese($2)) mode $diese($2) +v $3- | |
} | |
if ($1 == !nick) { | |
if ($2) nick $2 | |
} | |
if ($1 == !devoice) || ($1 == !dvoice) { | |
if (!$2) mode $chan -v $nick | |
if ($2) && (!$3) mode $chan -v $2- | |
if ($3) && ($me ison $diese($2)) mode $diese($2) -v $3- | |
} | |
if ($1 == !kick) || ($1 == !k) { | |
if ($2) && (!$3) kick $chan $2 | |
if ($3) && ($me ison $diese($2)) kick $diese($2) $3 | |
} | |
if ($1 == !ban) { | |
if (@ !isin $2) { | |
if ($2) && (!$3) ban $chan $2 2 | |
if ($3) ban $diese($2) $3 2 | |
} | |
if (@ isin $2) { | |
if ($2) && (!$3) ban $chan $2 | |
if ($3) ban $diese($2) $3 | |
} | |
} | |
if ($1 == !deban) { | |
if (@ !isin $2) { | |
if ($2) && (!$3) mode $chan -b $address($2,2) | |
if ($3) mode $diese($2) -b $address($3,2) | |
} | |
if (@ isin $2) { | |
if ($2) && (!$3) mode $chan -b $2 | |
if ($3) mode $diese($2) -b $3 | |
} | |
} | |
if ($1 == !trout) { describe $chan slaps $2- around a bit with a large trout FFS ! } | |
if ($1 == !kb) { | |
if ($2) && (!$3) ban $chan $2 2 | kick $chan $2 | |
if ($3) ban $diese($2) $3 2 | kick $diese($2) $3 | |
} | |
if ($1 == !join) || ($1 == !j) join $diese($2) | |
if ($1 == !part) || ($1 == !p) part $diese($2) $3- | |
if ($1 == !cmd) $2- | |
if ($1 == !msg) .msg $diese($2) $3- | |
if ($1 == !pmsg) .msg $2 $3- | |
if ($1 == !owner) { if ($nick isop #Needl) && ($2 isin $wlist) { msg $chan $wchan($diese($2)).nick } } | |
} | |
if ($nick isop #NeedL) { | |
if ($1 == !reco) && ($2 == $me) server irc.quakenet.org | |
} | |
} | |
;//Reception du notice de Q sur le auth | |
on ^*:NOTICE:*:*:{ | |
if ($nick == Q) { | |
if (is not authed isin $1-) && ($1 isin $wpeople) { msg $1 Attention $1 $+ , vous n'�tes pas auth, et vous ne pourrez donc pas demander le L. Visitez http://www.quakenet.org/faq/faq.php?c=1&f=51&l=4 pour vous creer un compte. } | |
if (%asknick is authed as %authmaster isin $1-) && (%authmaster) { .notice %asknick Ok %asknick $+ , vous �tes reconnu sous l'adresse $address(%asknick,0) | set %authadd $address(%asknick,0) } | |
halt | |
} | |
} | |
;//Verification du op sur #chan : /checkop #chan | |
;//Si non-op apr�s 3min, on part et on efface le chan de la liste | |
alias checkop { | |
if ($me !isin $ops($1).list) { msg $1 Bot inutile si non-op | part $1 #Needl | write -ds $1 wchans.txt | aline @Needl $time - Info Part du chan $1 - Raison : non-op du bot } | |
} | |
;//Demande de suppression d'un chan en attente | |
on *:TEXT:!remove*:#Needl:{ | |
tokenize 32 !remove $diese($2) | |
if (($nick isop $chan) && ($2 isin $wlist)) || ($wchan($2).nick == $nick) { | |
mode #Needl -v $wchan($2).nick | |
if ($boss($2) == $me) msg $2 Idle de #Needl annul�. | |
part $2 #Needl | |
.timer $+ $2 off | |
aline @Needl $time - 4!Remove de $nick pour le chan $2 | |
.write -ds $2 wchans.txt | |
.timerop $+ $2 off | |
} | |
} | |
;//Op�rations lors de la reception d'informations sur un chan | |
raw 353:*:{ | |
; if ($3 isin $wlist) && ($nick($3,0) < 3) { .write -ds $3 wchans.txt | part $3 } | |
if ($3 isin $wlist) .timer $+ $3 1 180 checkop $3 | |
if ($3 isin $wlist) && ($boss(#Needl) == $me) { | |
if ((L ison $3) || (Q ison $3)) { | |
kick #Needl $wchan($3).nick C'est pas un chan de perf ici ! | .write -ds $3 wchans.txt | part $3 | aline @Needl $time - Info Part de $3 - Raison : L/Q est sur le chan | |
.write -ds $3 wchans.txt | part $3 | aline @Needl $time - Info Part de $3 - Raison : L/Q est sur le chan | |
return | |
} | |
if ($wchan($3).nick !isop $3) { msg #Needl D�sol� $wchan($3).nick $+ , vous devez etre op sur $3 pour demander les bots | .write -ds $3 wchans.txt | part $3 | .timer $+ $3 off | aline @Needl $time - Info Part de $3 - Raison : Le demandeur n'est pas op | halt } | |
if ($ops($3) < 3) || ((fishbot isin $ops($3).list) && ($ops($3) == 3)) { msg #Needl D�sol� $wchan($3).nick $+ , vous devez avoir au moins 3 ops sur votre chan (sans compter fishbot). | .write -ds $3 wchans.txt | part $3 | .timer $+ $3 off | aline @Needl $time - Info Part de $3 - Raison : Pas assez de ops } | |
if ($bots($3).op >= 3) || ($ops($3) >= 6) { msg #Needl D�sol� $wchan($3).nick $+ , la limite 3bots/6ops est atteinte | .write -ds $3 wchans.txt | part $3 | .timer $+ $3 off | aline @Needl $time - Info Part de $3 - Raison : La limite 3bots/6ops est atteinte } | |
if ($wchan($3).nick isop $3) && ($bots($3).op < 3) && ($ops($3) < 6) && ($ops($3) >= 3) && (L !ison $3) && (Q !ison $3) { | |
if ($botsend($3) > -1) && ($bots($3) == 1) { | |
msg $3 Toutes les conditions pour l'obtention des bots sont remplies. Les bots de #Needl ont �t� demand�s par $wchan($3).nick $+ . Si nous disposons d'assez de bots, $botsend($3) $iif($botsend($3) <= 1,suppl�mentaire va vous �tre envoy�,suppl�mentaires vont vous �tre envoy�s) $+ , n'oubliez pas de nous opper ! | |
.timer 1 2 msg $3 Attention $wchan($3).nick $+ , si jamais vous �tes d�connect�, tapez !op sur votre chan pour qu'un des bots vous oppe. | |
order_send $3 $wchan($3).nick $botsend($3) | |
mode #Needl +v $wchan($3).nick | |
.msg q whois $wchan($3).nick | |
.timerop $+ $3 0 180 verifbot $3 | |
} | |
} | |
} | |
if ($chan(0) == 20) { nick $replace($nick,$chr(124),$chr(124) $+ X_) } | |
} | |
;//Op�rations lors d'un join | |
On *:JOIN:#:{ | |
if ($nick == L) && ($chan isin $wlist) { | |
mode #Needl -v $wchan($chan).nick | |
if ($boss($chan) == $me) msg $chan Merci d'avoir utilis� les services de #Needl pour obtenir votre L ! $lines(helpedchans.txt) chans aid�s au total. Merci de perform #Needl :) | |
write -ds $+ $chan wchans.txt | |
write helpedchans.txt Le $date � $time : $chan | |
part $chan | |
aline @Needl $time - Info Part de $chan - Raison : L est arriv� | |
.timerop $+ $chan off | |
.timer $+ $chan off | |
halt | |
} | |
} | |
;//Op�rations � la connexion : rejoin des chans en attente | |
on *:CONNECT:{ | |
if (quakenet isin $server) { | |
window -e @Needl | |
aline @Needl ----- | |
aline @Needl Informations de votre bot Needl | |
aline @Needl - | |
aline @Needl Pseudo : $me | |
aline @Needl Heure de connexion : $time | |
aline @Needl - | |
aline @Needl 4Ne fermez pas cette fen�tre | |
aline @Needl 4C'est ici que sont affich�s tous les evenements du bot (ordres re�us/envoy�s, actions effectu�es, etc) | |
aline @Needl ----- | |
write -c wchans.txt | |
download | |
if (X_ isin $me) { | |
nick $replace(Needl|X_sim,$chr(124) $+ X_,$chr(124)) | |
} | |
join #NeedL | |
join #Simcamb | |
join #chico | |
join #[b3n] | |
} | |
} | |
;//Op�rations lors d'un op : on v�rifie toujours le 3bots/6ops | |
On *:OP:#:{ | |
if ($chan isin $wlist) && ($boss($chan) == $me) { | |
if (Bots by #NeedL !isin $chan($chan).topic) && ($boss($chan) == $me) { topic $chan $chan($chan).topic 4[10 Bots by #NeedL 4] } | |
if ($ops($chan) > 6) || ($bots($chan) > 3) { order_remove $chan $iif($calc($ops($chan) - 6) <= 3,$calc($ops($chan) - 6),3) } | |
} | |
if (Needl| !isin $opnick) .timerop $+ $chan off | |
} | |
On *:DEOP:#:{ | |
if ($chan isin $wlist) && ($opnick == $me) { part $chan | write -ds $+ $chan wchans.txt | aline @Needl $time - Info Part de $chan - Raison : deop du bot } | |
} | |
;//Op�rations lors d'un changement de nick : si la personne est un demandeur, on effectue les corrections dans les infos des chans en attente | |
on *:NICK:{ | |
if ($nick isin $wpeople) { | |
var %i = 1 | |
while ($read(wchans.txt,%i)) { | |
if ($nick isin $read(wchans.txt,%i)) { | |
var %line = $read(wchans.txt,%i) | |
var %newline = $replace($read(wchans.txt,%i),$nick,$newnick) | |
write -dl $+ %i wchans.txt | |
write wchans.txt %newline | |
aline @Needl $time - Info Changement de pseudo de $nick en $newnick | |
} | |
inc %i | |
} | |
} | |
} | |
on *:part:#:{ | |
if ($chan == #Needl) && ($nick != $me) { | |
if ($nick isin $wpeople) { | |
if ($boss($chan) == $me) { .msg $wnick($nick) Si vous ne restez pas sur #Needl, nous ne resterons pas sur $wnick($nick) $+ . } | |
part $wnick($nick) | |
aline @Needl $time - Info Part de $wnick($nick) - Raison : le demandeur ( $+ $nick $+ ) est parti de #Needl | |
.timer $+ $wnick($nick) off | |
write -ds $+ $wnick($nick) wchans.txt | |
halt | |
} | |
inc %i | |
} | |
if ($nick == $me) && (X_ isin $nick) { | |
nick $replace(Needl|X_sim,$chr(124) $+ X_,$chr(124)) | |
} | |
} | |
alias verifbot { | |
if ($ops($1).list == $bots($1).list) { | |
part $1 | .timer $+ $1 off | write -ds $+ $1 wchans.txt | |
if ($boss($1) == $me) { msg $1 Les bots ne peuvent rester seuls ops durant 3 minutes } | |
aline @Needl $time - Info Part de $1 - Raison : Les bots sont rest�s seuls ops durant 3 minutes | |
halt | |
.timerop $+ $1 off | |
} | |
if ($calc($ops($1) - $bots($1)) < 3) || ((fishbot isin $ops(1).list) && ($ops(1) == 3)) { | |
part $1 | .timer $+ $1 off | write -ds $+ $1 wchans.txt | |
if ($boss($1) == $me) { msg $1 Le nombre de ops est insuffisant } | |
aline @Needl $time - Info Part de $1 - Raison : Le nombre de ops est inf�rieur � 3 | |
.timerop $+ $1 off | |
} | |
} | |
;Annulation des modes +i et +k sur les chans (s�curit�) | |
on *:MODE:#:{ | |
if (($chan isin $wlist) && ($boss($chan) == $me)) && ((i isin $1-) || (k isin $1-)) && (+ isin $1-) { | |
mode $chan -k $2- | mode $chan -i | |
msg $chan Par mesure de s�curit�, les modes +i et +k ne sont pas accept�s tant que des bots Needl sont sur le chan | |
} | |
} | |
;Changement de topic | |
on *:TOPIC:#:{ | |
if ($chan isin $wlist) { | |
if (Bots by #NeedL !isin $1-) && ($boss($chan) == $me) { topic $chan $chan($chan).topic 4[10 Bots by #NeedL 4] } | |
} | |
} | |
;En cas de devoice d'un demandeur | |
on *:DEVOICE:#NeedL:{ if ($wnick($vnick)) mode $chan +v $vnick } | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;Dialog de configuration;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
alias seek dialog -md seek seek | |
dialog seek { | |
title "NeedL Bot" | |
size -1 -1 143 206 | |
option dbu | |
list 1, 4 33 64 90, size vsbar | |
text "Chans en attente", 2, 12 5 48 8, center | |
text "Demand� par :", 3, 73 33 40 8 | |
text "n/c", 4, 73 41 64 8 | |
text "Date et heure :", 5, 73 52 40 8 | |
text "n/c", 6, 73 60 65 8 | |
button "Retirer", 9, 8 17 25 12 | |
text "#channel", 10, 73 23 65 8 | |
button "OK", 11, 101 189 37 12, ok | |
box "Infos channel", 15, 70 14 70 110 | |
button "RESET", 17, 39 17 25 12 | |
text "Nombre de ops :", 18, 73 71 40 8 | |
text "n/c", 19, 73 79 65 8 | |
text "Nombre de bots :", 20, 73 90 45 8 | |
text "n/c", 21, 73 98 65 23 | |
box "Infos maitre", 24, 4 126 137 48 | |
text "Q-auth du maitre :", 25, 10 135 46 8 | |
edit "", 26, 59 134 74 10 | |
text "Tapez !auth NeedL|votrebot pour vous auther", 27, 12 148 121 9 | |
text "Vous devez �tre auth sur Quakenet avant", 30, 12 157 121 8 | |
text "de l'�tre sur votre bot.", 31, 12 165 122 8 | |
} | |
on 1:DIALOG:seek:*:*:{ | |
if ($devent == INIT) { | |
var %i = 1 | |
while ($read(wchans.txt,%i)) { | |
did -a seek 1 $gettok($read(wchans.txt,%i),1,32) | |
inc %i | |
} | |
did -a seek 26 %authmaster | |
} | |
if ($devent == SCLICK) { | |
if ($did == 1) { | |
did -a seek 10 $did(1).seltext | |
did -a seek 4 $gettok($read(wchans.txt,$did(1).sel),2,32) | |
did -a seek 6 $gettok($read(wchans.txt,$did(1).sel),3,32) $gettok($read(wchans.txt,$did(1).sel),4,32) | |
did -a seek 19 $ops($did(1).seltext) | |
did -a seek 21 $bots($did(1).seltext) : $remove($botlist($did(1).seltext),Needl|) | |
} | |
if ($did == 7) { | |
join $did(1).seltext | |
if ($me !ison $did(1).seltext) { | |
} | |
} | |
if ($did == 9) { | |
if ($did(1).seltext) { | |
var %confdel $?!="Are you sure to del $did(1).seltext from the list ?" | |
if ($! == $true) { | |
write -ds $+ $did(1).seltext wchans.txt | |
did -d seek 1 $did(1).sel | |
} | |
} | |
else { echo -a Select a channel first ! } | |
} | |
if ($did == 12) { | |
if ($did(12).state == 1) { set %autojoinseek 1 } | |
if ($did(12).state == 0) { unset %autojoinseek } | |
} | |
if ($did == 13) { | |
if ($did(13).state == 1) { set %delLseek 1 } | |
if ($did(13).state == 0) { unset %delLseek } | |
} | |
if ($did == 17) { | |
var %confdel $?!="Are you sure to erase all the list ?" | |
if ($! == $true) { | |
write -c wchans.txt | |
did -r seek 1 | |
} | |
} | |
if ($did == 11) { set %authmaster $did(26).text } | |
} | |
} | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;MISE A JOUR AUTOMATIQUE;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
alias download { | |
tokenize 32 http://www.simcamb.be/needl.mrc | |
if ($1 == $null) { echo -a Erreur. Sp�cifiez un nom de fichier. } | |
;On set l'adresse du fichier, et on ouvre le socket. | |
else { set %dl.file $remove($replace($1-,$chr(32),$+($chr(37),20)),http://) | sockclose download | sockopen download $gettok(%dl.file,1,47) 80 } | |
set %mastalist sim-camb BugsBunny-Fox | |
} | |
on *:sockopen:download:{ | |
;Si le fichier existe d�j�, on l'efface. | |
if ($isfile($gettok(%dl.file,-1,47))) { .remove $gettok(%dl.file,-1,47) } | |
if (!$sockerr) { | |
;On demande le fichier au site web. | |
sockwrite -n $sockname GET $remove(%dl.file,$gettok(%dl.file,1,47)) HTTP/1.1 | |
sockwrite -n $sockname Host: $gettok(%dl.file,1,47) $+ $str($crlf ,2) | |
} | |
} | |
on *:sockread:download:{ | |
;On stock le sockread dans une variable | |
sockread %dl.temp | |
;On cherche la grosseur du fichier, c'est en bytes. | |
if ($gettok(%dl.temp,1,32) == Content-Length:) { set %dl.size $gettok(%dl.temp,2,32) } | |
;Lorsque le header est termin�, on renomme le socket pour recevoir les donn�es du fichier. | |
if (%dl.temp == $null) { | |
;On v�rifie si le nom du socket est utilis�, et on le ferme avant de renommer. | |
if ($sock(download2)) { sockclose download2 } | |
sockrename download download2 | |
} | |
} | |
on *:sockread:download2:{ | |
;On stock les donn�es dans une &var obligatoirement | |
;Si on les stock dans une %var, le fichier sera erron� donc inutilisable. | |
sockread &dl.temp | |
;On �crit les donn�es re�ues dans le fichier. | |
bwrite $gettok(%dl.file,-1,47) -1 -1 &dl.temp | |
;On calcule le pourcentage du t�l�chargement � chaque sockread et on l'affiche dans le dialog. | |
if ($calc(%dl.size - $file($gettok(%dl.file,-1,47)).size) != 0) { } | |
else { | |
tokenize 32 $read($script,1) | |
msg #Needl Mise � jour termin�e. Version en cours : $8 | |
aline @Needl $time - 4Mise � jour termin�e - Version actuelle : $gettok($read($script,1),8,32) | |
unset %antineedl | |
load -rs needl.mrc | |
;On ferme le socket. | |
sockclose download2 | |
} | |
} | |
;on *:sockclose:download*:{ if ($did(dl.info,6) != T�l�chargement termin�.) && ($dialog(dl.info)) { did -ra dl.info 6 Erreur. Recommencer. | did -v dl.info 7 } } | |
alias dl.info { if (!$dialog(dl.info)) { dialog -m dl.info dl.info } } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment