egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Script [Message]
Goto page Previous  1, 2
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
CP1832
Halfop


Joined: 09 Oct 2014
Posts: 45

PostPosted: Tue May 02, 2017 12:52 pm    Post subject: Reply with quote

Sorry but I don't have that much TCL knowledge. Please check other scripts if this one doesn't work.
Back to top
View user's profile Send private message
CP1832
Halfop


Joined: 09 Oct 2014
Posts: 45

PostPosted: Tue May 02, 2017 3:57 pm    Post subject: Reply with quote

CP1832 wrote:
Sorry but I don't have that much TCL knowledge. Please check other scripts if this one doesn't work.
I had forgotten I had the original script (as I made some modifications). Here it is:
Code:
# Hadace messaging (uzeno-eng-win-beta v.1.5 WINDOWS ENGLISH BETA 2005.nov.08) #mfc.cs @ quakenet
# NOTE!!
# you must manualy create an empty file named: h_message.dat into your bot's main directory.
# __        ___       ____  _   ___  __
# \ \      / (_)_ __ / ___|| | | \ \/ /
#  \ \ /\ / /| | '_ \\___ \| | | |\  /
#   \ V  V / | | | | |___) | |_| |/  \
#    \_/\_/  |_|_| |_|____/ \___//_/\_\ 
# my TCL scripts are avaiable here:
# http://mazsola.linuxteam.hu/tcl/
# WARNING !
# in this version user rights are not correct!
# it must be corrected!
bind pub - "!msg" mess_do
bind pub - "!messages" mess_lista
bind pubm - * mess_join
bind time - "20 * * * *" mess_sort
bind pub - "!messaging" mess_info
bind msg - "!msg" mess_do_inmsg

#bind pub v|o "!msg" mess_do
#bind pub o|o "!messages" mess_lista
#bind pubm - * mess_join
#bind time - "20 * * * *" mess_sort
#bind pub v|o "!messaging" mess_info
#bind msg v|o "!msg" mess_do_inmsg

set message_db "h_message.dat"
set message_whodid ""

proc mess_info {nick host hand chan arg} {
   puthelp "PRIVMSG $chan :Hadace messaging (uzeno-eng-win-beta v.1.5 2005.dec.03)"
   puthelp "PRIVMSG $chan :Recepients list: !messages"
   puthelp "PRIVMSG $chan :Leaving message: !msg <nick> <message>"
   puthelp "PRIVMSG $chan :This info: !messaging"
}

proc mess_sort {a c d e f} {
   global message_db
   set t_count [clock clicks -milliseconds]
   set filemuvelet [open $message_db r]
   set osszesuzenet ""
   while {![eof $filemuvelet]} {
      set konkretuzenet [gets $filemuvelet]
      if {[info exists konkretuzenet]&&$konkretuzenet!=""} {
         lappend osszesuzenet [split $konkretuzenet " "]
      }
   }
   close $filemuvelet
   set osszesuzenet [lsort -index 1 $osszesuzenet]
   set filemuvelet [open $message_db w]
   foreach konkretuzenet $osszesuzenet {
      puts $filemuvelet [join $konkretuzenet " "]
   }
   close $filemuvelet
   putlog "!message Done with sorting of data on the database ($message_db)->[expr double([clock clicks -milliseconds]-$t_count)/1000]s"
}
proc mess_do_inmsg {nick uhost hand rest} {
global botnick
putlog "mess_do_inmsg: $rest"
   set rest [split $rest " "]
   set cimzett [lindex $rest 0]
   if {$cimzett == ""} {
      puthelp "NOTICE $nick :The right format: /msg $botnick !msg <nick> <message>"
   } else {
      mess_write $nick $cimzett [lrange $rest 1 end] "MSG"
      puthelp "NOTICE $nick :Message for $cimzett accepted"
   }
}
proc mess_do {nick host hand chan args} {
   putlog "mess_do indul"
   set args [lindex $args 0]
   set args [split $args " "]
   set cimzett [lindex $args 0]
   if {$cimzett == ""} {
      puthelp "NOTICE $nick :The right format: !msg <nick> <message>"
   } else {
      if {[onchan $cimzett $chan]} {
         set mwhom $cimzett
         set mmoo [finduser "*![getchanhost $mwhom $chan]"]
         if {[validuser $mmoo]} {
            set cimzett $mmoo
            #putlog "uj uzenet $cimzett botuser szamara"
         } else {
            #putlog "uj uzenet $cimzett nick szamara"
         }
      }
      mess_write $nick $cimzett [lrange $args 1 end] $chan
      puthelp "NOTICE $nick :Message for $cimzett accepted"
   }
}

proc mess_write { nick cimzett uzenet csatorna } {
   global message_db
   set cimzett [string tolower $cimzett]
   if {![file exists $message_db]} {
      file mkdir [lindex [split $message_db /] 0]
      set filemuvelet [open $message_db w+]
      puts $filemuvelet "Hadace !messaging database file created"
   } else {
      set filemuvelet [open $message_db a]
   }
   set systemTime [clock seconds]
   set ido [clock format $systemTime -format {%d.%m.%Y. %H.%M:}]
   puts $filemuvelet "$nick $cimzett $csatorna $ido [join $uzenet] "
   close $filemuvelet
}

#####################
proc mess_join { nick uhost hand chan args } {
   #puthelp "NOTICE HeyBaby : $nick $uhost $hand $chan $args"
   if {$hand != "*"} {
      set explain [string tolower $hand]
   } else {
      set explain [string tolower $nick]
   }
   global message_db message_whodid
   if {![info exists message_whodid]} {
      set message_whodid ""
   }
   set nick [string tolower $nick]
   set filemuvelet [open $message_db r]
   set osszesuzenet ""
   while {![eof $filemuvelet]} {
      gets $filemuvelet konkretuzenet
      set konkretuzenet [split $konkretuzenet " "]
      if {[string equal -nocase [lindex $konkretuzenet 1] $explain]} {
         lappend osszesuzenet [join $konkretuzenet " "]
      }
   }
   close $filemuvelet
   set count 0
   if {[llength $osszesuzenet]==1} {
      set uzente [split [lindex $osszesuzenet 0] " "]
      puthelp "PRIVMSG $nick :[lindex $uzente 0] says at [join [lrange [split [lindex $osszesuzenet 0] " "] 2 end]]"
      incr count
   } else {
      foreach konkretuzenet $osszesuzenet {
         incr count
         puthelp "PRIVMSG $nick :[lindex $konkretuzenet 0]\[${count}] says at [join [lrange [split $konkretuzenet " "] 2 end]]"
      }
   }
   if {$count == 0} {
   } else {
      lappend message_whodid [list $explain [string tolower $chan]]
      set explain [message_filterstr $explain]   ;# Don't allow code to be executed
      set chan [message_filterstr $chan]   ;# ensure []s are properly handled...
      mess_delete $explain
   }
}
###############################################x
proc message_filterstr { data } {
   regsub -all -- \\\\ $data \\\\\\\\ data
   regsub -all -- \\\[ $data \\\\\[ data   
   regsub -all -- \\\] $data \\\\\] data
   regsub -all -- \\\} $data \\\\\} data
   regsub -all -- \\\{ $data \\\\\{ data
   regsub -all -- \\\" $data \\\\\" data
   return $data
}

proc mess_delete { cimzett {remnum "all"}} {
   global message_db
   set cimzett [string tolower $cimzett]
   set filemuvelet [open $message_db r]
   set osszesuzenet ""
   set count 1
   if {$remnum == "all"} {
      while {![eof $filemuvelet]} {
         gets $filemuvelet konkretuzenet
         if {![string equal -nocase [lindex [split $konkretuzenet] 1] $cimzett]} {
            lappend osszesuzenet $konkretuzenet
         }
      }
   } else {
      while {![eof $filemuvelet]} {
         gets $filemuvelet konkretuzenet
         if {![string equal -nocase [lindex [split $konkretuzenet] 1] $cimzett] || ($count != $remnum && $remnum != -2)} {
            if {[info exists konkretuzenet]&&$konkretuzenet!=""} {
               lappend osszesuzenet $konkretuzenet
            }
            if {[string equal -nocase [lindex [split $konkretuzenet] 1] $cimzett]} {
            incr count
            }
         } else {
            incr count
         }
      }
   }
   close $filemuvelet
   set filemuvelet [open $message_db w]
   foreach konkretuzenet $osszesuzenet {
      puts $filemuvelet $konkretuzenet
   }
   close $filemuvelet
}

proc mess_lista {nick host hand chan args} {
   global message_db
   putserv "NOTICE $nick :\[ Recepients list \]"
   set lista ""
   set filemuvelet [open $message_db r]
   while {![eof $filemuvelet]} {
      lappend lista [lindex [split [gets $filemuvelet] " "] 1]
   }
   close $filemuvelet
   foreach {a b c d e f g} [lsort -unique $lista] {
      putserv "NOTICE $nick :Recepients: $a $b $c $d $e $f $g"
   }
   putserv "NOTICE $nick :\[ end of the list \]"
}
putlog "Hadace messaging (uzeno.tcl v.1.5 ENG 2005.nov.08) #mfc.cs @ quakenet loaded"
Back to top
View user's profile Send private message
Fahad
Halfop


Joined: 29 Aug 2016
Posts: 99

PostPosted: Wed May 03, 2017 4:59 am    Post subject: Reply with quote

I even install it in my new eggdrop and I created "h_message.dat" in my bot main dictionary and "messages.txt" I create manually it was not created auto

<MuteServ> [08:49:33] Tcl error [mess_join]: invalid command name " "
<MuteServ> [08:49:33] Tcl error [mess_do]: invalid command name " "

Please check http://picpaste.com/2017-04-29-ayKxULYG.png
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber