#How can I add multiple roles to a channel overwrite.
1 messages · Page 1 of 1 (latest)
use a for() loop
No literally just use an array
TypeError [INVALID_TYPE]: Supplied parameter is not a User nor a Role.
how would I don't do arrays alot
The for...of statement creates a loop iterating over iterable
objects, including: built-in String, Array, array-like
objects (e.g., arguments
or NodeList), TypedArray, Map,
Set, and user-defined iterables. It invokes a custom iteration hook with
statements to be executed for the value of each distinct property of the object.
can you show the code
I cant really show it because its all in one file but basiclly im trying to make a ticket system and have the allowed roles in a array
but
how can I replace the perms of a channel by its id
@covert crystal do you know?
fetch the channel by id, and then do permissionsOverwrites.edit() on it?
yea
then do it?
so
const tchannel = client.channels.cache.get('id')
tchannel.permissionsOverwrites.edit({})```
cache.get
does editing the perms erase previous perms
overwrites them
so if you edit for person1, perms for person 2 will still be the same
so this should work?
for(const value of idRole) {
tchannel.overwritePermissions.edit([
{
id: value,
allow: ["VIEW_CHANNEL", "SEND_MESSAGES"]
}
])
}```
i think
maybe you need to use async/await on it but idk
dont remember
Cannot read properties of undefined (reading 'edit')
permissionOverwrites