I'm pretty new to javascript or discord.js but my guess was something like this:
client.on('channelCreate', channel =>
{
message.channel.send('test');
})
I'm guessing 'channelCreate' doesn't exist.
Your guess is right.
According to the discord.js documentation, you can listen to a channelCreate event to trigger something when a channel is created.
To know who created a channel, your bot need to access the audit logs and the first entry of it.
client.on("channelCreate", async (channel) => {
if (!channel.guild) return;
// Fetch the audit logs of CHANNEL_CREATE events.
const audit_logs = await channel.guild.fetchAuditLogs({
limit: 1,
type: "CHANNEL_CREATE"
});
if (!audit_logs.entries.first()) {
console.error("No entry found.");
return;
}
const entry = audit_logs.entries.first();
const executor = entry.executor;
// The executor property is type User,
// so you can easily check if it's a bot by doing...
const is_bot = executor.bot;
// `is_bot` will be boolean.
});