Scripting 在此Tlc脚本中要进行的一些更改

Scripting 在此Tlc脚本中要进行的一些更改,scripting,tcl,eggdrop,Scripting,Tcl,Eggdrop,现在脚本工作得很好,但需要更改命令并删除通道名,当我在exemp.txt文件列表中添加IP时, 有人可以在此提供帮助,如何提前更改此公共通信和thx !exemp help change in !help !exemp list change in !list !exemp del 1 change in !del 75.34.37.12 75.34.37.* 75.34.* !exemp add change in !add 75.34.37.12 75.34.37.* 75.34.*

现在脚本工作得很好,但需要更改命令并删除通道名,当我在exemp.txt文件列表中添加IP时, 有人可以在此提供帮助,如何提前更改此公共通信和thx

!exemp help change in !help
!exemp list change in !list
!exemp del 1 change in !del 75.34.37.12  75.34.37.* 75.34.*
!exemp add change in !add 75.34.37.12 75.34.37.*  75.34.*
在exemp.txt列表中添加Ip时删除名称通道 只添加IP cozz,并在exemp.txt文件中添加带有IP的频道名称

#Test 75.34.37.12 

先谢谢你

proc check_ip {ip} {
   set file [open "exemp.txt" r]
   set fdata [split [read $file] \n]
   close $file
   foreach entry $fdata {
      if {[string match $entry $ip]} {
         return 1
      }
   }
   return 0
}

bind pub n|n !exemp  exemp:cmd

set exemp(file) "exemp.txt"

if {![file exists $exemp(file)]} {
   set file [open $exemp(file) w]
   close $file
}

proc exemp:cmd {nick host hand chan arg} {
   global exemp

   set arg0 [lindex [split $arg] 0]
   set arg1 [lindex [split $arg] 1]
if {$arg0 == ""} {
   putserv "NOTICE $nick :EXEMP Use: \002!exemp help\002 for more informations."
   return
}
switch $arg0 {
   add {
if {$arg1 == ""} {
   putserv "NOTICE $nick :EXEMP Use: \002!exemp help\002 for more informations."
   return
}
   set file [open $exemp(file) a]
   puts $file "$chan $arg1"
   close $file
   putserv "NOTICE $nick :EXEMP I added\002 $arg1 \002in my ExempList."
   }

   list {
   set file [open $exemp(file) "r"]
   set read [read -nonewline $file]
   close $file
   set data [split $read "\n"]
   set i 0
if {$data == ""} {
   putserv "NOTICE $nick :EXEMP There are\002 no IP \002added to ExempList."
   return
}
   putserv "NOTICE $nick :EXEMP The list of IP added in my ExempList."
foreach line $data {
   set read_chan [lindex [split $line] 0]
if {[string match -nocase $read_chan $chan]} {
   set i [expr $i +1]
   set read_blackchan [lindex [split $line] 1]
   putserv "NOTICE $nick :$i.) $read_blackchan"
         }
      }
   }


   del {
   array set exempdel [list]
if {![regexp {.*?(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}).*?\((.*?)\)} $arg1]} {
   putserv "NOTICE $nick :EXEMP Use: \002!exemp help\002 for more informations."
   return
}


set file [open $exemp(file) "r"]
   set data [read -nonewline $file]
   close $file
   set lines [split $data "\n"]
   set counter -1
   set line_counter -1
   set current_place -1
foreach line $lines {
   set line_counter [expr $line_counter + 1]
   set read_chan [lindex [split $line] 0]
if {[string match -nocase $read_chan $chan]} {
   set counter [expr $counter + 1]
   set exempdel($counter) $line_counter
   }
}

foreach place [array names exempdel] {
   if {$place == [expr $arg1 - 1]} {
   set current_place $exempdel($place)
   }
}

if {$current_place == "-1"} {
   putserv "NOTICE $nick :EXEMP The entry number\002 $arg1 \002does not exist."   
   return   
}

   set delete [lreplace $lines $current_place $current_place]
   set files [open $exemp(file) "w"]
   puts $files [join $delete "\n"]
   close $files
   set file [open $exemp(file) "r"]
   set data [read -nonewline $file]
   close $file
if {$data == ""} {
   set files [open $exemp(file) "w"]
   close $files
}
   putserv "NOTICE $nick :EXEMP The entry number\002 $arg1 \002was removed from ExempList."

   }

   help {
   putserv "NOTICE $nick :EXEMP You can add IP using: \002!exemp add <IP>\002 "
   putserv "NOTICE $nick :EXEMP To see all the IP in ExempList use:\002 !exemp list\002"
   putserv "NOTICE $nick :EXEMP To delete a IP use:\002 !exemp del <number>\002 (from the ExempList)"
      }
   }
} 

proc check_ip{ip}{
设置文件[打开“exemp.txt”r]
设置fdata[split[读取$file]\n]
关闭$file
foreach条目$fdata{
如果{[string match$entry$ip]}{
返回1
}
}
返回0
}
绑定酒吧n | n!exemp exemp:cmd
设置exemp(文件)“exemp.txt”
如果{![文件存在$exemp(文件)]}{
设置文件[打开$exemp(文件)w]
关闭$file
}
proc exemp:cmd{nick host hand chan arg}{
全球exemp
设置arg0[lindex[split$arg]0]
设置arg1[lindex[split$arg]1]
如果{$arg0==“”}{
putserv“注意$nick:EXEMP使用:\002!EXEMP help\002了解更多信息。”
返回
}
开关$arg0{
加{
如果{$arg1==“”}{
putserv“注意$nick:EXEMP使用:\002!EXEMP help\002了解更多信息。”
返回
}
设置文件[打开$exemp(文件)a]
放入$file“$chan$arg1”
关闭$file
putserv“注意$nick:EXEMP我在示例列表中添加了\002$arg1\002i。”
}
名单{
设置文件[打开$exemp(文件)“r”]
设置读取[读取-非WLINE$文件]
关闭$file
设置数据[拆分$read“\n”]
设置i 0
如果{$data==“”}{
putserv“注意$nick:EXEMP示例列表中没有\002 IP\002added。”
返回
}
putserv“注意$nick:EXEMP在我的示例列表中添加的IP列表。”
foreach行$data{
设置read_chan[lindex[split$line]0]
如果{[string match-nocase$read_chan$chan]}{
集合i[expr$i+1]
设置为read_blackchan[lindex[split$line]1]
putserv“通知$nick:$i.)$read_blackchan”
}
}
}
德尔{
数组集exempdel[列表]
如果{![regexp{.*?(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}.*?\(.*?)}$arg1]}{
putserv“注意$nick:EXEMP使用:\002!EXEMP help\002了解更多信息。”
返回
}
设置文件[打开$exemp(文件)“r”]
设置数据[读取-非WLINE$文件]
关闭$file
设置行[拆分$data”\n“]
设置计数器-1
设置行_计数器-1
将当前位置设置为-1
每行$行{
设置行计数器[expr$行计数器+1]
设置read_chan[lindex[split$line]0]
如果{[string match-nocase$read_chan$chan]}{
设置计数器[expr$计数器+1]
设置exempdel($counter)$line\U计数器
}
}
foreach place[数组名exempdel]{
如果{$place==[expr$arg1-1]}{
设置当前位置$exempdel($place)
}
}
如果{$current_place==“-1”}{
putserv“注意$nick:EXEMP条目号\002$arg1\002does不存在。”
返回
}
设置删除[lreplace$行$当前位置$当前位置]
设置文件[打开$exemp(文件)“w”]
放入$files[加入$delete“\n”]
关闭$文件
设置文件[打开$exemp(文件)“r”]
设置数据[读取-非WLINE$文件]
关闭$file
如果{$data==“”}{
设置文件[打开$exemp(文件)“w”]
关闭$文件
}
putserv“注意$nick:EXEMP条目号\002$arg1\002已从示例列表中删除。”
}
帮助{
putserv“注意$nick:EXEMP您可以使用:\002!EXEMP add\002添加IP”
putserv“注意$nick:EXEMP以查看示例列表中的所有IP使用:\002!EXEMP list\002”
putserv“注意$nick:EXEMP删除IP使用:\002!EXEMP del\002(来自示例列表)”
}
}
} 
现在工作怎么样


<BoB> !exemp add 75.34.37.12
TestBot EXEMP I added 75.34.37.12 in my ExempList.
<BoB> !exemp list
TestBot EXEMP The list of IP added in my ExempList.
TestBot 1.) 75.34.37.12
<BoB> !exemp del 1
TestBot EXEMP The entry number 1 was removed from ExempList.
<BoB> !exemp list
TestBot EXEMP There are no  IP added to ExempList.
<BoB> !exemp del 75.34.37.12
 TestBot EXEMP Use: !exemp help for more informations.
 <BoB> !exemp help
 TestBot EXEMP You can add IP using: !exemp add <IP>
 TestBot EXEMP To see all the IP in ExempList use: !exemp list
 TestBot- EXEMP To delete a IP use: !exemp del <number> (from the ExempList}


!exemp添加75.34.37.12
TestBot示例我在示例列表中添加了75.34.37.12。
!exemp列表
TestBot EXEMP在我的示例列表中添加的IP列表。
测试机器人1.)75.34.37.12
!1号行政长官
TestBot EXEMP已从示例列表中删除条目号1。
!exemp列表
TestBot EXEMP示例列表中没有添加IP。
!exemp del 75.34.37.12
TestBot EXEMP用法:!exemp帮助以获取更多信息。
!exemp帮助
TestBot EXEMP您可以使用添加IP:!exemp添加
TestBot EXEMP查看示例列表中的所有IP使用:!exemp列表
TestBot-EXEMP删除IP使用:!exemp del(来自ExempList}

Hello Elvis。欢迎来到Stackoverflow。您的问题不太清楚。您可以添加更多关于您正在尝试做的事情、问题以及您尝试过的内容的信息吗?我现在将此代码设置为可用,但在添加IP时需要删除频道名称,并删除与添加IP相同的IP,但文件上没有项目编号,并更改公共c奥曼,谢谢