• Creates a private channel within a guild if a channel with the specified name does not already exist.

    Parameters

    • token: string

      The token used for authentication with the Discord API.

    • guildId: string

      The ID of the guild in which to create the channel.

    • channelName: string

      The name of the channel to create.

    • memberId: string

      The ID of the member for whom the channel is being created.

    Returns Promise<null | TextChannel>

    A promise that resolves to the newly created TextChannel, or null if a channel with the specified name already exists.

    Throws

    Will throw an error if there is a problem creating the channel.

    Example

    const token = 'your_discord_token_here';
    const guildId = 'your_guild_id_here';
    const channelName = 'private-channel';
    const memberId = 'your_member_id_here';

    const channel = await createPrivateChannel(token, guildId, channelName, memberId)

    if (channel) {
    console.log(`Channel created with ID: ${channel.id}`);
    } else {
    console.log('Channel already exists.');
    }

Generated using TypeDoc