Editing Permissions

Hi! Is there a way I can edit the channel permissions? I tried permissionOverwrites.edit(), but it seemed not to work.
if(oldMember.id == Testing &&
oldMember.presence.status == "online" &&
newMember.presence.status == "offline") {
TestingChannel.permissionOverwrites.edit(newMember.guild.roles.everyone, {
SendMessages: false
}, "KeyGremlin is offline!")
}
if(oldMember.id == Testing &&
oldMember.presence.status == "online" &&
newMember.presence.status == "offline") {
TestingChannel.permissionOverwrites.edit(newMember.guild.roles.everyone, {
SendMessages: false
}, "KeyGremlin is offline!")
}
And before people say that it might be TestingChannel not being defined, IT IS!!! Same for Testing which is a userid This code is inside the guildMemberUpdate event.
2 Replies
d.js docs
d.js docs3y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Jarvo
JarvoOP3y ago
v 14.3.0 I also tried with .create() and .set() but both did not work. Oh wait. I see. It seems that the code is not being executed. Somehow... I can't get it working. I have all the intents enabled on the Discord Developer Docs, and in the code...
const client = new Discord.Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildBans,
GatewayIntentBits.GuildEmojisAndStickers,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.DirectMessages
],
partials: [
Partials.User,
Partials.Channel,
Partials.GuildMember,
Partials.Message
]
})
const client = new Discord.Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildBans,
GatewayIntentBits.GuildEmojisAndStickers,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.DirectMessages
],
partials: [
Partials.User,
Partials.Channel,
Partials.GuildMember,
Partials.Message
]
})
But still nothing happens when trying to use the guildMemberUpdate event. Nevermind

Did you find this page helpful?