Freezing Channels

Last Edit: Jan 14 2021

Freezing a channel will disallow sending new messages and sending / deleting reactions. Sending a message to a frozen channel will return a message of type error. Sending and deleting reactions to frozen channels will result in a 403 Not Allowed error. User roles with the UseFrozenChannel permission are still able to use frozen channels as if they weren't frozen. By default no user role has the UseFrozenChannel permission.

Freeze a channel

const update = await channel.update(
	{ frozen: true }, 
	{ text: 'Thierry has frozen the channel', user_id: "Thierry" }

Unfreeze a channel

const update = await channel.update(
	{ frozen: false }, 
	{ text: 'Thierry has unfrozen the channel', user_id: "Thierry" }

Grant the UseFrozenChannel permission

Since no default role has the UseFrozenChannel resource permission, you can edit the channel type to grant the permission to a role (must be done server-side). Read more about user permissions here

const useFrozenChannel = new Permission("Admin users can use frozen channels", 600, ["UseFrozenChannel"], ["admin"], false, Allow); 
const { permissions } = await client.getChannelType("messaging");
await client.updateChannelType("messaging", { permissions });