async function createChannel(
  guildId,
  options,
  reason,
) {
  if (options?.permissionOverwrites) {
    await requireOverwritePermissions(guildId, options.permissionOverwrites);
  }
  // BITRATES ARE IN THOUSANDS SO IF USER PROVIDES 32 WE CONVERT TO 32000
  if (options?.bitrate && options.bitrate < 1000) options.bitrate *= 1000;
  const result = await rest.runMethod(
    "post",
    endpoints.GUILD_CHANNELS(guildId),
    {
      ...snakelize(options ?? {}),
      permission_overwrites: options?.permissionOverwrites?.map((perm) => ({
        ...perm,
        allow: calculateBits(perm.allow),
        deny: calculateBits(perm.deny),
      })),
      type: options?.type || DiscordChannelTypes.GuildText,
      reason,
    },
  );
  const discordenoChannel = await structures.createDiscordenoChannel(result);
  await cacheHandlers.set("channels", discordenoChannel.id, discordenoChannel);
  return discordenoChannel;
}
/** Create a channel in your server. Bot needs MANAGE_CHANNEL permissions in the server. */
Create a channel in your server. Bot needs MANAGE_CHANNEL permissions in the server.
Create a channel in your server . Bot needs MANAGE_CHANNEL permissions in the server .
async function createChannel(
  guildId,
  options,
  reason,
) {
  if (options?.permissionOverwrites) {
    await requireOverwritePermissions(guildId, options.permissionOverwrites);
  }
  if (options?.bitrate && options.bitrate < 1000) options.bitrate *= 1000;
  const result = await rest.runMethod(
    "post",
    endpoints.GUILD_CHANNELS(guildId),
    {
      ...snakelize(options ?? {}),
      permission_overwrites: options?.permissionOverwrites?.map((perm) => ({
        ...perm,
        allow: calculateBits(perm.allow),
        deny: calculateBits(perm.deny),
      })),
      type: options?.type || DiscordChannelTypes.GuildText,
      reason,
    },
  );
  const discordenoChannel = await structures.createDiscordenoChannel(result);
  await cacheHandlers.set("channels", discordenoChannel.id, discordenoChannel);
  return discordenoChannel;
}
async function createChannel ( guildId , options , reason , ) { if ( options ?. permissionOverwrites ) { await requireOverwritePermissions ( guildId , options . permissionOverwrites ) ; } if ( options ?. bitrate && options . bitrate < 1000 ) options . bitrate *= 1000 ; const result = await rest . runMethod ( "post" , endpoints . GUILD_CHANNELS ( guildId ) , { ... snakelize ( options ?? { } ) , permission_overwrites : options ?. permissionOverwrites ?. map ( ( perm ) => ( { ... perm , allow : calculateBits ( perm . allow ) , deny : calculateBits ( perm . deny ) , } ) ) , type : options ?. type || DiscordChannelTypes . GuildText , reason , } , ) ; const discordenoChannel = await structures . createDiscordenoChannel ( result ) ; await cacheHandlers . set ( "channels" , discordenoChannel . id , discordenoChannel ) ; return discordenoChannel ; }
Create a channel in your server.
Create a channel in your server .
// BITRATES ARE IN THOUSANDS SO IF USER PROVIDES 32 WE CONVERT TO 32000