0

我正在尝试将 Errbot 与 HipChat 服务器(不是云)一起使用。看起来 Errbot 在房间名称和它的 xmpp jid 之间感到困惑。例如,使用名为BotTestjid 的房间进行测试1_bottest@conf.btf.hipchat.com

  • 当我设置CHATROOM_PRESENCE房间名称并在该房间发送任何消息时,Errbot 崩溃并出现错误"Room '1_bottest@conf.btf.hipchat.com' not found"
  • 当我将其设置为房间的 jid 时,Errbot 会创建一个与 jid 同名的新房间,并且 jid 为'1_1_bottestconf.btf.hipchat.com@conf.btf.hipchat.com'. 然后,当我在那个新房间发送消息时,它会因错误而崩溃"Room '1_1_bottestconf.btf.hipchat.com@conf.btf.hipchat.com' not found".

我的 config.py 如下:

import logging
BACKEND = 'XMPP'  # defaults to XMPP
BOT_DATA_DIR = r'/auto/home.nas03/eeshel/work/errbot/data'
BOT_EXTRA_PLUGIN_DIR = '/auto/home.nas03/eeshel/work/errbot/plugins'
BOT_LOG_FILE = r'/auto/home.nas03/eeshel/work/errbot/errbot.log'
BOT_LOG_LEVEL = logging.DEBUG
TEXT_COLOR_THEME = 'dark'
BOT_ADMINS = ('1_8@chat.btf.hipchat.com', )
BOT_PREFIX = '\\'
BOT_ALT_PREFIXES = ('Hermes',)
BOT_ALT_PREFIX_SEPARATORS = (':', ',', ';')
BOT_ALT_PREFIX_CASEINSENSITIVE = True
CHATROOM_FN = 'Hermes the Bot'
CHATROOM_PRESENCE = ('1_bottest@conf.btf.hipchat.com',)
BOT_IDENTITY = {
    'username' : '1_2@hipchat.eng.<ourdomain>',
    'password' : '*****',
    'token'    : '*****',
    'endpoint' : '10.18.0.185',
}
XMPP_KEEPALIVE_INTERVAL = 60
XMPP_USE_IPV6 = False
XMPP_CA_CERT_FILE = "/etc/ssl/certs/ca-bundle.crt"
4

2 回答 2

0

虽然文档非常好,但我也努力让这些事情恰到好处。一旦我这样做了,重新阅读文档是有道理的,但事后看来是 20/20!

这是一个示例配置部分,可让您的 errbot 连接到 Hipchat:

# Assuming you are @jdoe in your Hipchat and you want admin privs for your bot
BOT_ADMINS = ('@jdoe', '@mmouse', )

# Let's assume your bot's Hipchat account is "superbot" with
# full name of "Super Bot"
BACKEND = 'Hipchat'
if BACKEND == 'Hipchat':
    # http://errbot.io/en/latest/user_guide/configuration/hipchat.html
    BOT_IDENTITY = {
        # You get username by logging into Hipchat with the account, then go to
        # Profile / XMPP/Jabber Info and find the "Jabber ID"
        'username': '123456_1234567@chat.hipchat.com',

        # Simply the password of the Hipchat account
        'password': 'password12345',

        # You get token by logging into Hipchat with the account, then go to
        # Profile / API Access and generate an API token--assigning it all
        # scopes unless you know otherwise.
        'token': 'azwx2BdVzGz0riEjqybWinLbUkBSIz6rpsa259HE',

        ## If you're using HipChat server (self-hosted HipChat) then you should set
        ## the endpoint below. If you don't use HipChat server but use the hosted version
        ## of HipChat then you may leave this commented out.
        #'endpoint': 'https://api.hipchat.com'
    }

    CHATROOM_FN = 'Super Bot'
    BOT_ALT_PREFIXES = ('@superbot', '@SuperBot', '@stinkfinger',)
    # To "listen" for any mentions of @superbot:
    CHATROOM_PRESENCE = ()
    # To also join rooms to listen to all messages in those rooms,
    # do this instead:
    #CHATROOM_PRESENCE = ('Room 1', 'Lounge',)

还需要注意的是,我必须降级这些软件包才能使 Hipchat 集成正常工作。我在 requirements.txt 中进行了这些更改:

pyasn1==0.3.7
pyasn1-modules==0.1.5
sleekxmpp==1.3.2
于 2018-11-14T16:04:09.313 回答
0

您可以参考以下链接,这将对您有所帮助 http://errbot.io/en/latest/user_guide/configuration/hipchat.html

于 2017-08-30T18:28:33.543 回答