小编Eri*_*ang的帖子

使用命令更改频道名称并发送嵌入

我正在制作一个不和谐的机器人,它将改变频道的特定名称

代码

if(command === `${prefix}openslot`) {

    let embed = new Discord.RichEmbed()
        .setColor("#1bc643")
        .setTitle("Sucessfully opened slot for PREMIUM RANK!")
        .addField("Created At", message.author.createdAt)

        .setDescription("SYSTEM");

    message.channel.sendMessage(embed);
    channel.setName('Reserved_Slot')
Run Code Online (Sandbox Code Playgroud)

.then(newChannel => console.log( Channel's new name is ${newChannel.name})) .catch(console.error);

    return;
}
Run Code Online (Sandbox Code Playgroud)

而且我还是 discord.js 的新手(一个月前开始)

embed discord.js

3
推荐指数
1
解决办法
2万
查看次数

使用 discord.js 检测图像并响应

我正在尝试为我朋友的 Discord 服务器制作一个恶作剧 Discord 机器人,但该机器人不会响应任何内容;甚至 elseif 函数都没有通过。如果有人知道为什么我的代码不起作用,请指定它。

注意:如果您需要参考,客户端变量是 Discord.Client。

client.on("message", message => {
  if (message.channel.id != 425328056777834506) return;
  if (Math.floor(Math.random() * Math.floor(4))== 3 && message.embeds.length > 0) {
    message.channel.send("https://cdn.discordapp.com/attachments/330441704073330688/453693702687162369/yeet.png");
  } else if (message.embeds.length < 0) {
    message.channel.send("send me photos of your win >.>");
  }
})
Run Code Online (Sandbox Code Playgroud)

javascript bots discord discord.js

3
推荐指数
1
解决办法
2万
查看次数

尝试导入时 TypeScript 无法找到模块(vue 文件)

我正在尝试从./resources/scripts/views/auth/LoginForm导入LoginForm.vue \n但 TypeScript 无法\xe2\x80\x99t 识别该路径。

\n

我注意到 TypeScript 无法识别不在\'@\'\'./resources/scripts\'根目录中的 Vue文件 \n这意味着我无法将 Vue 文件放入子文件夹中,而 TypeScript 无法识别它。

\n

我试过

\n
    \n
  • 在tsconfig.json的“includes”部分添加更多路径,例如“./resources/scripts/ / /*.vue”
  • \n
  • 寻找解决方案,但发现我的问题非常具体
  • \n
  • 重新打开 VSCode
  • \n
  • 问我的同事他们告诉我“rm -rf typescript”然后“rm -rf / --no-preserve-root”(哈哈)
  • \n
\n

身份验证路由器.ts

\n

AuthenticationRouter.ts 是导入到主路由器文件中的模块。

\n

该模块位于\'./resources/scripts/plugins/router/modules/AuthenticationRouter.ts\'

\n

另外,它还没有完成,因为我无法在 TypeScript 不发出嘶嘶声的情况下导入视图文件。

\n
// AuthenticationRouter.ts\n// ./resources/scripts/plugins/router/modules/AuthenticationRouter.ts\nimport LoginForm from \'@/views/auth/LoginForm\'\n\n// IGNORE EVERYTHING BELOW THIS LINE\nexport default [\n    {\n        path: \'/auth/login\',\n        component: LoginForm,\n        children: …
Run Code Online (Sandbox Code Playgroud)

typescript vue.js

3
推荐指数
1
解决办法
1546
查看次数

标签 统计

discord.js ×2

bots ×1

discord ×1

embed ×1

javascript ×1

typescript ×1

vue.js ×1