K
K
kikibyk2019-11-16 23:20:39
Node.js
kikibyk, 2019-11-16 23:20:39

Execution of the code specified in the message through the command?

How can I make it so that when writing a message, for example '/code client.channels.get('channel id').send('Hello World')', the code is executed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
fgvnovoross, 2019-11-24
@fgvnovoross

if(message.author.id != "ваш id") return;
var code = args.join(" "); //получаем код
try{ //Проверка на ошибку
var res = eval(code); //выполняем код
message.channel.send(res); //Отправляем то, что код вернул
}catch(err) console.log(err); //логим ошибку, если есть

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question