1

我希望 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" } 
 }
4

1 回答 1

0

您可以保存一个包含用户及其加入时间的数组。类似(未经测试):

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]
}

这只是基本的。您可能想要添加检查,例如昵称更改(例如,可能告诉他们将他们的昵称分组到一个帐户下),或重新加入(由于断开连接/网络拆分)等。此外,您可能不希望机器人告诉他们他们是否已经注册。

于 2020-03-04T07:46:00.307 回答