Channel Moderation
Channel Moderation is an essential feature for creating a safe and engaging chat community. With Amity Chat SDK, developers can use moderation to manage chat channels effectively and ensure that the chat community remains safe and welcoming. Moderation features such as user banning and muting can help prevent inappropriate content and maintain a positive chat environment.
Add / Remove Roles
Roles define varying levels of access and permissions that can be assigned to users within a chat channel. Each role is defined by a set of permissions that determine what actions a user can perform within the channel.
Roles can be assigned to users based on factors such as their level of participation in the chat community or their specific responsibilities within the channel. For example, a moderator might have the ability to remove inappropriate messages or ban users from the channel, while a regular user might only have the ability to send and receive messages.
You can use ChannelRepository class to add / remove users from a role
Supported ✅ (please wait while we prepare a real example!)
Supported ✅ (please wait while we prepare a real example!)
Permission
You can check your permission in channel by sending Permission enums to CoreClient.hasPermission(amityPermission).
Supported ✅ (please wait while we prepare a real example!)
The functionality isn't currently supported by this SDK.
Supported ✅ (please wait while we prepare a real example!)
Add / Remove Members
AmityChannelMembership provides methods to add and remove members, as well as removing yourself as a member of the channel (leaving the channel).
channelId: The ID of the channel to which you want to add or remove members.userIds: An array of user IDs to be added to the channel or removed from the channel.
// add 'user1' and 'user2' to this channel
const isAdded = await ChannelRepository.addMembers({
channelId: 'channel1',
userIds: [ 'user1', 'user2' ],
});
// remove 'user3' from this channel
const isRemoved = await ChannelRepository.removeMembers({
channelId: 'channelId',
userIds: [ 'user3' ],
});
// leave this channel
const isLeaved = await ChannelRepository.leave('channelId');Version 6
Add Channel Members
Remove Channel Members
Beta (v0.0.1)
Add Channel Members
Remove Channel Members
The functionality isn't currently supported by this SDK.
Ban / Unban Members
ChannelRepository class also provides various methods to moderate the users present in channel. You can ban/unban users, assign roles or remove it from user.
For the banMembers function, the following parameters are required:
channelId: The ID of the channel from which the members are being banned.userIds: An array of user IDs to be banned from the channel.
For the unbanMembers function, the following parameters are required:
channelId: The ID of the channel from which the members are being unbanned.userIds: An array of user IDs to be unbanned from the channel.
const isBanned = await ChannelRepository.banMembers({
channelId: 'channel1',
userIds: ['user1']
);
const isUnbanned = await ChannelRepository.banMembers({
channelId: 'channel1',
userIds: ['user1']
);
await ChannelRepository.addRole({
channelId: 'channel1',
userIds: ['user1'],
role: 'role1',
);
await ChannelRepository.removeRole({
channelId: 'channel1',
userIds: ['user1'],
role: 'role1',
);Version 6
Ban members
Unban members
Beta (v0.0.1)
Ban members
Unban members
Supported ✅ (please wait while we prepare a real example!)
Last updated
Was this helpful?