【问题标题】:If not catched then react?如果没有被抓住然后反应?
【发布时间】:2020-11-23 01:10:13
【问题描述】:

这是我的代码,

msg.author.send(helpembed)
  .catch(() =>{
    send(msg,":no_entry_sign: **Your DMs are closed! Open them so I can help you out!** :no_entry_sign:");
});
msg.react("✅");

我想知道我是否可以以某种方式编写代码来表示:如果没有捕获(没有错误)与 ✅ 反应。我怎么能这样做?

【问题讨论】:

  • try...catch 块怎么样?

标签: javascript node.js discord discord.js


【解决方案1】:

这是what the .then(…, …) method does

msg.author.send(helpembed).then(() => {
  msg.react("✅");
}, err => {
  send(msg,":no_entry_sign: **Your DMs are closed! Open them so I can help you out!** :no_entry_sign:");
});

【讨论】:

    猜你喜欢
    • 2023-03-03
    • 1970-01-01
    • 2021-07-29
    • 1970-01-01
    • 1970-01-01
    • 2022-09-26
    • 1970-01-01
    • 1970-01-01
    • 2018-07-12
    相关资源
    最近更新 更多