- on *:start:{
- ;dès le demarrage du script
- hmake bot 100
- ;on crée la table bot
- hload bot hash-bot.txt
- ;on load la table
- }
-
- on *:TEXT:!settopic*:#:{ if ($nick isop #) {
- ;on attend qu'un op tape !settopic <topic>
- hload bot hash-bot.txt
- ;on crée et on load la table
- if ($hget(bot,$+(topic.,$chan)) == $null) {
- ;si il n'existe pas de topic sauvegader pour se channel
- hadd bot $+(topic.,$chan) $2-
- ;ajoute a la table bot l'item topic.$chan avec la valeur $2-
- hsave -o bot hash-bot.txt
- ;sauvegarde la table bot dans hash-bot.txt
- notice $nick Topic Enregistrée !
- ;envoi une notice
- }
- else {
- ;si un topic existe deja pour ce chan
- hdel bot $+(topic.,$chan)
- ;on le supprime
- hadd bot $+(topic.,$chan) $2-
- ;on rajoute le nouveau
- hsave -o bot hash-bot.txt
- ;on sauvegarde dans hash-bot.txt
- notice $nick Topic Enregistrée !
- ;notice
- }
- }
- }
-
- on *:TEXT:!loadtopic:#:{ if ($nick isop #) {
- ;attend qu'un op tape !loadtopic
- hload bot hash-bot.txt
- ;on crée et on load la table
- if ($hget(bot,$+(topic.,$chan)) != $null) {
- ;si un topic est trouvée pour ce chan dans la base
- topic # $hget(bot,$hmatch(bot,$+(topic.,$chan),1))
- ;on le met
- }
- else {
- ;si aucun topic n'est trouvé
- notice $nick Aucun topic trouvé
- ;on le dit
- }
- }
on *:start:{
;dès le demarrage du script
hmake bot 100
;on crée la table bot
hload bot hash-bot.txt
;on load la table
}
on *:TEXT:!settopic*:#:{ if ($nick isop #) {
;on attend qu'un op tape !settopic <topic>
hload bot hash-bot.txt
;on crée et on load la table
if ($hget(bot,$+(topic.,$chan)) == $null) {
;si il n'existe pas de topic sauvegader pour se channel
hadd bot $+(topic.,$chan) $2-
;ajoute a la table bot l'item topic.$chan avec la valeur $2-
hsave -o bot hash-bot.txt
;sauvegarde la table bot dans hash-bot.txt
notice $nick Topic Enregistrée !
;envoi une notice
}
else {
;si un topic existe deja pour ce chan
hdel bot $+(topic.,$chan)
;on le supprime
hadd bot $+(topic.,$chan) $2-
;on rajoute le nouveau
hsave -o bot hash-bot.txt
;on sauvegarde dans hash-bot.txt
notice $nick Topic Enregistrée !
;notice
}
}
}
on *:TEXT:!loadtopic:#:{ if ($nick isop #) {
;attend qu'un op tape !loadtopic
hload bot hash-bot.txt
;on crée et on load la table
if ($hget(bot,$+(topic.,$chan)) != $null) {
;si un topic est trouvée pour ce chan dans la base
topic # $hget(bot,$hmatch(bot,$+(topic.,$chan),1))
;on le met
}
else {
;si aucun topic n'est trouvé
notice $nick Aucun topic trouvé
;on le dit
}
}