Chat / Unreal
Current version: v3
Chat Unreal v3
Chat Unreal
Chat
Unreal
Home
/
Chat
/
Unreal
/
Users

Mute and unmute a participant in an open channel

Operators of an open channel can prohibit selected users from sending messages using our Mute feature. Muted participants remain in the channel and are allowed to view the messages, but can't send any messages until the operators unmute them. Operators can mute and unmute participants in open channels using the following code.

openChannel->GetChannel(CHANNEL_URL, [](SBDOpenChannel* channel, SBDError* error) {
    if (error != nullptr) {
        // Handle error.
        return;
    }

    if (channel->IsOperator(*SBDMain::GetCurrentUser())) {
        // Ban a user.
        channel->MuteUser(USER, [](SBDError* error) {
            if (error != nullptr) {
                // Handle error.
                return;
            }

            // The user is successfully muted in the channel.
            // You could notify the user of being muted by displaying a message.
        });

        // Unban a user.
        channel->UnmuteUser(USER, [](SBDError* error) {
            if (error != nullptr) {
                // Handle error.
                return;
            }

            // The user is successfully unmuted in the channel.
            // You could notify the user of being unmuted by displaying a message.
        });
    }
});