我正在尝试为 Adium 编写一个简单的聊天机器人,它将发布“哈哈”和“哈哈”,并回答一些人不断将我添加到的烦人的群聊中的基本问题。

我已经用一些简单的发送和延迟命令重复介绍了“lol”部分,但我还需要进行一些交互。
对任何带有问号的问题回答“是”,例如......

不管你是否相信我,这样一个简单的机器人就能通过这些对话的图灵测试。

打开 Adium 字典并没有显示任何明显的获取消息的方式,Growl 字典也没有。

我确实发现我可以在每次收到消息时运行脚本,有没有办法访问发送的消息?

Adium 偏好 http://media.ruk.ca/images/adiumpreferences.png

我的代码:

tell application "Adium"
    activate
    set theChat to the active chat
    send theChat message "Hi"
    delay 5
    send theChat message "How's life?"
    delay 10
    repeat 10 times
        send theChat message "Realy?"
        delay 5
        send theChat message "Lol :P"
        delay 15
        send theChat message "Haha XD"
        delay 15
        send theChat message "Yes1!!1"
        delay 20
        send theChat message "I like it! :D"
        delay 10
    end repeat
    send theChat message "Bye!"
    tell theChat to close
end tell
有帮助吗?

解决方案

您可以通过管道使用管事件的脚本现在

其他提示

根据对当前 Adium 源代码的审查以及对 Adium bug 跟踪器和 wiki 中当前和过去项目的搜索(其中包含“applescript”和“message”作为子字符串),当在 Adium 1.0 中仅使用 AppleScript 时,这似乎是不可能的到 1.3.10(撰写本文时最新)。在 Adium 0.89.1 中,使用普通的 AppleScript 似乎就可以做到这一点,但志愿者开发人员还不相信重新添加此功能值得付出努力。

现在要访问 AppleScript 中的消息内容可能需要编写 Adium Xtra 来转发信息。访问最后一条消息文本的 Xtra 插件示例包括 挑战/回应 或者 垃圾邮件过滤器. 。SpamFilter 的源代码是 可用的 BitBucket 上,因此您可以想象修改它以将消息内容发送到 AppleScript。

编辑:自从我发布回复以来,用户“zostay”发现了一款​​新的 Adium Xtra,名为“管道事件”。它允许以我在编写第二段时设想的方式将事件文本发送到脚本,因此我对 zostay 的答案投了赞成票。 源代码 也可用。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top