[英]How to properly tag a user using message.channel.send in discord.js
[英]Discord JS using loop on message.channel.send
事件發生后,我希望我的機器人在循環中發送多個嵌入消息,在每次發送后執行很多操作。 消息嵌入在循環外的常量中聲明,但我無法循環,我不知道是否可以這樣做......
const MESSAGENUMBER1 = {
title: 'title1',
}
const MESSAGENUMBER2 = {
title: 'title2',
}
for (let j = 1; j < 3; j++) {
message.channel.send({embed: MESSAGENUMBER[j]}).then((msg) => {
for (let i = 0; i < 12; i++) {
//etc
}
}
我有這個錯誤:
ReferenceError: MESSAGENUMBER is not defined
嘗試將所有MessageEmbeds
放在一個Array
:
const messages = [ { title: 'title1', }, { title: 'title2', }, ]; for (var i = 0; i < messages.length; i++) { console.log(messages[i]); };
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.