Sendbird Remove Member from a Channel or group

499 Views Asked by At

I am using Sendbird SDK for a chat in my application following the steps through official documentation. Everything is working fine but recently I wanted to implement a functionality in which I wanted to give access to admin to remove a member from the group. But, while going through the official documentation, I came to know there is no such functionality or method provided in SendBird. So, is there any workaround or better way to do the same.

1

There are 1 best solutions below

0
On

Some time has passed since this question was posted, but here are the official guides for the ban functionality.

Group Channel

if (groupChannel.getMyRole() == Member.Role.OPERATOR) {
    groupChannel.banUser(USER, DESCRIPTION, SECONDS, new GroupChannel.GroupChannelBanHandler() {
        @Override
        public void onResult(SendBirdException e) {
            if (e != null) {    // Error.
                return;
            }

            // TODO: Custom implementation for what should be done after banning.
        }
    });
}
            

Open Channel

if (openChannel.isOperator(SendBird.getCurrentUser())) {
    openChannel.banUser(USER, SECONDS, new OpenChannel.OpenChannelBanHandler() {
        @Override
        public void onResult(SendBirdException e) {
            if (e != null) {    // Error.
                return;
            }

            // TODO: Custom implementation for what to do after banning.
        }
    });
}

Please keep in mind that an user should be an operator to ban or unban a user.