K
K
Killsayden2020-10-19 20:12:51
Node.js
Killsayden, 2020-10-19 20:12:51

How can I make the bot create a text chat on command and only in this text chat would it respond to Discord.js commands?

I have such a task that I need to do that, for example, using the !start command, the bot will create a text chat with a specific name, and only in this text chat will the bot respond to commands.
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita Kudrin, 2020-10-19
@Killsayden

Channel creation:

client.on("message", async(message) => {
if(message.author == client.user) return;
if(message.content == "!start") {
message.guild.channels.create({
name: "commands-channel"
})
}
})

Reply in specific channel only:
client.on("message", async(message) => {
if(message.author == client.user) return;
if(message.channel.name == "commands-channel") {
// Тут функции которые нужно выполнить при сообщении в канал "commands-channel"
}
})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question