Communauté Eggdrop
topic - Version imprimable

+- Communauté Eggdrop (https://forum.eggdrop.fr)
+-- Forum : Eggdrop et TCL (https://forum.eggdrop.fr/forumdisplay.php?fid=8)
+--- Forum : Scripts TCL (https://forum.eggdrop.fr/forumdisplay.php?fid=4)
+--- Sujet : topic (/showthread.php?tid=488)

Pages : 1 2


topic - bewess - 21/08/2009

Bonjour

je recherche un tcl qui remettrais le topic défini par mon bot , lors des rehash des bot ircop du serveur orange.
afin d'eviter d'aller sur la page d'accueil etc etc

par avance merci


RE: topic - bewess - 27/08/2009

Bonjour

Je viens de trouver le tcl randomtopic.tcl dans la partie telechargement, j'aimerais savoir si s'etait possible qu'il mette en topic une quote toute les x heures qu'il irait cherchait dans le dossier quote.tcl par exemple plutot que des phrases pre-defini

Par avance merci de votre aide


RE: topic - fedora - 27/08/2009

pk ne pas prendre directement un tcl de quote aléatoire et modifié simple le putserv "PRIVMSG $chan ...." par Putserv "TOPIC ... " non ?


RE: topic - bewess - 14/09/2009

bonjour

Très bonne idée fedora mais se serait au niveau du timer que cela me bloque ...

Bonne journée


RE: topic - fedora - 14/09/2009

montre nous le TCL de quote aléatoire et ont regardera ce qu'ont peut faire pour le timer qui pose souci Smile


RE: topic - bewess - 14/09/2009

Voici le tcl de quote ci joint.
C'est celui dont je me sert actuellement, ( que j'ai d'ailleurs dl ici :p ) si on pouvais y inclure que toutes les x heures il met une quote en topic se serait pas mal ( si cela est possible bien entendu )

merci Smile


RE: topic - fedora - 14/09/2009

essaye ce TCL stp pour voir.aparament il changerais le topic tous les X minutes ça peut etre pas mal dans ce que tu voudrais.

TCL
# tcl.randtopic
# based on tcl.topic by Brian_C
#
# 02-08-96 cmw!cmwagner@gate.net Added random_topic array, to allow random
#                                topics to be set every hour.
# 03-02-96 cmw!cmwagner@gate.net Added load/write/add/delete/show routines,
#                                to allow masters to remotely maintain the
#                                topics list
# 03-04-96 cmw!cmwagner@gate.net Added set command and added help command.
# 03-06-96 cmw!cmwagner@gate.net Added refresh command.

# topic file
# set topicfile "topics"

# topic refresh time, in minutes
set topic_refresh_rate 30
 
bind msg - topic msg_topic
 
proc set_topic {} {
  global channel random_topic topics_changed topic_refresh_rate
 
  if {$topics_changed == 1} {
     putlog "Writing topics file..."
     topic_write
  }
 
  set topic [lindex $random_topic [rand [llength $random_topic]]]
  putserv "TOPIC $channel :$topic"
  timer $topic_refresh_rate set_topic
}
 
proc sync_topic {} {
  set time_ending [string range [time] 2 4]
  if { $time_ending == ":00" } {
    set_topic
  } {
    timer 1 sync_topic
  }
}
 
proc topic_show {nick uhost hand arg} {
  global channel random_topic botnick
 
  putserv "NOTICE $nick :Topics for \002$channel\002:"
 
  set ctr 0
  foreach i $random_topic {
     incr ctr 1
     putserv "NOTICE $nick :\002${ctr}.\002  $i"
  }
  putserv "PRIVMSG $nick :---- \002end\002 ----"
  if {$hand != "*" && [matchattr $hand m]} {
     putserv "PRIVMSG $nick :To add a topic type \002/msg $botnick TOPIC HELP\002 for help."
  }
 
  return 1
}
 
proc topic_add {nick uhost hand arg} {
  global channel random_topic topics_changed
 
  if {![matchattr $hand m]} {
     putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
     return 0
  }
 
  if {[lindex $arg 1] == ""} {
     putserv "PRIVMSG $nick :Usage: TOPIC ADD <new topic>"
     return 0
  }
 
  putserv "PRIVMSG $nick :Topic list has been updated, thanks."
  putserv "PRIVMSG $nick :[lrange $arg 1 end]"
  lappend random_topic [lrange $arg 1 end]
  set topics_changed 1
 
  return 1
}
 
proc topic_erase {nick uhost hand arg} {
  global random_topic topics_changed
 
  if {![matchattr $hand m]} {
     putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
     return 0
  }
 
  if {[lindex $arg 1] == ""} {
     putserv "PRIVMSG $nick :Usage: TOPIC DEL <topic#>"
     return 0
  }
 
  set i [expr [lindex $arg 1] - 1]
  if {$i >=0 && [lindex $random_topic $i] != ""} {
     putserv "PRIVMSG $nick :Entry [lindex $arg 1] erased."
     putserv "PRIVMSG $nick :[lindex $random_topic $i]"
     set random_topic [lreplace $random_topic $i $i]
     set topics_changed 1
     return 1
  } {
     putserv "PRIVMSG $nick :That number is out of range!"
     return 0
  }
}
 
proc topic_set {nick uhost hand arg} {
  global channel random_topic
 
  if {![matchattr $hand m]} {
     putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
     return 0
  }
 
  if {[lindex $arg 1] == ""} {
     putserv "PRIVMSG $nick :Usage: TOPIC SET <topic#>"
     return 0
  }
 
  set i [expr [lindex $arg 1] - 1]
  if {$i >=0 && [lindex $random_topic $i] != ""} {
     putserv "PRIVMSG $nick :Setting current topic to entry [lindex $arg 1]."
     putserv "TOPIC $channel :[lindex $random_topic $i]"
     return 1
  } {
     putserv "PRIVMSG $nick :That number is out of range!"
     return 0
  }
}
 
proc topic_refresh {nick uhost hand arg} {
   global topic_refresh_rate
 
  if {![matchattr $hand m]} {
     putserv "PRIVMSG $nick :Sorry, you are not authorized to use this command."
     return 0
  }
 
  if {[lindex $arg 1] == ""} {
     putserv "PRIVMSG $nick :Usage: TOPIC REF <minutes>"
     return 0
  }
 
  set i [lindex $arg 1]
  if {$i < 30 || $i > 240} {
     putserv "PRIVMSG $nick :Refresh rate must be 30 - 240 minutes."
     return 0
  } {
     set topic_refresh_rate $i
     putserv "PRIVMSG $nick :Refresh rate has been changed to \002$topic_refresh_rate\002 minutes, this change"
     putserv "PRIVMSG $nick :will be effective after the next topic change."
     return 1
  }
}
 
proc topic_help {nick uhost hand arg} {
  putserv "PRIVMSG $nick :Usage: TOPIC                  - show topics"
  if {[matchattr $hand m]} {
    putserv "PRIVMSG $nick :       TOPIC ADD <new topic>  - add topic entry"
    putserv "PRIVMSG $nick :       TOPIC DEL <topic#>     - delete topic entry"
    putserv "PRIVMSG $nick :       TOPIC SET <topic#>     - set current topic to topic#"
    putserv "PRIVMSG $nick :       TOPIC REF <minutes>    - change topic refresh rate"
  }
 
  return 1
}
 
proc topic_load {} {
   global random_topic topicfile
 
   set random_topic ""
   set fd [open $topicfile r]
   while {![eof $fd]} {
      set inp [gets $fd]
      if {[eof $fd]} {break}
      if {[string trim $inp " "] == ""} {continue}
      lappend random_topic [lrange $inp 0 end]
   }
   close $fd
 
   return 1
}
 
proc topic_write {} {
   global topicfile random_topic topics_changed
 
   set fd [open $topicfile w]
   foreach i $random_topic {
      puts $fd "$i"
   }
   close $fd
 
   set topics_changed 0
   return 1
}
 
 
proc msg_topic {nick uhost hand arg} {
  switch [string tolower [lindex $arg 0]] {
    "add"       {set r [topic_add $nick $uhost $hand $arg]}
    "del"	{set r [topic_erase $nick $uhost $hand $arg]}
    "delete"	{set r [topic_erase $nick $uhost $hand $arg]}
    "set"	{set r [topic_set $nick $uhost $hand $arg]}
    "ref"	{set r [topic_refresh $nick $uhost $hand $arg]}
    "refresh"	{set r [topic_refresh $nick $uhost $hand $arg]}
    "help"	{set r [topic_help $nick $uhost $hand $arg]}
    default     {set r [topic_show $nick $uhost $hand $arg]}
  }
  return $r
}
 
if {![info exists set_topic_running] && ![info exists random_topic]} {
  sync_topic
  set set_topic_running 1
}
 
set topics_changed 0
 
topic_load



par contre je te garantit pas qu'il n'y à pas des beug hein! je peut pas tester le TCL ,donc à toi de corriger si y en a, ou nous remontrer les erreurs.

cordialement


RE: topic - bewess - 14/09/2009

Merci fedora Smile

En faite j'avais trouver un tcl dans la partie du telechargement qui avait l'air sympa, mais ce que je voulais en fait c'est qu'il me sorte aléatoirement en topic les quotes qui sont enregistrer dans un fichier.
Après de la a savoir si c'est possible ... Sad


RE: topic - fedora - 14/09/2009

bah si tu lis le TCL tu verra qu'il enregistre topic ds un fichier donc il est fort possible que tu puisse y mettre des quotes dedans.à savoir que dans un topic le nombres de caractère et limiter Smile donc vois aussi cela.


RE: topic - bewess - 22/09/2009

bonjour
Merci fedora pour ce tcl
Apres avoir essayer le tcl il me sors cette erreur en pl :
Tcl error: can't read "topicfile": no such variable


Bonne journée


RE: topic - fedora - 22/09/2009

bonjour,
A tu lus le TCL ?

ensuite à tu essayer de dé commenter cette ligne ?

Citation :# topic file
# set topicfile "topics"

ps: essayer SVP de lire le TCL et de comprendre l'erreur s'il y a . Smile


RE: topic - bewess - 22/09/2009

Oui j'ai decommenter ces ligne il me sortais en erreur
Tcl error: can't read "topic": no such variable


RE: topic - fedora - 22/09/2009

normal que tu est cette erreur cet ligne là n'est pas à décommenter

Citation :# topic file



RE: topic - bewess - 22/09/2009

Quand il me sors l'erreur, c'est pas décommenter.
Il me l'a sors pas quand c'est décommenter.


RE: topic - fedora - 22/09/2009

utilise alors celui ci que j'ai tester et qui fonctionne très bien. tu ajoute le topic que tu veut puis toutes le X minute que toi tu aura définie il changera le topic !! j'ai tester et aucune erreur en pl ect ... il fonctionne parfaitement ! tu peut aussi choisir sur quel salon tu veut que le topic soit changer ect ... mais là je te laisse lire le TCL
je joint le TCL :

cordialement