How can I kick member from voice channel? (DSharpplus)

1k Views Asked by At

How can I kick member from voice channel?
In DSharpplus Api Documentation I've only found Task PlaceMemberAsync(DiscordMember Member) or public Task PlaceInAsync(DiscordChannel channel)
await Member.PlaceInAsync(null) doesn't work
https://dsharpplus.emzi0767.com/api/index.html
Thank's for your answer's

2

There are 2 best solutions below

0
On BEST ANSWER

From https://dsharpplus.emzi0767.com/api/DSharpPlus.Entities.DiscordMember.html

There is a method "ModifyAsync(String, IEnumerable, Nullable, Nullable, DiscordChannel, String)"

Have you tried to null DiscordChannel parameter when modifying the target user? First check if its a voice channel, using https://dsharpplus.emzi0767.com/api/DSharpPlus.ChannelType.html.

0
On

Now You need to use

 await Member.ModifyAsync(delegate (MemberEditModel Kick)
 {
     Kick.VoiceChannel = null;
 });