BT.Loader.tcl 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #########################################################################
  2. ## BlackTools - The Ultimate Channel Control Script ##
  3. ## One TCL. One smart Eggdrop ##
  4. #########################################################################
  5. ########################## LOADER TCL ###############################
  6. #########################################################################
  7. ## ##
  8. ## BlackTools : http://blacktools.tclscripts.net ##
  9. ## Bugs report : http://www.tclscripts.net/ ##
  10. ## GitHub page : https://github.com/tclscripts/BlackToolS-TCL ##
  11. ## Online Help : irc://irc.undernet.org/tcl-help ##
  12. ## #TCL-HELP / UnderNet ##
  13. ## You can ask in english or romanian ##
  14. ## ##
  15. #########################################################################
  16. if {[info exists black(backup_update)]} {
  17. set black(backdir) $black(backup_dir)
  18. } else {
  19. set black(backdir) $black(dirname)
  20. }
  21. if {[info exists black(update_disabled)]} {
  22. unset black(update_disabled)
  23. }
  24. #Load modules
  25. set modules_files [glob -directory "$black(backdir)/BlackTools/Modules/" "*.tcl"]
  26. foreach file $modules_files {
  27. set split_file [split $file "."]
  28. set themodule [lindex $split_file 1]
  29. set black(module_error_$themodule) [catch {source $file} black(module_error_stats_$themodule)]
  30. if {$black(module_error_$themodule) == "1"} {
  31. if {$themodule == "AutoUpdate"} {
  32. putlog "\[BT\] :Couldn't load the AutoUpdate module. Reason: $black(module_error_stats_$themodule)."
  33. set black(update_disabled) $black(module_error_stats_$themodule)
  34. continue
  35. }
  36. die "\[BT\] :Couldn't load the module file \"$file\".Reason: \"$black(module_error_stats_$themodule)\""
  37. }
  38. }
  39. #Load cmds
  40. set cmds_files [glob -directory "$black(backdir)/BlackTools/Commands/" "*.tcl"]
  41. foreach file $cmds_files {
  42. set split_file [split $file "."]
  43. set themodule [lindex $split_file 1]
  44. set black(cmds_error_$themodule) [catch {source $file} black(cmds_error_stats_$themodule)]
  45. if {$black(cmds_error_$themodule) == "1"} {
  46. die "\[BT\] :Couldn't load the cmds file \"$file\".Reason: \"$black(cmds_error_stats_$themodule)\""
  47. }
  48. }
  49. #Load protections
  50. set prot_files [glob -directory "$black(backdir)/BlackTools/Protections/" "*.tcl"]
  51. foreach file $prot_files {
  52. set split_file [split $file "."]
  53. set themodule [lindex $split_file 1]
  54. set black(prot_error_$themodule) [catch {source $file} black(prot_error_stats_$themodule)]
  55. if {$black(prot_error_$themodule) == "1"} {
  56. die "\[BT\] :Couldn't load the prot. file \"$file\".Reason: \"$black(prot_error_stats_$themodule)\""
  57. }
  58. }
  59. #Load script files
  60. set black(timers_error) [catch {source $black(backdir)/BlackTools/BT.Timers.tcl} black(timers_error_stats)]
  61. set black(binds_error) [catch {source $black(backdir)/BlackTools/BT.Binds.tcl} black(binds_error_stats)]
  62. set black(ban_error) [catch {source $black(backdir)/BlackTools/BT.Ban.tcl} black(ban_error_stats)]
  63. set black(core_error) [catch {source $black(backdir)/BlackTools/BT.Core.tcl} black(core_error_stats)]
  64. set black(loader_error) [catch {source $black(backdir)/BlackTools/lang/loader.tcl} black(loader_error_stats)]
  65. #Check for errors in script files
  66. if {$black(timers_error) == "1"} {
  67. die "\[BT\] Error. Couldn't load the \"BT Timers\". Reason: \"$black(timers_error_stats)\""
  68. }
  69. if {$black(binds_error) == "1"} {
  70. die "\[BT\] Error. Couldn't load the \"BT Binds\". Reason: \"$black(binds_error_stats)\""
  71. }
  72. if {$black(core_error) == "1"} {
  73. die "\[BT\] Error. Couldn't load the \"BT Core\". Reason: \"$black(core_error_stats)\""
  74. }
  75. if {$black(ban_error) == "1"} {
  76. die "\[BT\] Error. Couldn't load the \"BT Ban\". Reason: \"$black(ban_error_stats)\""
  77. }
  78. if {$black(loader_error) == "1"} {
  79. die "\[BT\] Error. Couldn't load the \"BT Language\". Reason: \"$black(loader_error_stats)\""
  80. }
  81. #################
  82. ###########################################################################
  83. ## END ##
  84. ###########################################################################