|
@@ -79,34 +79,34 @@ my $symbol = "+";
|
|
|
|
|
|
# dictionnaire contenant les regex permettants de trouver les FAI
|
|
|
my %regex = (
|
|
|
- "apinnet" => "\\b(ap[in]|Poitou|Charente|Rochelle|(Deux[- ])?S[èe]vres?|Vienne|Angoul[eêè]me|Niort|Poitiers)",
|
|
|
- "aquilenet" => "\\b(aq(ui|n)|Bord(o|e?au)|Landes|Gironde)",
|
|
|
- "arn" => "\\b(a(lsace|rn)|Stras|Colma)",
|
|
|
- "auvernet" => "\\b(Auver|Puy[- ](de[- ])D[oô]me|avn)",
|
|
|
- "cafai" => "\\b(cafai|champagne|ardenn?e)",
|
|
|
- "faimaison" => "\\b(fma|fail?m|Nantes|Loire[- ]Atlantique)",
|
|
|
- "fdn" => "\\bf(rench|dn)",
|
|
|
- "franciliens" => "\\b(f(ranc|cn)|idf|Paris)",
|
|
|
- "grifon" => "\\b(grif|rennes|[îi]l?le[- ](et[- ])?vilaine)",
|
|
|
- "ilico" => "\\b(ilc|ill?[iy][ck])|(Corr?[éêèe][sz])",
|
|
|
- "illyse" => "\\b(ill?y|ill?i[sz]|lyon|rh[ôo]ne|loire|((st|saint)[- ]etienn?e))",
|
|
|
- "iloth" => "\\b(ilo|mont?pel|h[ée]rault)",
|
|
|
- "ldn" => "\\b(l(or|dn)|Nancy|Metz|Moselle|Meuse|Meurthe|Vosges)",
|
|
|
- "ndn" => "\\b(n(ice|dn)|Antibes|Cannes|Valbonne|Alpes[- ]Maritimes)",
|
|
|
- "netopi" => "\\b(netopi|Seine[- ](et[- ])?Marne)",
|
|
|
- "pclight" => "\\b(yonne|beon|cheny|pc[- ]?l)",
|
|
|
- "rezine" => "\\b(r[eé]z|Isère|Grenoble)",
|
|
|
- "rhizome" => "\\b(rh?[iy][sz]om|Oise|Compi[eéêè]gne)",
|
|
|
- "sames" => "\\bsam|(Pyrénées[- ]Atlantiques)",
|
|
|
- "sdn" => "\\b(s(all|dn)|Savoie|Haute[- ]Savoie)",
|
|
|
- "teleragno" => "\\b(mars|telerag|telegrano)",
|
|
|
- "tetaneutral" => "\\b(t(eta|tn|nn)|Toulouse|Comminges|(Haute[- ]Garon?ne))",
|
|
|
- "ail" => "\\ba(il|utan)",
|
|
|
- "chaul" => "\\b(c(haul|hz)|hertz|tarn)",
|
|
|
- "igwan" => "\\b(ig[wn]|sbg|saint[- ]barth)",
|
|
|
- "neutrinet" => "\\b(neutri|n[tre]n|belgique)",
|
|
|
- "ffdn" => "\\bf(ede|fdn|rance|édé)",
|
|
|
- "tdn" => "\\b(t(dn|ouraine)|centre|rouvr)",
|
|
|
+ "apinnet" => "(ap[in]|Poitou|Charente|Rochelle|(Deux[- ])?S[èe]vres?|Vienne|Angoul[eêè]me|Niort|Poitiers)",
|
|
|
+ "aquilenet" => "(aq(ui|n)|Bord(o|e?au)|Landes|Gironde)",
|
|
|
+ "arn" => "(a(lsace|rn)|Stras|Colma)",
|
|
|
+ "auvernet" => "(Auver|Puy[- ](de[- ])D[oô]me|avn)",
|
|
|
+ "cafai" => "(cafai|champagne|ardenn?e)",
|
|
|
+ "faimaison" => "(fma|fail?m|Nantes|Loire[- ]Atlantique)",
|
|
|
+ "fdn" => "f(rench|dn)",
|
|
|
+ "franciliens" => "b(f(ranc|cn)|idf|Paris)",
|
|
|
+ "grifon" => "(grif|rennes|[îi]l?le[- ](et[- ])?vilaine)",
|
|
|
+ "ilico" => "(ilc|ill?[iy][ck])|(Corr?[éêèe][sz])",
|
|
|
+ "illyse" => "(ill?y|ill?i[sz]|lyon|rh[ôo]ne|loire|((st|saint)[- ]etienn?e))",
|
|
|
+ "iloth" => "(ilo|mont?pel|h[ée]rault)",
|
|
|
+ "ldn" => "(l(or|dn)|Nancy|Metz|Moselle|Meuse|Meurthe|Vosges)",
|
|
|
+ "ndn" => "(n(ice|dn)|Antibes|Cannes|Valbonne|Alpes[- ]Maritimes)",
|
|
|
+ "netopi" => "(netopi|Seine[- ](et[- ])?Marne)",
|
|
|
+ "pclight" => "(yonne|beon|cheny|pc[- ]?l)",
|
|
|
+ "rezine" => "(r[eé]z|Isère|Grenoble)",
|
|
|
+ "rhizome" => "(rh?[iy][sz]om|Oise|Compi[eéêè]gne)",
|
|
|
+ "sames" => "sam|(Pyrénées[- ]Atlantiques)",
|
|
|
+ "sdn" => "(s(all|dn)|Savoie|Haute[- ]Savoie)",
|
|
|
+ "teleragno" => "(mars|telerag|telegrano)",
|
|
|
+ "tetaneutral" => "(t(eta|tn|nn)|Toulouse|Comminges|(Haute[- ]Garon?ne))",
|
|
|
+ "ail-network" => "a(il|utan)",
|
|
|
+ "chaul-hertz" => "(c(haul|hz)|hertz|tarn)",
|
|
|
+ "igwan" => "(ig[wn]|sbg|saint[- ]barth)",
|
|
|
+ "neutrinet" => "(neutri|n[tre]n|belgique)",
|
|
|
+ "ffdn" => "f(ede|fdn|rance|édé)",
|
|
|
+ "tdn" => "(t(dn|ouraine)|centre|rouvr)",
|
|
|
);
|
|
|
|
|
|
# Lis le fichier contenant les infos d'un FAI
|
|
@@ -201,6 +201,25 @@ sub rp {
|
|
|
return "Une nouvelle RP à traiter est disponible à http://unefede.fdn.fr/rp.txt (hl quota_atypique taziden)";
|
|
|
}
|
|
|
|
|
|
+sub get_fai {
|
|
|
+ my ($commande, $message) = @_;
|
|
|
+ my @fai_trouves = grep { $message =~ /$regex{$_}/ } keys %regex;
|
|
|
+ if (@fai_trouves < 1 ) {
|
|
|
+ return "commande : ".$symbol."$commande <fai> (".$symbol."liste pour avoir la liste) ou ".$symbol."$commande <lieu geographique>";
|
|
|
+ }
|
|
|
+ elsif (@fai_trouves > 1 ) {
|
|
|
+ return "Trop de fai trouvés : " . join ', ', @fai_trouves;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if ($commande eq 'info') {
|
|
|
+ info $fai_trouves[0];
|
|
|
+ }
|
|
|
+ elsif ($commande eq 'adh') {
|
|
|
+ adh $fai_trouves[0];
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
## Le bot lit le chan et réagit
|
|
|
sub said {
|
|
|
my ($self, $message) = @_;
|
|
@@ -216,241 +235,17 @@ sub said {
|
|
|
if ($message->{body} =~ /^\Q$symbol\Einfo/) {
|
|
|
shift @_;
|
|
|
|
|
|
- # Apinnet
|
|
|
- if($message->{body} =~ /$regex{"apinnet"}/i) {
|
|
|
- info("apinnet");
|
|
|
- }
|
|
|
- # Aquilenet
|
|
|
- elsif($message->{body} =~ /$regex{"aquilenet"}/i) {
|
|
|
- info("aquilenet");
|
|
|
- }
|
|
|
- # ARN
|
|
|
- elsif($message->{body} =~ /$regex{"arn"}/i) {
|
|
|
- info("arn");
|
|
|
- }
|
|
|
- # Auvernet
|
|
|
- elsif($message->{body} =~ /$regex{"auvernet"}/i) {
|
|
|
- info("auvernet");
|
|
|
- }
|
|
|
- # Cafai
|
|
|
- elsif($message->{body} =~ /$regex{"cafai"}/i) {
|
|
|
- info("cafai");
|
|
|
- }
|
|
|
- # faimaison
|
|
|
- elsif($message->{body} =~ /$regex{"faimaison"}/i) {
|
|
|
- info("faimaison");
|
|
|
- }
|
|
|
- # FDN
|
|
|
- elsif($message->{body} =~ /$regex{"fdn"}/i) {
|
|
|
- info("fdn");
|
|
|
- }
|
|
|
- # franciliens.net
|
|
|
- elsif($message->{body} =~ /$regex{"franciliens"}/i) {
|
|
|
- info("franciliens");
|
|
|
- }
|
|
|
- # grifon
|
|
|
- elsif($message->{body} =~ /$regex{"grifon"}/i) {
|
|
|
- info("grifon");
|
|
|
- }
|
|
|
- # ilico
|
|
|
- elsif($message->{body} =~ /$regex{"ilico"}/i) {
|
|
|
- info("ilico");
|
|
|
- }
|
|
|
- # illyse
|
|
|
- elsif($message->{body} =~ /$regex{"illyse"}/i) {
|
|
|
- info("illyse");
|
|
|
- }
|
|
|
- # iloth
|
|
|
- elsif($message->{body} =~ /$regex{"iloth"}/i) {
|
|
|
- info("iloth");
|
|
|
- }
|
|
|
- # ldn
|
|
|
- elsif($message->{body} =~ /$regex{"ldn"}/i) {
|
|
|
- info("ldn");
|
|
|
- }
|
|
|
- # ndn
|
|
|
- elsif($message->{body} =~ /$regex{"ndn"}/i) {
|
|
|
- info("ndn");
|
|
|
- }
|
|
|
- # netopi
|
|
|
- elsif($message->{body} =~ /$regex{"netopi"}/i) {
|
|
|
- info("netopi");
|
|
|
- }
|
|
|
- # pclight
|
|
|
- elsif($message->{body} =~ /$regex{"pclight"}/i) {
|
|
|
- info("pclight");
|
|
|
- }
|
|
|
- # rézine
|
|
|
- elsif($message->{body} =~ /$regex{"rezine"}/i) {
|
|
|
- info("rezine");
|
|
|
- }
|
|
|
- # rhizome
|
|
|
- elsif($message->{body} =~ /$regex{"rhizome"}/i) {
|
|
|
- info("rhizome");
|
|
|
- }
|
|
|
- # sames
|
|
|
- elsif($message->{body} =~ /$regex{"sames"}/i) {
|
|
|
- info("sames");
|
|
|
- }
|
|
|
- # sdn
|
|
|
- elsif($message->{body} =~ /$regex{"sdn"}/i) {
|
|
|
- info("sdn");
|
|
|
- }
|
|
|
- # teleragno
|
|
|
- elsif($message->{body} =~ /$regex{"teleragno"}/i) {
|
|
|
- info("teleragno");
|
|
|
- }
|
|
|
- # tetaneutral
|
|
|
- elsif($message->{body} =~ /$regex{"tetaneutral"}/i) {
|
|
|
- info("tetaneutral");
|
|
|
- }
|
|
|
- # ail-network
|
|
|
- elsif($message->{body} =~ /$regex{"ail"}/i) {
|
|
|
- info("ail-network");
|
|
|
- }
|
|
|
- # chaul'hertz
|
|
|
- elsif($message->{body} =~ /$regex{"chaul"}/i) {
|
|
|
- info("chaul-hertz");
|
|
|
- }
|
|
|
- # igwan
|
|
|
- elsif($message->{body} =~ /$regex{"igwan"}/i) {
|
|
|
- info("igwan");
|
|
|
- }
|
|
|
- # neutrinet
|
|
|
- elsif($message->{body} =~ /$regex{"neutrinet"}/i) {
|
|
|
- info("neutrinet");
|
|
|
- }
|
|
|
- elsif($message->{body} =~ /$regex{"tdn"}/i) {
|
|
|
- info("tdn");
|
|
|
- }
|
|
|
- elsif($message->{body} =~ /$regex{"ffdn"}/i) {
|
|
|
+ if($message->{body} =~ /$regex{"ffdn"}/i) {
|
|
|
return "La fédération FDN regroupe des Fournisseurs d'Accès à Internet associatifs se reconnaissant dans des valeurs communes : bénévolat, solidarité, fonctionnement démocratique et à but non lucratif; défense et promotion de la neutralité du Net.";
|
|
|
}
|
|
|
- # Si le FAI n'est pas valide, on l'indique
|
|
|
- else {
|
|
|
- return "commande : ".$symbol."info <fai> (".$symbol."liste pour avoir la liste) ou ".$symbol."info <lieu geographique>";
|
|
|
- }
|
|
|
+
|
|
|
+ get_fai 'info', $message->{body};
|
|
|
}
|
|
|
|
|
|
# si on veut le nombre d'adhérent
|
|
|
elsif ($message->{body} =~ /^\Q$symbol\Eadh/) {
|
|
|
shift @_;
|
|
|
- # Apinnet
|
|
|
- if($message->{body} =~ /$regex{"apinnet"}/i) {
|
|
|
- adh("apinnet");
|
|
|
- }
|
|
|
- # Aquilenet
|
|
|
- elsif($message->{body} =~ /$regex{"aquilenet"}/i) {
|
|
|
- adh("aquilenet");
|
|
|
- }
|
|
|
- # ARN
|
|
|
- elsif($message->{body} =~ /$regex{"arn"}/i) {
|
|
|
- adh("arn");
|
|
|
- }
|
|
|
- # Auvernet
|
|
|
- elsif($message->{body} =~ /$regex{"auvernet"}/i) {
|
|
|
- adh("auvernet");
|
|
|
- }
|
|
|
- # Cafai
|
|
|
- elsif($message->{body} =~ /$regex{"cafai"}/i) {
|
|
|
- adh("cafai");
|
|
|
- }
|
|
|
- # faimaison
|
|
|
- elsif($message->{body} =~ /$regex{"faimaison"}/i) {
|
|
|
- adh("faimaison");
|
|
|
- }
|
|
|
- # FDN
|
|
|
- elsif($message->{body} =~ /$regex{"fdn"}/i) {
|
|
|
- adh("fdn");
|
|
|
- }
|
|
|
- # franciliens.net
|
|
|
- elsif($message->{body} =~ /$regex{"franciliens"}/i) {
|
|
|
- adh("franciliens");
|
|
|
- }
|
|
|
- # grifon
|
|
|
- elsif($message->{body} =~ /$regex{"grifon"}/i) {
|
|
|
- adh("grifon");
|
|
|
- }
|
|
|
- # ilico
|
|
|
- elsif($message->{body} =~ /$regex{"ilico"}/i) {
|
|
|
- adh("ilico");
|
|
|
- }
|
|
|
- # illyse
|
|
|
- elsif($message->{body} =~ /$regex{"illyse"}/i) {
|
|
|
- adh("illyse");
|
|
|
- }
|
|
|
- # iloth
|
|
|
- elsif($message->{body} =~ /$regex{"iloth"}/i) {
|
|
|
- adh("iloth");
|
|
|
- }
|
|
|
- # ldn
|
|
|
- elsif($message->{body} =~ /$regex{"ldn"}/i) {
|
|
|
- adh("ldn");
|
|
|
- }
|
|
|
- # ndn
|
|
|
- elsif($message->{body} =~ /$regex{"ndn"}/i) {
|
|
|
- adh("ndn");
|
|
|
- }
|
|
|
- # netopi
|
|
|
- elsif($message->{body} =~ /$regex{"netopi"}/i) {
|
|
|
- adh("netopi");
|
|
|
- }
|
|
|
- # pclight
|
|
|
- elsif($message->{body} =~ /$regex{"pclight"}/i) {
|
|
|
- adh("pclight");
|
|
|
- }
|
|
|
- # rézine
|
|
|
- elsif($message->{body} =~ /$regex{"rezine"}/i) {
|
|
|
- adh("rezine");
|
|
|
- }
|
|
|
- # rhizome
|
|
|
- elsif($message->{body} =~ /$regex{"rhizome"}/i) {
|
|
|
- adh("rhizome");
|
|
|
- }
|
|
|
- # sames
|
|
|
- elsif($message->{body} =~ /$regex{"sames"}/i) {
|
|
|
- adh("sames");
|
|
|
- }
|
|
|
- # sdn
|
|
|
- elsif($message->{body} =~ /$regex{"sdn"}/i) {
|
|
|
- adh("sdn");
|
|
|
- }
|
|
|
- # teleragno
|
|
|
- elsif($message->{body} =~ /$regex{"teleragno"}/i) {
|
|
|
- adh("teleragno");
|
|
|
- }
|
|
|
- # tetaneutral
|
|
|
- elsif($message->{body} =~ /$regex{"tetaneutral"}/i) {
|
|
|
- adh("tetaneutral");
|
|
|
- }
|
|
|
- # ail-network
|
|
|
- elsif($message->{body} =~ /$regex{"ail"}/i) {
|
|
|
- adh("ail-network");
|
|
|
- }
|
|
|
- # chaul'hertz
|
|
|
- elsif($message->{body} =~ /$regex{"chaul"}/i) {
|
|
|
- adh("chaul-hertz");
|
|
|
- }
|
|
|
- # igwan
|
|
|
- elsif($message->{body} =~ /$regex{"igwan"}/i) {
|
|
|
- adh("igwan");
|
|
|
- }
|
|
|
- # neutrinet
|
|
|
- elsif($message->{body} =~ /$regex{"neutrinet"}/i) {
|
|
|
- adh("neutrinet");
|
|
|
- }
|
|
|
- elsif($message->{body} =~ /$regex{"tdn"}/i) {
|
|
|
- adh("tdn");
|
|
|
- }
|
|
|
- elsif($message->{body} =~ /$regex{"ffdn"}/i) {
|
|
|
- adh("ffdn");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- # Si le FAI n'est pas valide, on l'indique
|
|
|
- else {
|
|
|
- return "commande : ".$symbol."adh <fai> (".$symbol."liste pour avoir la liste) ou ".$symbol."adh <lieu geographique>";
|
|
|
- }
|
|
|
+ get_fai 'adh', $message->{body};
|
|
|
}
|
|
|
|
|
|
|