This is a great moderation feature provided by Stream. Ban is a server-side operation -
There are 2 types of ban available.
1. Channel Ban
2. Client Ban (App Ban / User Ban)
Channel Ban
let data = await channel.banUser('Liya', {
banned_by_id: "Diya",
timeout: 10,
ip_ban: false,
reason: 'Please try again after later', });
Query banned users -
If you have banned them from a channel, you can use
queryMembers ({banned:true})
or
client.queryBannedUsers({ channel_cid: ''})
to find the list of banned users from that particular channel.
To unban a user -
await channel.unbanUser('Liya');
Client Ban (App Ban / User Ban)
let data1 = await client.banUser('Seetha', {
banned_by_id: userID,
timeout: 30,
ip_ban: false,
reason: 'Please come back tomorrow', });
Query banned users -
If you have banned usingclient.ban
, you can find the banned users using
client.queryUsers({banned:true})
To unban a user -
await client.unbanUser('Seetha');
Comments
0 comments
Please sign in to leave a comment.