I am trying to save the id of channels and roles that I have just created so I can go ahead and delete them later on. I am trying to store the IDs in variables so I can later access them publicly from a separate file. This is how I am trying to do it:
let categoryID;
let channelID;
Promise.all([r1, c1, c2]).then(([role, cat, chan]) => {
chan.setParent(cat);
chan.overwritePermissions([
{
//everyone
id: '762492106156539945',
deny: ['SEND_MESSAGES', 'VIEW_CHANNEL']
},
{
//verified
id: '763048301552992346',
allow: ['VIEW_CHANNEL']
},
{
//new role
id: role.id,
allow: ['SEND_MESSAGES']
}
])
console.log(chan.id);
console.log(cat.id);
channelID = chan.id;
categoryID = cat.id;
});
console.log(categoryID);
console.log(channelID);
console.log(chan.id)
works but console.log(channelID)
returns undefined, even though I have set it to chan.id
.