首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Eggdrop TCL人工智能在有限的时间内

Eggdrop TCL人工智能在有限的时间内
EN

Stack Overflow用户
提问于 2020-02-26 19:28:41
回答 1查看 261关注 0票数 1

我希望Eggdrop对在最近30分钟内加入频道的用户进行响应。应忽略在该通道上超过30分钟的所有其他用户。

代码语言:javascript
复制
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" } 
 }
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-03-04 15:46:00

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

代码语言:javascript
复制
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)等等。此外,您可能不希望机器人告诉他们,如果他们已经注册。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60412896

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档