How to make my Discord Bot leave a server Im not in


How to make my Discord Bot leave a server Im not in



So i've been trying to make my discord bot leave some servers that Im not in,
I made a command with this message.guild.leave() but I could only managed to leave a server that I have access to.


message.guild.leave()



If anyone knows how can I make a command or something to leave one of the servers I would really appreciate it.



Ps: I know the Guild ID of the server I want to leave.





Please read stackoverflow.com/help/how-to-ask
– aydow
Jun 29 at 3:26




1 Answer
1



Well I don't know js library but in .NET this is your problem. I hope u get some idea.



I am pretty sure this is happening because the message is of the type SocketMessage and not SocketGuildMessage. Cast message into SocketGuildMessage and you will be able to leave the guild easily. It doesn't matter if you are on the server or not.


SocketMessage


SocketGuildMessage


message


SocketGuildMessage






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

how to run turtle graphics in Colaboratory

Export result set on Dbeaver to CSV