Auto mute discord bot9/28/2023 ![]() Here's a quick example I wrote on the fly. You'd then want to cache their previous roles or even store the data in a database in case the bot goes down, that way once restarted you could fetch the data and continue where you left off. The simplest way to do this would be to get the list of roles from the user, clear their roles, and then apply for the Muted role. setDescription("Do /commands to get the list of commands") Return message.reply("How has now been muted for has now been unmuted`) ![]() If(!muterole) return message.reply("Role Doesn't Exist") Let muterole = .find(role => role.name = "muted") Let mainrole = .find(role => role.name = "normal") If(!person) return message.reply("User Doesn't Exist") If(!.find(r => r.name = "Admin")) return ('You dont have permissions to do that you clown') and when the muted period is over, the muted role is removed and their previous roles are restored? here is my code below: case 'mute': My questions is that is there some code where I can just remove all their roles and add the muted role. when I run the command, it works, but since the people have other roles, it allows then to continue speaking even though the muted role is at the top priority. Well I added my bot onto another server with more than 3 roles, I decided to give everyone the normal role and also make the muted role. and my code specifically removed the normal role and adds the muted role so they don't have any permissions. Basically, the server can only have 3 roles, one that can issue the command, a "normal" rank with normal permissions, and then a "muted" role. I have a line of code for a discord bot to remove a specific named role and add a role named "muted" for a specific amount of time.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |