跳转至

消息

Hive 聊天功能支持 频道消息发送,以向用户参与的频道发送消息,以及 1:1 消息发送,以直接向特定个人发送消息。

频道消息发送

要向用户已加入的频道发送消息,请创建一个 ChannelSendMessageParams 对象,并将其作为参数传递给 Chat 类的 sendMessage() 方法。

sendMessage() 方法返回传输结果和用于发送的 ChannelSendMessageParams,作为 retryParam。 如果传输失败,您可以尝试使用 retryParams 进行重新发送。

通道发送消息参数

字段名称 描述 类型 必需
channelId 发送消息的频道ID 字符串
message 要发送到频道的消息
(最多200个字符)
字符串
extraData 频道消息的附加信息
最多256B字节(UTF-8)
字符串
replyMessageId 正在回复的消息ID 字符串
mentionedPlayerIds 要提及的玩家ID 列表 <长整型>

这是一个示例代码,用于向用户参与的频道发送消息。

using hive;

ChannelSendMessageParams channelSendMessageParams = new ChannelSendMessageParams();
channelSendMessageParams.channelId = "CHANNEL_ID";
channelSendMessageParams.message = "你好 Hive";
channelSendMessageParams.extraData = "EXTRA_DATA";

Chat.sendMessage(channelSendMessageParams, (ResultAPI result, ChannelSendMessageParams retryParams) => {
    if (!result.isSuccess()) {
        // 消息发送失败,尝试使用 `retryParams` 重新发送

    }
});
#include "HiveChat.h"

FHiveChatChannelSendMessageParams ChannelSendMessageParams;
ChannelSendMessageParams.ChannelId = TEXT("CHANNEL_ID");
ChannelSendMessageParams.Message = TEXT("你好 Hive");
ChannelSendMessageParams.ExtraData = TEXT("EXTRA_DATA");

FHiveChat::SendMessageWithChannelSendMessageParams(ChannelSendMessageParams, FHiveChatOnResultDelegate::CreateLambda([this](const FHiveResultAPI& Result, const FHiveChatChannelSendMessageParams& RetryParams) {
    if (!Result.IsSuccess) {
        // 消息发送失败,尝试使用 `RetryParams` 重新发送
    }
}));
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
  using namespace hive;

ChannelSendMessageParams params;
params.channelId = "CHANNEL_ID";
params.message = "你好 Hive";
params.extraData = "EXTRA_DATA";

Chat::sendMessageWithChannelSendMessageParams(params, [=](ResultAPI const & result, ChannelSendMessageParams const & retryParams) {
    if (!result.isSuccess()) {
        // 消息发送失败,尝试使用 `retryParams` 重新发送
    }
});
import com.hive.Chat;
import com.hive.ResultAPI;

val params = Chat.ChannelSendMessageParams(
    channelId = "CHANNEL_ID",
    message = "你好 Hive",
    extraData = "EXTRA_DATA"
)
Chat.sendMessage(params, object: Chat.SendMessageListener {
    override fun onResult(
        result: ResultAPI,
        retryParams: Chat.ChannelSendMessageParams?
    ) {
        if (!result.isSuccess) {
            // 消息发送失败,尝试使用 `retryParams` 重新发送
        }
    }
})
import com.hive.Chat;

Chat.ChannelSendMessageParams params = new Chat.ChannelSendMessageParams(
    "CHANNEL_ID",
    "你好 Hive",
    "EXTRA_DATA"
);

Chat.sendMessage(params, (result, retryParams) -> {
    if(!result.isSuccess()) {
        // 消息发送失败,尝试使用 `retryParams` 重新发送
    }
});
import HIVEService

let params = HiveChatParams.ChannelSendMessageParams(
    channelId = "CHANNEL_ID",
    message = "你好 Hive",
    extraData = "EXTRA_DATA"
)
ChatInterface.sendMessage(params) { result, retryParams in
    if !result.isSuccess {
        // 消息发送失败,尝试使用 `retryParams` 重新发送
    }
}
#import "HIVEService.h"

HiveChatChannelSendMessageParams* sendMessageParams = [[HiveChatChannelSendMessageParams alloc] init];
sendMessageParams.channelId = "CHANNEL_ID";
sendMessageParams.message = "你好,Hive";
sendMessageParams.extraData = "EXTRA_DATA";

[HiveChat sendMessageWithChannelSendMessageParams:sendMessageParams handler:^(HIVEResultAPI * result, HiveChatChannelSendMessageParams * retryParams) {
    if (!result.isSuccess) {
        // 消息发送失败。尝试使用 `retryParams` 重新发送
    }
}];

以下是一个示例代码,用于向用户已加入的频道中的特定目标消息发送回复。

using hive;

ChannelSendMessageParams channelSendMessageParams = new ChannelSendMessageParams();
channelSendMessageParams.channelId = "CHANNEL_ID";
channelSendMessageParams.message = "你好 Hive";
channelSendMessageParams.replyMessageId = "TARGET_MESSAGE_ID";

Chat.sendMessage(channelSendMessageParams, (ResultAPI result, ChannelSendMessageParams retryParams) => {
    if (!result.isSuccess()) {
        // 消息发送失败,尝试使用 `retryParams` 重新发送

    }
});
#include "HiveChat.h"

FHiveChatChannelSendMessageParams ChannelSendMessageParams;
ChannelSendMessageParams.ChannelId = TEXT("CHANNEL_ID");
ChannelSendMessageParams.Message = TEXT("你好,Hive");
ChannelSendMessageParams.ReplyMessageId = TEXT("TARGET_MESSAGE_ID");

FHiveChat::SendMessageWithChannelSendMessageParams(ChannelSendMessageParams, FHiveChatOnResultDelegate::CreateLambda([this](const FHiveResultAPI& Result, const FHiveChatChannelSendMessageParams& RetryParams) {
    if (!Result.IsSuccess) {
        // 消息发送失败,尝试使用 `RetryParams` 重新发送
    }
}));
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
  using namespace hive;

ChannelSendMessageParams params;
params.channelId = "CHANNEL_ID";
params.message = "你好 Hive";
params.replyMessageId = "TARGET_MESSAGE_ID";

Chat::sendMessageWithChannelSendMessageParams(params, [=](ResultAPI const & result, ChannelSendMessageParams const & retryParams) {
    if (!result.isSuccess()) {
        // 消息发送失败,尝试使用 `retryParams` 重新发送
    }
});
import com.hive.Chat;
import com.hive.ResultAPI;

val params = Chat.ChannelSendMessageParams(
    channelId = "CHANNEL_ID",
    message = "你好 Hive",
    replyMessageId = "TARGET_MESSAGE_ID"
)
Chat.sendMessage(params, object: Chat.SendMessageListener {
    override fun onResult(
        result: ResultAPI,
        retryParams: Chat.ChannelSendMessageParams?
    ) {
        if (!result.isSuccess) {
            // 消息发送失败,尝试使用 `retryParams` 重新发送
        }
    }
})
import com.hive.Chat;

Chat.ChannelSendMessageParams params = new Chat.ChannelSendMessageParams(
    "CHANNEL_ID",
    "你好 Hive",
    "EXTRA_DATA",
    "TARGET_MESSAGE_ID"
);

Chat.sendMessage(params, (result, retryParams) -> {
    if(!result.isSuccess()) {
        // 消息发送失败,尝试使用 `retryParams` 重新发送
    }
});
import HIVEService

let params = HiveChatParams.ChannelSendMessageParams(
    channelId = "CHANNEL_ID",
    message = "你好 Hive",
    replyMessageId = "TARGET_MESSAGE_ID"
)
ChatInterface.sendMessage(params) { result, retryParams in
    if !result.isSuccess {
        // 消息发送失败,尝试使用 `retryParams` 重新发送
    }
}
#import "HIVEService.h"

HiveChatChannelSendMessageParams* sendMessageParams = [[HiveChatChannelSendMessageParams alloc] init];
sendMessageParams.channelId = "CHANNEL_ID";
sendMessageParams.message = "你好 Hive";
sendMessageParams.replyMessageId = "TARGET_MESSAGE_ID";

[HiveChat sendMessageWithChannelSendMessageParams:sendMessageParams handler:^(HIVEResultAPI * result, HiveChatChannelSendMessageParams * retryParams) {
    if (!result.isSuccess) {
        // 消息发送失败。尝试使用 `retryParams` 重新发送
    }
}];

以下是一个示例代码,用于在用户已加入的频道中发送提及特定用户的消息。

using hive;

ChannelSendMessageParams channelSendMessageParams = new ChannelSendMessageParams();
channelSendMessageParams.channelId = "CHANNEL_ID";
channelSendMessageParams.message = "你好 Hive";

List<long> playerIds = new List<long>();
playerIds.Add(1234);  // 用户 1 PlayerId
playerIds.Add(5678);  // 用户 2 PlayerId
channelSendMessageParams.mentionedPlayerIds = playerIds;

Chat.sendMessage(channelSendMessageParams, (ResultAPI result, ChannelSendMessageParams retryParams) => {
    if (!result.isSuccess()) {
        // 消息发送失败,尝试使用 `retryParams` 重新发送

    }
});
#include "HiveChat.h"

FHiveChatChannelSendMessageParams ChannelSendMessageParams;
ChannelSendMessageParams.ChannelId = TEXT("CHANNEL_ID");
ChannelSendMessageParams.Message = TEXT("你好 Hive");

TArray<int64> PlayerIds;
PlayerIds.Add(1234); // User 1 PlayerId
PlayerIds.Add(5678); // User 2 PlayerId
ChannelSendMessageParams.MentionedPlayerIds = PlayerIds;

FHiveChat::SendMessageWithChannelSendMessageParams(ChannelSendMessageParams, FHiveChatOnResultDelegate::CreateLambda([this](const FHiveResultAPI& Result, const FHiveChatChannelSendMessageParams& RetryParams) {
    if (!Result.IsSuccess) {
        // 消息发送失败,尝试使用 `RetryParams` 重新发送
    }
}));
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
  using namespace hive;

ChannelSendMessageParams params;
params.channelId = "CHANNEL_ID";
params.message = "你好 Hive";

std::vector<int64_t> playerIds;
playerIds.push_back(1234);  // 用户 1 PlayerId
playerIds.push_back(5678);  // 用户 2 PlayerId
params.mentionedPlayerIds = playerIds;

Chat::sendMessageWithChannelSendMessageParams(params, [=](ResultAPI const & result, ChannelSendMessageParams const & retryParams) {
    if (!result.isSuccess()) {
        // 消息发送失败,尝试使用 `retryParams` 重新发送
    }
});
import com.hive.Chat;
import com.hive.ResultAPI;

val playerIds = listOf(1234L, 5678L) // User 1, 2的 PlayerId
val params = Chat.ChannelSendMessageParams(
    channelId = "CHANNEL_ID",
    message = "Hello Hive",
    replyMessageId = "TARGET_MESSAGE_ID",
    mentionedPlayerIds = playerIds
)
Chat.sendMessage(params, object: Chat.SendMessageListener {
    override fun onResult(
        result: ResultAPI,
        retryParams: Chat.ChannelSendMessageParams?
    ) {
        if (!result.isSuccess) {
            // 消息发送失败,尝试使用 `retryParams` 重新发送
        }
    }
})
import com.hive.Chat;

List<Long> mentionedPlayerIds = new ArrayList<>();
mentionedPlayerIds.add(1234L); // 用户 1 玩家ID
mentionedPlayerIds.add(5678L); // 用户 2 玩家ID

Chat.ChannelSendMessageParams params = new Chat.ChannelSendMessageParams(
    "CHANNEL_ID",
    "你好 Hive",
    "EXTRA_DATA"
);
params.mentionedPlayerIds = mentionedPlayerIds;

Chat.sendMessage(params, (result, retryParams) -> {
    if(!result.isSuccess()) {
        // 消息发送失败,尝试使用 `retryParams` 重新发送
    }
});
import HIVEService

var playerIds: [Int64] = [1234, 5678] // User 1, 2的 PlayerId

let params = HiveChatParams.ChannelSendMessageParams(
    channelId = "CHANNEL_ID",
    message = "你好 Hive",
    mentionedPlayerIds = playerIds
)
ChatInterface.sendMessage(params) { result, retryParams in
    if !result.isSuccess {
        // 消息发送失败,尝试使用 `retryParams` 重新发送
    }
}
#import "HIVEService.h"

HiveChatChannelSendMessageParams* sendMessageParams = [[HiveChatChannelSendMessageParams alloc] init];
sendMessageParams.channelId = @"CHANNEL_ID";
sendMessageParams.message = @"你好 Hive";

NSMutableArray<NSNumber *> *playerIds = [NSMutableArray array];
[playerIds addObject:@(1234)]; // 用户 1 PlayerId
[playerIds addObject:@(5678)]; // 用户 2 PlayerId
sendMessageParams.mentionedPlayerIds = playerIds;

[HiveChat sendMessageWithChannelSendMessageParams:sendMessageParams handler:^(HIVEResultAPI * result, HiveChatChannelSendMessageParams * retryParams) {
    if (!result.isSuccess) {
        // 消息发送失败。尝试使用 `retryParams` 重新发送
    }
}];

添加或移除频道消息的反应

用户可以对他们已加入的频道中特定用户的消息添加或移除反应。消息反应功能使用户能够轻松表达他们的感受并实时提供快速反馈,从而实现更有效的游戏内沟通。特别是,它有助于使频道中的对话流更加生动和直观。

Note

目前仅支持“点赞”反应类型。未来将添加更多反应类型。

以下是示例代码,用于向用户已加入的频道中的消息添加或删除反应。

using hive;

String messageId = "TARGET_MESSAGE_ID";
ReactionType type = ReactionType.Like;

channel.addReaction(messageId, type, (ResultAPI result, ReactionType reactionType) => {
    if (result.isSuccess()) {
        // API Call Success
    }
});

channel.removeReaction(messageId, type, (ResultAPI result, ReactionType reactionType) => {
    if (result.isSuccess()) {
        // API Call Success
    }
});
#include "HiveChat.h"

FString MessageId = TEXT("TARGET_MESSAGE_ID");
EReactionType Type = EReactionType::Like;

channel.AddReaction(MessageId, Type, FHiveChatOnReactionDelegate::CreateLambda([this](const FHiveResultAPI& Result, EReactionType Type) {
    if (Result.IsSuccess()) {
        // API Call Success
    }
}));

channel.RemoveReaction(MessageId, Type, FHiveChatOnReactionDelegate::CreateLambda([this](const FHiveResultAPI& Result, EReactionType Type) {
    if (Result.IsSuccess()) {
        // API Call Success
    }
}));
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace hive;

std::string messageId = "TARGET_MESSAGE_ID";
ReactionType type = ReactionType::Like;

channel.addReaction(messageId, type, [=](ResultAPI const & result, ReactionType type) {
    if (result.isSuccess()) {
        // API Call Success
    }
});

channel.removeReaction(messageId, type, [=](ResultAPI const & result, ReactionType type) {
    if (result.isSuccess()) {
        // API Call Success
    }
});
import com.hive.Chat;
import com.hive.ResultAPI;

val messageId = "TARGET_MESSAGE_ID"
val type = Chat.ReactionType.Like;

channel.addReaction(messageId, type, object: Chat.ReactionListener {
    override fun onResult(result: ResultAPI, type: Chat.ReactionType) {
        if (result.isSuccess()) {
            // API Call Success
        }
    }
})

channel.removeReaction(messageId, type, object: Chat.ReactionListener {
    override fun onResult(result: ResultAPI, type: Chat.ReactionType) {
        if (result.isSuccess()) {
            // API Call Success
        }
    }
})
import com.hive.Chat;

String messageId = "TARGET_MESSAGE_ID";
Chat.ReactionType type = Chat.ReactionType.Like;

Chat.addReaction(messageId, type, new Chat.ReactionListener() {
    @Override
    public void onResult(ResultAPI result, ReactionType type) {
        if (result.isSuccess()) {
            // API Call Success
        }
    }
});

Chat.removeReaction(messageId, type, new Chat.ReactionListener() {
    @Override
    public void onResult(ResultAPI result, ReactionType type) {
        if (result.isSuccess()) {
            // API Call Success
        }
    }
});
import HIVEService

let messageId = "TARGET_MESSAGE_ID"
let reactionType: ReactionType = .like

ChatInterface.addReaction(messageId: messageId, type: reactionType) { result, type in
    if result.isSuccess {
        // API 调用成功
    }
}

ChatInterface.removeReaction(messageId: messageId, type: reactionType) { result, type in
    if result.isSuccess {
        // API Call Success
    }
}
#import "HIVEService.h"

NSString *messageId = @"TARGET_MESSAGE_ID";
HiveChatReactionType reactionType = HiveChatReactionTypeLike;

[channel addReactionWithMessageId:messageId type:reactionType handler:^(ResultAPI *result, HiveChatReactionType type) {
    if (result.isSuccess) {
        // API 调用成功
    }
}];

[channel removeReactionWithMessageId:messageId type:reactionType handler:^(ResultAPI *result, HiveChatReactionType type) {
    if (result.isSuccess) {
        // API Call Success
    }
}];

频道消息事件管理

发送的消息可以通过onChannelMessage事件处理程序接收,该程序是addChannelListener事件的一部分。有关事件处理的更多详细信息,请参阅事件管理 > 渠道事件文档。

1:1 消息发送

要向特定收件人发送直接消息,用户创建一个 DirectSendMessageParams 对象,然后将其作为参数传递给 Chat 类的 sendMessage() 方法。

sendMessage() 方法返回传输结果以及在传输过程中使用的 DirectSendMessageParams,其名称为 retryParam。 如果传输失败,您可以尝试使用 retryParams 重新发送。

直接发送消息参数

字段名称 描述 类型 必需
toPlayerId Hive 目标用户的玩家ID long Y
message 要发送给目标用户的消息
(最多200个字符)
string Y
extraData 1:1消息的附加信息
最多256B字节 (UTF-8标准)
string N

以下是一个示例代码,供用户向特定收件人发送直接消息。

using hive;

DirectSendMessageParams directSendMessageParams = new DirectSendMessageParams();
directSendMessageParams.toPlayerId = 12345678;
directSendMessageParams.message = "你好 Hive";
directSendMessageParams.extraData = "EXTRA_DATA";

Chat.sendMessage(directSendMessageParams, (ResultAPI result, DirectSendMessageParams retryParams) => {
    if (!result.isSuccess()) {
        // 消息发送失败,尝试使用 `retryParams` 重新发送

    }
});
#include "HiveChat.h"

FHiveChatDirectSendMessageParams DirectSendMessageParams = FHiveChatDirectSendMessageParams();
DirectSendMessageParams.ToPlayerId = 12345678l;
DirectSendMessageParams.Message = TEXT("你好 Hive");
DirectSendMessageParams.ExtraData = TEXT("EXTRA_DATA");

FHiveChat::SendMessageWithDirectSendMessageParams(DirectSendMessageParams, FHiveChatOnResultDelegate::CreateLambda([this](const FHiveResultAPI& Result, const FHiveChatDirectSendMessageParams& RetryParams) {
    if (!Result.IsSuccess) {
        // 消息发送失败,尝试使用 `RetryParams` 重新发送
    }
}));
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace hive;

DirectSendMessageParams params;
params.toPlayerId = 12345678;
params.message = "你好 Hive";
params.extraData = "EXTRA_DATA";

Chat::sendMessageWithDirectSendMessageParams(params, [=](ResultAPI const & result, DirectSendMessageParams const & retryParams) {
    if (!result.isSuccess()) {
        // 消息发送失败,尝试使用 `retryParams` 重新发送
    }
});
import com.hive.Chat;
import com.hive.ResultAPI;

val params = Chat.DirectSendMessageParams(
    toPlayerId = 12345678,
    message = "你好 Hive",
    extraData = "EXTRA_DATA"
)

Chat.sendMessage(params, object: Chat.SendMessageListener {
    override fun onResult(
        result: ResultAPI,
        retryParams: Chat.DirectSendMessageParams?
    ) {
        if (!result.isSuccess) {
            // 消息发送失败,尝试使用 `retryParams` 重新发送
        }
    }
})
import com.hive.Chat;

Chat.DirectSendMessageParams params = new Chat.DirectSendMessageParams(
        12345678,
        "Hello Hive",
        "EXTRA_DATA"
);

Chat.sendMessage(params, (result, retryParams) -> {
    if(!result.isSuccess()) {
        // 消息发送失败,尝试使用 `retryParams` 重新发送
    }
});
import HIVEService

let params = HiveChatParams.DirectSendMessageParams(toPlayerId: Int64(12345678), message: "Hello Hive", extraData: "EXTRA_DATA")

ChatInterface.sendMessage(sendMessageParams: params) { result, retryParams in
    if !result.isSuccess {
        // 消息发送失败,尝试使用 `retryParams` 重新发送
    }
}
#import "HIVEService.h"

HiveChatDirectSendMessageParams* sendMessageParams = [[HiveChatDirectSendMessageParams alloc] init];
sendMessageParams.toPlayerId = 12345678;
sendMessageParams.message = "你好 Hive";
sendMessageParams.extraData = "EXTRA_DATA";

[HiveChat sendDirectMessageWithSendMessageParams:sendMessageParams handler:^(HIVEResultAPI * result, HiveChatDirectSendMessageParams * retryParams) {
    if (!result.isSuccess) {
        // 消息发送失败。尝试使用 `retryParams` 重新发送
    }
}];

1:1 消息事件管理

通过 1:1 消息传输发送的消息可以通过 addUserListener 事件的 onDirectMessage 事件处理程序接收。有关事件处理的更多详细信息,请参阅 事件管理 > 用户事件 文档。

消息翻译请求

尝试请求该消息的翻译。 语言代码基于ISO 639 alpha-2标准。

翻译参数

字段名称 描述 类型 必需
message 消息 字符串
sourceLanguage 消息的语言代码。如果省略,则推断为 auto 字符串
targetLanguages 翻译请求的语言代码数组 字符串数组
using hive;

List<String> targetLanguages = new List<String>();
targetLanguages.Add("ko");
targetLanguages.Add("ja");
targetLanguages.Add("ar");

TranslateParams translateParams = new TranslateParams("hello", "auto", targetLanguages);

Chat.translate(translateParams, (ResultAPI result, TranslationData data) => {
    if (result.isSuccess() && data != null) {
        // data is translate languages
    }
});
#include "HiveChat.h"

TArray<FString> TargetLanguages;
TargetLanguages.Add(TEXT("ko"));
TargetLanguages.Add(TEXT("ja"));
TargetLanguages.Add(TEXT("ar"));

FHiveChatTranslateParams TranslateParams = FHiveChatTranslateParams(TEXT("你好"), TEXT("auto"), TargetLanguages);

FHiveChat::Translate(TranslateParams, FHiveChatOnResultDelegate::CreateLambda([this](const FHiveResultAPI& Result, const FHiveChatTranslationData& data) {
    if (Result.ISSuccess && data != null) {
        // data 是翻译语言消息
    }
}));
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace hive;

std::vector<std::string> targetLanguages = { "ko", "ja", "ar" };

Chat::TranslateParams translateParams = new Chat::TranslateParams("你好", "auto", targetLanguages);

Chat::translate(translateParams, [=](ResultAPI const & result, Chat::TranslationData const & data) {
    if (!result.isSuccess() && data != null ) {
        // data is translate language messages
    }
});
import com.hive.Chat;
import com.hive.ResultAPI;

var translateParams = Chat.TranslateParams(
    message = "你好",
    sourceLanguage = "auto",
    targetLanguages = ["ko", "ja", "ar"]
)

Chat.translate(translateParams, object: Chat.TranslateParamsListener {
    override fun onResult(
        result: ResultAPI,
        data: Chat.TranslationData?
    ) {
        if (!result.isSuccess && data != null) {
            // data is translate language maessages
        } 
    }
})
import com.hive.Chat;

Chat.TranslateParams translateParams = new Chat.TranslateParams(
    "hello",
    "auto",
    ["ko", "ja", "ar"]
);

Chat.translate(translateParams, (result, data) -> {
    if(result.isSuccess() && data != null) {
        // data is translate language messages
    }
});
import HIVEService

let translateParams = HiveChatParams.TranslateParams("hello", "auto", ["ko", "ja", "ar"])
ChatInterface.translate(params: translateParams) { result, data in
    if result.isSuccess(), let data {
        // data is translate language messages
    }
}
#import "HIVEService.h"

NSArray<NSString *> *targetLanguages = @[@"ko", @"ja", @"ar"];
HiveChatTranslateParams translateParams = [[HiveChatTranslateParams alloc] message: @"hello"
                                                                           sourceLanguage: @"auto"
                                                                           targetLanguages: targetLanguages];


[HiveChat translateWithParams: translateParams
          handler:^(HIVEResultAPI * result, HiveChatTranslationData * data) {
            if (result.isSuccess && data) {
                // data 是翻译语言消息
            }
          }];