I am currently at a road block on developing my bot. Does anyone know how to create toggle commands for Discord.JS? I am trying to allow users to toggle specific commands on & off.
If you want it switch "on live" you need database for that.
you command execute code must be like:
if(!message.member.hasPermission("ADMINISTRATOR") ) {
//SELECT SOMETHINK FROM DATA BASE, IF NO RESULT, THEN RETURN
}
If not on live you can add verification by role or permissions or id
if(!member.roles.some(r=>["666026501472518167", "ROLEID"].includes(r.id))) return
if(!message.member.hasPermission("ADMINISTRATOR") return
if(!member.user.id.some(u=>["666026501472518167", "USERID"].includes(u.id))) return
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.