Browse Source

initial commit

Vigdis (DanJ) 10 years ago
commit
9909322852
3 changed files with 772 additions and 0 deletions
  1. 61 0
      feed.ksh
  2. 217 0
      json-file.pl
  3. 494 0
      unefede.pl

+ 61 - 0
feed.ksh

@@ -0,0 +1,61 @@
+#!/bin/ksh
+
+# Copyright (c) 2014 Daniel Jakots <vigdis@chown.me>
+
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+# http://db.ffdn.org/api/v1/isp/1/ #cafai
+# http://db.ffdn.org/api/v1/isp/2/ # Ilico
+# http://db.ffdn.org/api/v1/isp/3/ # Grifon
+# http://db.ffdn.org/api/v1/isp/4/ # Illyse
+# http://db.ffdn.org/api/v1/isp/5/ # Franciliens.net
+# http://db.ffdn.org/api/v1/isp/6/ # Sames
+# http://db.ffdn.org/api/v1/isp/7/ # Aquilenet
+# http://db.ffdn.org/api/v1/isp/8/ # LDN
+# http://db.ffdn.org/api/v1/isp/9/ # ARN
+# http://db.ffdn.org/api/v1/isp/11/ # Auvernet
+# http://db.ffdn.org/api/v1/isp/15/ # tetaneutral
+# http://db.ffdn.org/api/v1/isp/17/ # Teleragno 
+# http://db.ffdn.org/api/v1/isp/18/ # Iloth
+# http://db.ffdn.org/api/v1/isp/24/ # Pclight
+# http://db.ffdn.org/api/v1/isp/30/ # Rézine
+# http://db.ffdn.org/api/v1/isp/31/ # Igwan 
+# http://db.ffdn.org/api/v1/isp/33/ # Ail network
+# http://db.ffdn.org/api/v1/isp/36/ # Faimaison
+# http://db.ffdn.org/api/v1/isp/39/ # Rhizome 
+# http://db.ffdn.org/api/v1/isp/45/ # neutrinet
+# http://db.ffdn.org/api/v1/isp/48/ # FDN
+# http://db.ffdn.org/api/v1/isp/49/ # apinnet
+
+wget -O dump/cafai http://db.ffdn.org/api/v1/isp/1/ #cafai
+wget -O dump/ilico http://db.ffdn.org/api/v1/isp/2/ # Ilico
+wget -O dump/grifon http://db.ffdn.org/api/v1/isp/3/ # Grifon
+wget -O dump/illyse http://db.ffdn.org/api/v1/isp/4/ # Illyse
+wget -O dump/franciliens http://db.ffdn.org/api/v1/isp/5/ # Franciliens.net
+wget -O dump/sames http://db.ffdn.org/api/v1/isp/6/ # Sames
+wget -O dump/aquilenet http://db.ffdn.org/api/v1/isp/7/ # Aquilenet
+wget -O dump/ldn http://db.ffdn.org/api/v1/isp/8/ # LDN
+wget -O dump/arn http://db.ffdn.org/api/v1/isp/9/ # ARN
+wget -O dump/auvernet http://db.ffdn.org/api/v1/isp/11/ # Auvernet
+wget -O dump/tetaneutral http://db.ffdn.org/api/v1/isp/15/ # tetaneutral
+wget -O dump/teleragno http://db.ffdn.org/api/v1/isp/17/ # Teleragno 
+wget -O dump/iloth http://db.ffdn.org/api/v1/isp/18/ # Iloth
+wget -O dump/pclight http://db.ffdn.org/api/v1/isp/24/ # Pclight
+wget -O dump/rezine http://db.ffdn.org/api/v1/isp/30/ # Rézine
+wget -O dump/igwan http://db.ffdn.org/api/v1/isp/31/ # Igwan 
+wget -O dump/ail-network http://db.ffdn.org/api/v1/isp/33/ # Ail network
+wget -O dump/faimaison http://db.ffdn.org/api/v1/isp/36/ # Faimaison
+wget -O dump/rhizome http://db.ffdn.org/api/v1/isp/39/ # Rhizome 
+wget -O dump/neutrinet http://db.ffdn.org/api/v1/isp/45/ #neutrinet
+wget -O dump/fdn http://db.ffdn.org/api/v1/isp/48/ #fdn
+wget -O dump/apinnet http://db.ffdn.org/api/v1/isp/49/ #apinnet

+ 217 - 0
json-file.pl

@@ -0,0 +1,217 @@
+#/usr/lib/perl
+
+# Copyright (c) 2014 Daniel Jakots <vigdis@chown.me>
+
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+use strict;
+use warnings;
+
+binmode STDOUT, ":utf8";
+use utf8;
+use JSON;
+
+
+# FAI variables
+my $nb_adh = 0; # nombre d'adhérents
+my $nb_abo = 0; # nombre d'abonnés
+my $site = ""; # site web
+my $salon = ""; # salon irc/xmpp
+my $statut = 0; # étape de 1 à 8 du FAI
+my $date_crea = ""; # date de la création de l'asso
+my $date_jffdn = ""; # date de la rentrée dans la fédé
+my $contact = ""; # email de contact
+my $description = ""; # description de l'asso
+
+# variables des dossiers
+my $dump_dir = "dump";
+my $wrk_dir = "wrk-dir";
+
+# récupère les infos du json et les mets dans le ficher au nom du FAI
+sub info{
+    my $fai = shift @_;
+    my $json;
+    {
+	local $/; #Enable 'slurp' mode
+	open my $fh, "<", "/home/daga/bot-irc/". $dump_dir."/". $fai;
+	$json = <$fh>;
+	close $fh;
+    }
+    
+    my $data = decode_json($json);
+# pour chaque valeur on vérifie que ce n'est pas nul, si c'est le cas on
+# indique N/A (not available)
+    if (!length $data->{"ispformat"}->{"memberCount"}) {
+	$nb_adh = "N/A";
+    }
+    else {
+	$nb_adh = $data->{"ispformat"}->{"memberCount"};
+    }
+
+    if (!length $data->{"ispformat"}->{"subscriberCount"}) {
+     	$nb_abo = "N/A";
+    }
+    else {
+	$nb_abo = $data->{"ispformat"}->{"subscriberCount"};
+    }
+    
+    if (!length $data->{"ispformat"}->{"website"}) {
+	$site = "N/A";
+    }
+    else {
+	$site = $data->{"ispformat"}->{"website"};
+    }
+    if (!length $data->{"ispformat"}->{"chatrooms"}) {
+	$salon = "N/A";
+    }
+    else {
+	$salon = $data->{"ispformat"}->{"chatrooms"}->[0];
+    }
+    
+    if (!length $data->{"ispformat"}->{"progressStatus"}) {
+	$statut = "N/A";
+    }
+    else {
+	$statut = $data->{"ispformat"}->{"progressStatus"};
+    }
+    
+    if (!length $data->{"ispformat"}->{"creationDate"}) {
+	$date_crea = "N/A";
+    }
+    else{
+	$date_crea = $data->{"ispformat"}->{"creationDate"};
+    }
+
+    if (!length $data->{"ispformat"}->{"ffdnMemberSince"}) {
+	$date_jffdn = "N/A";
+    }
+    else {
+	$date_jffdn = $data->{"ispformat"}->{"ffdnMemberSince"};
+    }
+    if (!length $data->{"ispformat"}->{"email"}) {
+	$contact = "N/A";
+    }
+    else {
+	$contact = $data->{"ispformat"}->{"email"};
+    }
+    if (!length $data->{"ispformat"}->{"description"}) {
+	$description = "N/A";
+    }
+    else {
+	$description = $data->{"ispformat"}->{"description"};
+    }
+
+    my $filename = "/home/daga/bot-irc/wrk-dir/". $fai.".info"; 
+
+# On indique dans le fichier la phrase que le bot va répondre
+
+    my $fh2;
+    open ($fh2, '>', $filename) or die "Impossible d'ouvrir le fichier $filename en écriture";
+    print $fh2 $description . ". Site : ". $site ." - Salon de discussion : ". $salon ." - Adresse de contact : ". $contact . " - Crée le ". $date_crea .", il a rejoint la fédé le ". $date_jffdn ."\n";
+    close $fh2;
+}
+
+# récupère les infos du json et les mets dans le ficher au nom du FAI.adh
+sub adh{
+    my $fai = shift @_;
+    my $json;
+    {
+	local $/; #Enable 'slurp' mode
+	open my $fh, "<", "/home/daga/bot-irc/dump/". $fai;
+	$json = <$fh>;
+	close $fh;
+    }
+    
+    my $data = decode_json($json);
+# pour chaque valeur on vérifie que ce n'est pas nul, si c'est le cas on
+# indique N/A (not available)
+    if (!length $data->{"ispformat"}->{"memberCount"}) {
+	$nb_adh = "N/A";
+    }
+    else {
+	$nb_adh = $data->{"ispformat"}->{"memberCount"};
+    }
+    
+    if (!length $data->{"ispformat"}->{"subscriberCount"}) {
+     	$nb_abo = "N/A";
+    }
+    else {
+	$nb_abo = $data->{"ispformat"}->{"subscriberCount"};
+    }
+
+    my $filename = "/home/daga/bot-irc/wrk-dir/". $fai.".adh"; 
+    my $fh2;
+    open ($fh2, '>', $filename) or die "Impossible d'ouvrir le fichier $filename en écriture";
+    print $fh2 $nb_adh ." adhérent·e·s (et ".$nb_abo." abonné·e·s).\n";
+    close $fh2;
+}
+# indique le nombre d'adh et d'abo dans l'ensemble des FAI ; fichier : ffdn.adh
+sub adh_abo_ffdn {
+    
+    my @filesdump = </home/daga/bot-irc/dump/*>;
+    my $filedump;
+
+    my $adh_ffdn = 0; 
+    my $abo_ffdn = 0;
+    foreach $filedump (@filesdump) {
+	$filedump =~ s{/home/daga/bot-irc/dump/}{};
+
+	my $json;
+	{
+	    local $/; #Enable 'slurp' mode
+	    open my $fh, "<", "/home/daga/bot-irc/dump/". $filedump;
+	    $json = <$fh>;
+	    close $fh;
+	}
+	
+	my $data = decode_json($json);
+# si pas d'info, tant pis	
+	unless (!length $data->{"ispformat"}->{"memberCount"}) {
+	    $nb_adh = $data->{"ispformat"}->{"memberCount"};
+	}
+	
+	unless (!length $data->{"ispformat"}->{"subscriberCount"}) {
+	    $nb_abo = $data->{"ispformat"}->{"subscriberCount"};
+	}
+	my $fh2;
+	open ($fh2, '>', $filedump) or die "Impossible d'ouvrir le fichier $filedump en écriture";
+# on incrémente pour chaque FAI
+	$adh_ffdn += $nb_adh;
+	$abo_ffdn += $nb_abo;
+	close $fh2;	
+}
+    
+    my $filenameadh = "/home/daga/bot-irc/wrk-dir/ffdn.adh"; 
+
+    my $fh3;
+# on met l'info dans le fichier
+    open ($fh3, '>', $filenameadh) or die "Impossible d'ouvrir le fichier $filenameadh en écriture";
+    print $fh3 "La fédé compte ".$adh_ffdn ." adhérent·e·s et ". $abo_ffdn ." abonné·e·s";
+    close $fh3;
+       
+}
+
+# pour chaque FAI on génère l'info
+my @filesdump = </home/daga/bot-irc/dump/*>;
+my $filedump;
+foreach $filedump (@filesdump) {
+    $filedump =~ s{/home/daga/bot-irc/dump/}{};
+    info ("$filedump");
+}
+# pour chaque FAI on génère l'info du nombre d'adhérents
+foreach $filedump (@filesdump) {
+    $filedump =~ s{/home/daga/bot-irc/dump/}{};
+    adh ("$filedump");
+}
+# on génère l'info du nombre d'adhérents de la fédé
+adh_abo_ffdn();

+ 494 - 0
unefede.pl

@@ -0,0 +1,494 @@
+#!/usr/bin/perl
+
+# Copyright (c) 2014 Daniel Jakots <vigdis@chown.me>
+
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+
+use warnings;
+use strict;
+
+package MyBot;
+use base qw( Bot::BasicBot );
+
+
+binmode STDOUT, ":utf8";
+use utf8;
+
+my $nb_adh = 0; # nombre d'adhérents
+my $nb_abo = 0; # nombre d'abonnés
+my $site = ""; # site web
+my $salon = ""; # salon irc/xmpp
+my $statut = 0; # étape de 1 à 8 du FAI
+my $date_crea = ""; # date de la création de l'asso
+my $date_jffdn = ""; # date de la rentrée dans la fédé
+my $contact = ""; # email de contact
+my $description = ""; # description de l'asso
+
+# le repectoire des données du bot aka autoconf
+my $bot_dir = `pwd`; chomp $bot_dir ; $bot_dir .= "/";
+my $wrk_dir = "wrk-dir/";
+my $dir = $bot_dir.$wrk_dir;
+
+# dictionnaire contenant les regex permettants de trouver les FAI
+
+my %regex = (
+    # Apinnet
+    "apinnet"      => "\\b(ap[in]|Poitou|Charente|Rochelle|(Deux[- ])?S[èe]vres?|Vienne|Angoul[eêè]me|Niort|Poitiers)",
+    # Aquilenet
+    "aquilenet"    => "\\b(aq(ui|n)|Bord(o|e?au)|Landes|Gironde)",
+    # ARN
+    "arn"          => "\\b(a(lsace|rn)|Stras|Colma)",
+    # Auvernet
+    "auvernet"     => "\\b(Auver|Puy[- ](de[- ])D[oô]me|avn)",
+    # Cafai
+    "cafai"        => "\\b(cafai|champagne|ardenn?e)",
+    # faimaison
+    "faimaison"    => "\\b(fma|fail?m|Nantes|Loire[- ]Atlantique)",
+    # FDN
+    "fdn"          => "\\bf(rench|dn)",
+    # franciliens.net
+    "franciliens"  =>  "\\b(f(ranc|cn)|idf|Paris)",
+    # grifon
+    "grifon"       => "\\b(grif|rennes|[îi]l?le[- ](et[- ])?vilaine)",
+    # ilico
+    "ilico"        => "\\b(ilc|ill?[iy][ck])|(Corr?[éêèe][sz])",
+    # illyse
+    "illyse"       => "\\b(ill?y|ill?i[sz]|lyon|rh[ôo]ne|loire|((st|saint)[- ]etienn?e))",
+    # iloth
+    "iloth"        => "\\b(ilo|mont?pel|h[ée]rault)",
+    # ldn
+    "ldn"          => "\\b(l(or|dn)|Nancy|Metz|Moselle|Meuse|Meurthe|Vosges)",
+    # ndn
+    "ndn"          => "\\b(n(ice|dn)|Antibes|Cannes|Valbonne|Alpes[- ]Maritimes)",
+    # netopi
+    "netopi"       => "\\b(netopi|Seine[- ](et[- ])?Marne)",
+    # pclight
+    "pclight"      => "\\b(yonne|beon|cheny|pc[- ]?l)",
+    # rézine
+    "rezine"       => "\\b(r[eé]z|Isère|Grenoble)",
+    # rhizome
+    "rhizome"      => "\\b(rh?[iy][sz]om|Oise|Compi[eéêè]gne)",
+    # sames
+    "sames"         => "\\bsam|(Pyrénées[- ]Atlantiques)",
+    # sdn
+    "sdn"          => "\\b(s(all|dn)|Savoie|Haute[- ]Savoie)",
+    # teleragno
+    "teleragno"    => "\\b(mars|telerag|telegrano)",
+    # tetaneutral
+    "tetaneutral"  => "\\b(t(eta|tn|nn)|Toulouse|Comminges|(Haute[- ]Garon?ne))",
+    # ail-network
+    "ail"          => "\\bail/",
+    # chaul'hertz
+    "chaul"        => "\\b(c(haul|hz)|hertz|tarn|autan)",
+    # igwan
+    "igwan"        => "\\b(ig[wn]|sbg|saint[- ]barth)",
+    # neutrinet
+    "neutrinet"    => "\\b(neutri|n[tre]n|belgique)",
+    # et le meilleur pour la fin 
+    "ffdn"         => "\\bf(ede|fdn|rance|édé)",
+    );
+
+# Lis le fichier contenant les infos d'un FAI
+sub info {
+    my $fai = shift @_;
+    my $filename = $dir.$fai.".info";
+    if (-e $filename)
+    {
+	my $fh;
+	open ($fh, '<', $filename) or die "Impossible d'ouvrir le fichier $filename en lecture";
+	while (my $line = <$fh>)
+	{
+	    return $line;
+	}
+	close $fh;
+    }
+    else
+    {
+	return "pas d'information pour ". $fai ."\n";
+    }
+}
+
+# Lis le fichier contenant les nombres adh/abo d'un FAI
+sub adh {
+    my $fai = shift @_;
+    my $filename = $dir.$fai.".adh";
+    if (-e $filename)
+    {
+	my $fh;
+	open ($fh, '<', $filename) or die "Impossible d'ouvrir le fichier $filename en lecture";
+	while (my $line = <$fh>)
+	{
+	    return $line;
+	}
+	close $fh;
+    }
+    else
+    {
+	return "pas d'information pour ". $fai ."\n";
+    }
+}
+
+# lis le fichier et retourne le contenu
+sub lecture_fichier {
+    my $fichier;
+    my $filename = $dir.$fichier;
+    if (-e $filename)
+    {
+	my $fh;
+	open ($fh, '<', $filename) or die "Impossible d'ouvrir le fichier $filename en lecture";
+	while (my $line = <$fh>)
+	{
+	    return $line;
+	}
+	close $fh;
+    }
+    else
+    {
+	return "pas d'information pour \n";
+    }
+    
+}
+
+sub adh_abo_ffdn {
+    my $filename = $dir."ffdn.adh";
+    if (-e $filename)
+    {
+	my $fh;
+	open ($fh, '<', $filename) or die "Impossible d'ouvrir le fichier $filename en lecture";
+	while (my $line = <$fh>)
+    {
+	return $line;
+    }
+	close $fh;
+    }
+    else
+    {
+	return "pas d'information\n";
+    }
+    
+}
+
+
+## Le bot lit le chan et réagit
+sub said {
+    my ($self, $message) = @_;
+    # si on veut des info
+    if ($message->{body} =~ /^\+info/) {
+        shift @_;
+
+	# Apinnet
+	if($message->{body} =~ /$regex{"apinnet"}/i) {
+	    info("apinnet");
+#	    return "site : http://www.apinnet.fr/ salon : irc://irc.geeknode.org/#Apinnet dans le  Poitou-Charentes";
+	}	
+	# 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) {
+#    	    return "Pas d'info pour Nice data network";
+	    info("ndn");
+	}
+	# netopi
+	elsif($message->{body} =~ /$regex{"netopi"}/i) {
+	    #return "Netopi = site : http://netopi.fr ; pas de salon ; en Seine et Marne";
+	    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) {
+#	    return"Sallanches Data Network = siteweb : http://sdnet.info/ ; pas de salon ; à Sallanches (73)";
+	    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");
+#	    return "Aïl-network = siteweb : http://ail-network.org/ ; pas de salon ; Tarn Sud-Est (Pays d'Autan)";
+	}
+	# chaul'hertz
+	elsif($message->{body} =~ /$regex{"chaul"}/i) {
+#	    return "Chaul'Hertz = pas de site ni de salon ; Chauley, hameau à St Maurice en Rivière (71)";	
+	    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{"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 : +info <fai> ou +info <lieu geographique>";	
+	}
+    }
+    
+    # si on veut le nombre d'adhérent
+    elsif ($message->{body} =~ /^\+adh/) {
+        shift @_;
+
+	# Apinnet
+	if($message->{body} =~ /$regex{"apinnet"}/i) {
+	    adh("apinnet");
+#	    return "site : http://www.apinnet.fr/ salon : irc://irc.geeknode.org/#Apinnet dans le  Poitou-Charentes";
+	}	
+	# 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) {
+#    	    return "Pas d'adh pour Nice data network";
+	    adh("ndn");
+	}
+	# netopi
+	elsif($message->{body} =~ /$regex{"netopi"}/i) {
+	    #return "Netopi = site : http://netopi.fr ; pas de salon ; en Seine et Marne";
+	    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) {
+#	    return"Sallanches Data Network = siteweb : http://sdnet.adh/ ; pas de salon ; à Sallanches (73)";
+	    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");
+#	    return "Aïl-network = siteweb : http://ail-network.org/ ; pas de salon ; Tarn Sud-Est (Pays d'Autan)";
+	}
+	# chaul'hertz
+	elsif($message->{body} =~ /$regex{"chaul"}/i) {
+#	    return "Chaul'Hertz = pas de site ni de salon ; Chauley, hameau à St Maurice en Rivière (71)";	
+	    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{"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 : +adh <fai> ou +adh <lieu geographique>";	
+    	}
+    }
+
+
+    # si on veut de l'aide
+    elsif ($message->{body} =~ /^\+help/) {
+	return "commandes gérées : +info, +adh, +suivi, +vote, +source";
+#	return "pour les infos +info - pour les nombres d'adhérent·e·s et d'abonné·e·s +adh - pour les informations par rapport aux réunios de suivi +suivi - pour les sources du bot +source - ";
+    }
+    # les sources du bot
+    elsif ($message->{body} =~ /^\+source/) {
+	lecture_fichier("source");
+    }
+    # les infos par rapport aux réunions de suivies
+    elsif ($message->{body} =~ /^\+suivi/) {
+	lecture_fichier("suivi");
+    }
+    # les infos par rapport aux réunions de suivies
+    elsif ($message->{body} =~ /^\+vote/) {
+	lecture_fichier("vote");
+    }
+    elsif ($message->{body} =~ /datafoin/) {
+	my $de = int rand(5);
+	if ($de==1) {
+	    return "il ne faut pas me donner à manger après minuit /o\\";
+	}
+	elsif($de==2){
+	    return "omnomnom";
+	}
+	elsif($de==3){
+	    return "mais je vais grossir /o\\";
+	}
+	elsif($de==4){
+	    return "vouiii";
+	}
+	elsif($de==5){
+	    return "datafoin <3";
+	}
+    }
+}
+
+# tout ce qu'on écrit dans /tmp/log apparait dans $channel
+my $channel = '#ffdn';
+sub connected {
+#    my $channel = shift;
+    my $self = shift;
+    $self->forkit({ channel => $channel,
+                    run     => [ qw( /usr/bin/tail -f /tmp/log ) ],
+		  });
+}
+
+
+# aucune idée de comment on déclenche cette ligne
+sub help { "Je suis le bot de la fédé." }
+
+#Info de connexion du bot
+MyBot->new(
+    server => 'irc.geeknode.org',
+    channels => [ '#bottestbot', '#ffdn'],
+    nick => 'UneFede',
+    username => 'bot',
+    name => 'Droide de la Federation FDN, run by Vigdis'
+    )->run();