discord 自动发消息脚本
node(v16+)
npm install
npm run start
将想要发自动送消息的频道 id 加入的配置文件的 channels 里面
// id: 频道id
// msg: 该频道才会出现的消息
const channels = [{
id: "第一个自动发送频道的id",
msg: ["消息1", "消息2"],
}, {
id: "第二个自动发送频道的id",
msg: ["消息3", "消息4"],
}];
如何配置 token?
在 discord 想要自动发送消息的频道按照图片复制 Authorization
// token: 帐号的Authorization
// proxy: 代理, 不需要代理填空,如需要请按照该格式填写 "http://username:password@ip:port"
// msg: 只有该帐号才会发的特定消息
const accounts = [
{
token: "第一个帐号的Authorization",
proxy: "http://username:password@ip:port",
msg: [],
remark: "帐号 1", // 自定义
},
{
token: "第二个帐号的Authorization",
proxy: "http://username:password@ip:port",
msg: [],
remark: "帐号 2",
},
];
所有频道、帐号都会可能发出的消息
const messages = ["消息1", "消息2"];
默认设置的 305s - 310s 间隔执行一次整个任务,可自行调整
(async () => {
let time = 1;
while (true) {
try {
console.log("start:", time++, new Date().toLocaleString());
await chat();
// 305-310s 再发送下一次消息
const sleep = random.int(305000, 310000);
await sleep(sleep);
} catch (error) {
console.error(error);
}
}
})();
// channel delay 5 - 10s
await sleep(random.int(5000, 10000));
// account delay 5 - 10s
await sleep(random.int(5000, 10000));
帐号 1 => 发送完所有 channel list => 帐号 2 => 发送完所有 channel list =>...