我希望Eggdrop对在最近30分钟内加入频道的用户进行响应。应忽略在该通道上超过30分钟的所有其他用户。
set canalativo "#testes"
bind pubm - "*regist*canal*" pub:regchan
proc pub:regchan { nick uhost handle chan arg } {
global canalativo
if {[string match -nocase "$canalativo" $chan]} {
putserv "PRIVMSG $chan :$nick para registar um canal escreve o comando: /ChanServ register #CANAL DESCRICAO-DO-CANAL" }
}发布于 2020-03-04 15:46:00
您可以保存一个包含用户及其加入时间的数组。类似于(未测试的):
set canalativo "#testes"
array set joinedUsers {}
bind pubm - "*regist*canal*" pub:regchan
bind join - "*!*@*" pub:joinchan
proc pub:regchan { nick uhost handle chan arg } {
global canalativo joinedUsers
# Check if - this is the correct channel
# - the user is in the array of joined users
# - the time the user joined is 1800 seconds ago or less
if {
[string match -nocase "$canalativo" $chan] &&
[info exists joinedUsers($nick)] &&
[clock seconds]-$joinedUsers($nick) <= 1800
} {
putserv "PRIVMSG $chan :$nick para registar um canal escreve o comando: /ChanServ register #CANAL DESCRICAO-DO-CANAL"
}
# Remove the user from the array if it is there
catch {unset joinedUsers($nick)}
}
proc pub:joinchan { nick uhost handle chan } {
global joinedUsers
# Add the user and the time they joined to the array
set joinedUsers($nick) [clock seconds]
}这只是最基本的。你可能想要添加一些检查,比如nick changes (也许可以告诉他们关于将他们的nick分组到一个帐户下),或者重新加入(由于断开/netsplits)等等。此外,您可能不希望机器人告诉他们,如果他们已经注册。
https://stackoverflow.com/questions/60412896
复制相似问题