跳轉至

使用者

使用者參與渠道查詢

要檢索應用程式使用者參與的頻道列表,請調用Chat類的getChannelsByUser()方法。

Channel 物件作為回應傳遞,結構如下。

頻道

欄位名稱 描述 類型
channelId 頻道 ID 字串
type 頻道類型 (PRIVATE, PUBLIC, GROUP) 列舉
owner 頻道擁有者的 Hive PlayerID 字串
channelName 頻道名稱 字串
maxMemberCount 頻道參與者的最大人數 整數
regTime 頻道創建日期和時間(基於 UTC+0,格式 yyyy-MM-dd'T'HH:mm:ss.SSSZ 字串

這是一個範例代碼,用於檢索用戶參與的頻道列表。

using hive;

Chat.getChannelsByUser((ResultAPI result, List<Channel> channels) => {
    if (result.isSuccess()) {
        foreach (Channel channel in channels) {
            // Retrieve Channel
        }
    }
});
#include "HiveChat.h"
FHiveChat::GetChannelsByUser(FHiveChatOnGetChannelsByUserDelegate::CreateLambda([this](const FHiveResultAPI& Result, const TArray<FHiveChannel>& channels) {
    if (Result.IsSuccess) {
        for (const FHiveChannel& channel : channels) {
            // Retrieve Channel
        }
    }
}));
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace hive;

Chat::getChannelsByUser([=](ResultAPI const & result, std::vector<Channel> channels) {
    if (result.isSuccess()) {
        for (Chat::Channel channel : channels) {
            // Retrieve Channel
        }
    }
});
import com.hive.Chat;
import com.hive.ResultAPI;

Chat.getChannelsByUser(object: Chat.GetChannelsByUserListener{
    override fun onResult(result: ResultAPI, channels: ArrayList<Chat.Channel>) {
        if (result.isSuccess) {
            channels.forEach {
                // Retrieve Channel
            }
        }
    }
})
import com.hive.Chat;

Chat.getChannelsByUser((result, channels) -> {
    if (result.isSuccess()) {
        for (Chat.Channel channel : channels) {
            // Retrieve Channel
        }
    }
});
import HIVEService

ChatInterface.getChannelsByUser { result, channels in
    if result.isSuccess {
        channels.forEach {
                // Retrieve Channel
            }
    }
}
#import "HIVEService.h"

[HiveChat getChannelsByUserWithHandler:^(HIVEResultAPI * result, NSArray<HiveChatChannelContent *> * channels) {
    if (result.isSuccess) {
        for (HiveChatChannelContent *channel in channels) {
            // Retrieve Channel
        }
    }
}];

使用者黑名單查詢

要查看應用用戶阻止的成員列表,請調用Chat類的getBlockMembers()方法。

回應將包括一個 BlockMember 物件,結構如下。

阻擋成員

欄位名稱 描述 類型
playerId 被封鎖用戶的玩家ID long
blockedTime 封鎖時間(基於 UTC+0,格式 yyyy-MM-dd'T'HH:mm:ss.SSSZ string

以下是檢索用戶所封鎖的成員列表的示例代碼。

using hive;

Chat.getBlockMembers((ResultAPI result, List<BlockMember> blockMembers) => {
    if (result.isSuccess()) {
        foreach (BlockMember blockMember in blockMembers) {
            // Retrieve BlockMember
        }
    }
});
FHiveChat::GetBlockMembers(FHiveChatOnGetBlockMembersDelegate::CreateLambda([this](const FHiveResultAPI& Result, const TArray<FHiveBlockMember>& blockMembers) {
    if (Result.IsSuccess) {
        for (const FHiveBlockMember& blockMember : blockMembers) {
            // Retrieve BlockMember
        }
    }
}));
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace hive;

Chat::getBlockMembers([=](ResultAPI const & result, std::vector<BlockMember> blockMembers) {
    if (result.isSuccess()) {
        for (Chat::BlockMember blockMember : blockMembers) {
            // Retrieve BlockMember
        }
    }
});
import com.hive.Chat;
import com.hive.ResultAPI;

Chat.getBlockMembers(object: Chat.GetBlockMembersListener{
    override fun onResult(result: ResultAPI, blockMembers: ArrayList<Chat.BlockMember>) {
        if (result.isSuccess) {
            blockMembers.forEach {
                // Retrieve BlockMember
            }
        }
    }
})
import com.hive.Chat;

Chat.getBlockMembers((result, blockMembers) -> {
    if (result.isSuccess()) {
        for (Chat.BlockMember blockMember : blockMembers) {
            // Retrieve BlockMember
        }
    }
});
import HIVEService

ChatInterface.getBlockMembers { result, blockMembers in
    if result.isSuccess {
        blockMembers.forEach {
            // Retrieve BlockMember
        }
    }
}
#import "HIVEService.h"

[HiveChat getBlockMembersWithHandler:^(HIVEResultAPI * result, NSArray<HiveChatBlockMember *> * blockMembers) {
    if (result.isSuccess) {
        for (HiveChatBlockMember* blockMember in blockMembers) {
            // Retrieve BlockMember
        }
    }
}];

使用者區塊

要阻止特定成員,應用程式使用者呼叫Chat類別blockMember()方法。

以下是用戶阻止特定成員的示例代碼。

using hive;

Int64 blockPlayerId = 12345678;
Chat.blockMember(blockPlayerId, (ResultAPI result) => {
    if (result.isSuccess()) {
        // API Call Success
    }
});
#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace hive;

int64_t blockPlayerId = 12345678;
Chat::blockMember(blockPlayerId, [=](ResultAPI const & result) {
    if (result.isSuccess()) {
        // API Call Success
    }
});
import com.hive.Chat;
import com.hive.ResultAPI;

val blockPlayerId = 12345678L
Chat.blockMember(blockPlayerId, object : Chat.BlockMemberListener {
    override fun onResult(result: ResultAPI) {
        if (result.isSuccess) {
            // API Call Success
        }
    }
})
import com.hive.Chat;

long blockPlayerId = 12345678;
Chat.blockMember(blockPlayerId, result -> {
    if (result.isSuccess()) {
        // API Call Success
    }
});
import HIVEService

let blockPlayerId: Int64 = 12345678
ChatInterface.blockMember(blockPlayerId: blockPlayerId) { result in
    if result.isSuccess {
        // API Call Success
    }
}
#import "HIVEService.h"

int64_t blockPlayerId = 12345678;
[HiveChat blockMemberWithBlockPlayerId:blockPlayerId handler:^(HIVEResultAPI * result) {
    if (result.isSuccess) {
        // API Call Success
    }
}];

解鎖用戶

要解除對成員的封鎖,請調用Chat類的unblockMember()方法。

以下是用戶解除會員封鎖的示例代碼。

using hive;

Int64 blockedPlayerId = 12345678;
Chat.unblockMember(blockedPlayerId, (ResultAPI result) => {
    if (result.isSuccess()) {
        // API Call Success
    }
});

```cpp

include "HiveChat.h"

int64 blockedPlayerId = 12345678; FHiveChat::UnblockMember(blockedPlayerId, FHiveChatOnResultDelegate::CreateLambda(this { if (Result.IsSuccess) { // API Call Success } })); ```

#include <HIVE_SDK_Plugin/HIVE_CPP.h>
using namespace hive;

int64_t blockedPlayerId = 12345678;
Chat::unblockMember(blockPlayerId, [=](ResultAPI const & result) {
    if (result.isSuccess()) {
        // API Call Success
    }
});
import com.hive.Chat;
import com.hive.ResultAPI;

val blockedPlayerId = 12345678L
Chat.unblockMember(blockedPlayerId, object : Chat.UnblockMemberListener {
    override fun onResult(result: ResultAPI) {
        if (result.isSuccess) {
            // API Call Success
        }
    }
})
import com.hive.Chat;

long blockedPlayerId = 12345678;
Chat.unblockMember(blockedPlayerId, result -> {
    if (result.isSuccess()) {
        // API Call Success
    }
});
import HIVEService

let blockedPlayerId: Int64 = 12345678
ChatInterface.unblockMember(blockedPlayerId: blockedPlayerId) { result in
    if result.isSuccess {
        // API Call Success
    }
}
#import "HIVEService.h"

int64_t blockedPlayerId = 12345678;
[HiveChat unblockMemberWithBlockPlayerId:blockedPlayerId handler:^(HIVEResultAPI * result) {
    if (result.isSuccess) {
        // API Call Success
    }
}];