Discord.js - Code not working


Joined
Mar 7, 2021
Messages
13
Reaction score
0
Hello there!
I have my discord code under that is supposed to create a new channel but, it does nothing and the console isn't reporting errors...
Look at it :


if (message.content.toLowerCase().startsWith(!tournoi-fn) == '!tournoi-fn') {
let channelName = args.slice(1).join(' ');
message.channel.send('Channel created as :', channelName);
message.guild.createChannel(channelName, 'text', {

permissionOverwrites: [{
id: message.guild.roles.cache.find( r => r.id('855045656409276446')),
allow: ['VIEW_CHANNEL', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],

id: message.guild.roles.cache.find( r => r.id('848565653463629894')),
deny: ['VIEW_CHANNEL', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
}]
})
.then(console.log)
.catch(console.error);


Tell me if you know why,
Thanks!
 
Ad

Advertisements

Joined
Nov 13, 2020
Messages
80
Reaction score
14
This line:
if (message.content.toLowerCase().startsWith(!tournoi-fn) == '!tournoi-fn') {
1.) Makes no sense to me.
2.) Has no closing bracket.
3.) .startsWith( NEEDS TO BE A STRING ).
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top