创建 IM 机器人

发布于 2024-07-13 19:38:35 字数 888 浏览 5 评论 0原文

我正在尝试创建一个 IM 机器人,但无法找到必要的资源。


更新

Imified 存在一个问题,导致 gtalk 机器人无法在线显示(并且不响应),它现在可以正常工作,因此我将关闭此问题。

这个教程确实有效。


出于参考目的未删除原始问题

首先,我确实在 如何编写自己的 IM 机器人,但它使用的 IMified 平台看起来已经死了(最后一篇博客文章于 2008 年 9 月,在他们的帮助论坛上没有反馈, ...)。

我确实设法使用他们的服务创建了一个测试版机器人,但正如我在他们的帮助论坛中看到的那样,它永远不会在线。

那么,有人成功做到了吗?

注释

我正在寻找这样的东西:

  • 使用 PHP* 的免费
  • 作品或一些免费的托管解决方案(例如 IMified,但有效)
  • 适用于 Google Talk(我并不真正关心其他)

当然,请发布有关不符合这些标准的任何解决方案的答案,这可能会有所帮助。

*我在 GoDaddy 上有 Linux 托管计划

I am trying to create an IM bot and I haven't been able to find the necessary resources.


UPDATE

There was an issue with Imified making gtalk bots not appear online (and not responding), it works now so I'm closing this.

This tutorial does work.


Original question not deleted for reference purposes

First, I did find a great tutorial on How to Write Your Own IM Bot, but it uses the IMified platform which looks dead (last blog post in septembre 2008, no feedback on their help forum, ...).

I did manage to create a beta bot using their service but as I can see in their help forum, it will never be online.

So, any one managed to do it?

Notes

I'm looking for something that would be:

  • Free
  • Works with PHP* or some free hosting solution (like IMified but that works)
  • Works for Google Talk (I don't really care about the other)

Of course, do post answers about any solution that doesn't fit these criteria, it might help.

*I have a Linux hosting plan on GoDaddy

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

紧拥背影 2024-07-20 19:38:35

Google Talk 使用 jabber,其协议称为 XMPP。 在 Google 上快速搜索“xmpp bot php”,我来到了这里。 这应该足够开始了吧?

Google Talk uses jabber, where the protocol is called XMPP. A quick google search for "xmpp bot php" led me here. This should be enough for a start ?

苍白女子 2024-07-20 19:38:35

摘自教程以防它消失:

第 1 步:前往 imified.com 并请求邀请。 你应该
还要给你的机器人起一个合适的名字,因为每个机器人只能有一个
电子邮件地址。

第 2 步:带有密钥的电子邮件应在以下时间到达您的收件箱:
下一分钟。 将该密钥复制到剪贴板并前往此处兑换该密钥
关键。

第 3 步:现在是时候创建一个机器人了,它实际上是一个简单的机器人
驻留在您的公共 Web 服务器上的脚本。 它可以是 PHP 语言,
Perl、Python 或任何其他语言。 更多信息请参见此处。

这是我为 labnol IM 机器人编写的 PHP 脚本的源代码 -
非常不言自明 - 它读取您的消息,获取相关内容
来自 Google Suggest 的数据并将其回显至 IM 窗口。

xpath('//@data'); 
      while (列表($key, $value) = 每个($结果)) 
      { 
          echo $value ."
"; } ?>

第 4 步:脚本准备就绪后,将
将其放在您的 Web 服务器上的某个位置,然后将完整的 URI 复制到
剪贴板。

现在登录到您的模拟帐户,粘贴脚本 URL 并添加
我会自动发送你的好友列表。 就是这样。

Taken from the tutorial in case it ever disappears:

Step 1: Go to imified.com and request an invite. You should
also give your bot a decent name because you can have just one bot per
email address.

Step 2: An email with a secret key should arrive in your Inbox the
next minute. Copy that key to the clipboard and go here to redeem that
key.

Step 3: Now it's time to create a bot which is actually a simple
script that resides on your public web server. It could be in PHP,
Perl, Python or any other language. More here.

This is the source of the PHP script I wrote for the labnol IM bot -
pretty self explanatory - it reads your message, gets the relevant
data from Google Suggest and echoes it back to the IM window.

<?php   // Get all the related keywords from Google Suggest
    $u = "http://google.com/complete/search?output=toolbar";   $u = $u . "&q=" . $_REQUEST['msg'];

    // Using the curl library since dreamhost doesn't allow fopen
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $u);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    $xml = simplexml_load_string(curl_exec($ch));
    curl_close($ch);

    // Parse the keywords and echo them out to the IM window
    $result = $xml->xpath('//@data');
    while (list($key, $value) = each($result))
    {
        echo $value ."<br>";
    }
?>

Step 4: Once your script is ready, put
it somewhere on your web server and copy the full URI to the
clipboard.

Now login to your imified account, paste the script URL and add that
im bot your friends list. That's it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文