定时消息已发送到特定频道

时间:2019-04-13 05:09:17

标签: node.js discord.js

我正在寻找让我的机器人在discord.js中使用以下代码,以便在特定的时间间隔内向特定的频道集发送特定的消息。我如何才能做到这一点?

client.channels.get("550449channelidhere40447774").send(`<@&566483roleidhere34268683> i don't forget! somethingh somewthing`);

1 个答案:

答案 0 :(得分:0)

我将使用setInterval。看起来像这样:

setInterval(function() {
client.channels.get("550449channelidhere40447774").send(`<@&566483roleidhere34268683> i don't forget! somethingh somewthing`);
}, 10000);

10000是时间间隔。在这种情况下,我将其设置为10000毫秒(10秒)

相关问题