我试图用一个不和谐的机器人制作一个 madlib,不知何故我必须为用户消息的每一行分配一个变量......
到目前为止,这是我的代码:
client.on('message', message=>{//madlib
var lib1 = [
' ',//<--(X)
'VERB',
'ADJECTIVE',
'NOUN (PLURAL)',
'ADJECTIVE',
'VERB ENDING IN "ING"',
'VERB',
'NUMBER',
'ADJECTIVE',
'NOUN (PLURAL)',
'NOUN (PLURAL)',
'NOUN (PLURAL)',
'RELATIVE (PLURAL)',
'ADJECTIVE',
'ADJECTIVE',
'NOUN (PLURAL)',
]
if (message.content == '!madlib'){
var rand = Math.floor(Math.random() * 2) + 1;
if (rand == '1'){
message.reply(lib1);
}
if (rand == '2'){
//im gonna put another madlib right here as another option and more random options.
}
}
})
不确定用户将如何插入变量...有人知道怎么做吗?