【问题标题】:Timed message sent to specific channel定时消息发送到特定频道
【发布时间】:2019-09-03 20:16:36
【问题描述】:

我希望在 discord.js 中使用我的以下代码,让我的机器人以一定的时间间隔将特定消息发送到设置的特定频道。我怎样才能做到这一点?

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

【问题讨论】:

    标签: node.js discord.js


    【解决方案1】:

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

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

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

    【讨论】:

    • TypeError: client.channels.get 不是函数
    猜你喜欢
    • 2021-10-28
    • 1970-01-01
    • 1970-01-01
    • 2020-07-02
    • 2021-08-21
    • 2020-04-04
    • 2020-11-16
    • 2020-12-03
    相关资源
    最近更新 更多