There is no example available for mute and unmute members in typescript. It’s possible? How I do?
@mlemos For the question you asked, we recommend checking the following link: https://docs.amity.co/amity-sdk/chat/channels/query-members
OK. Regarding the search for silenced users, I already managed to solve it. But now I’m looking for how to mute and unmute member in typescript. There is no example in the documentation, just this: “Supported (please wait while we prepare a real example!)”
@mlemos Thank you for letting us know about this. I have submitted your request to the relevant team, and we will inform you once there is an update on this matter.
Please refer to the sample code below:
Mute:
import { ChannelRepository } from '@amityco/ts-sdk';
async function muteChannelMembers() {
/*
* The default mute period is set to forever or until unmuted
*/
const didMute = await ChannelRepository.Moderation.muteMembers('channelId', [
'userId1',
'userId2',
]);
const FIVE_MINUTES = 5 * 60 * 1000;
/*
* This value can be overridden by passing a specific amount of time (in
* milliseconds) as the
* second variable
*/
const didMuteForFiveMinutes = await ChannelRepository.Moderation.muteMembers(
'channelId',
['userId1', 'userId2'],
FIVE_MINUTES,
);
return [didMute, didMuteForFiveMinutes];
}
Unmute:
import { ChannelRepository } from '@amityco/ts-sdk';
async function unmuteChannelMembers() {
const didUnmute = await ChannelRepository.Moderation.unmuteMembers('channelId', [
'userId1',
'userId2',
]);
return didUnmute;
}