【发布时间】:2022-01-26 13:06:48
【问题描述】:
我想用 discord.js 机器人连接本地站点 因此,如果我想做的事情有效,请将其在线放在服务器中。
我想在不和谐的服务器通道中发送输入的值。
js: src/bot/index.js
const { Client, Intents } = require('discord.js');
const { TOKEN } = require('./config.json');
channelid = "925049593056596009"
const client = new Client({ intents: 32767});
client.once('ready', () => {
console.log('Ready!');
});
function test() {
document.querySelector('.button').addEventListener('click', () => {
channelid.send(document.querySelector('.input').value)
})
}
test()
client.login(TOKEN);
html: src/html/application.html
Applications
错误:
document.querySelector('.button').addEventListener('click', () => {
^
ReferenceError: document is not defined
-
我们可以查看您的文件吗?
-
@Leau 我是新来堆叠我如何发送图像
-
请勿发送图片,请在代码块中附上您的代码(带文件名)。
-
好的,我会编辑问题
-
你不能像 Node.js 模块那样导入 Discord.js,在你的 html 文件中导入这些 webpacks github.com/discordjs/discord.js/tree/webpack 之一。