所以这是我第一次使用DiscordJS(或一般编码)进行编码,我需要一些帮助以使bot自动在特定频道中发送消息。请给我一些帮助吗?谢谢!
这是我的代码:
const Discord = require("discord.js");
const client = new Discord.Client();
client.once("ready", () => {
console.log("LemonBot is online!");
});
const express = require("express");
const app = express();
const guildId = "739855462274695188";
const channelId = "739875350594584707";
const message = "!d bump"
client.login(my discord bot token)
答案 0 :(得分:0)
const Discord = require("discord.js");
const client = new Discord.Client();
client.on("ready", () => {
console.log(`${client.user.tag} is online!`);
// Getting the channel from client.channels Collection.
const Channel = client.channels.cache.get("739875350594584707");
// Checking if the channel exists.
if (!Channel) return console.error("Couldn't find the channel.");
// Sending "!d bump" to the channel.
Channel.send("!d bump").catch(e => console.log(e));
});
client.login(process.env.DISORD_AUTH_TOKEN)