如何使用forEach()定义文件路径的集合

时间:2019-02-04 21:39:59

标签: javascript discord.js

尝试通过将重复动作安装在forEach()函数中来解决该重复动作。 console.log提供所需的结果,但不编写代码本身。您能解释一下为什么它不起作用吗?

warning: format ‘%s’ expects argument of type ‘char *’, but argument 3      has type ‘int’ [-Wformat=]
             fscanf(file, "%s", array[count2][width]);
                          ^
warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=]
             printf("%s", array[count2][width]);

无法读取未定义的属性“ get”

1 个答案:

答案 0 :(得分:1)

这只会向机器人添加属性v并分配其值。

bot.v = new Discord.Collection();
// bot.v has a value

看起来好像您正在尝试将数组元素用作属性名称。

bot[v] = new Discord.Collection();
// bot.commands assigned, ... bot.automation assigned