{
"prefix": "!"
//這個prefix 是用來讓機器人知道這是指令不是對話的前綴字,要用!、?、*...皆可
}
const Discord = require('discord.js');
const { GatewayIntentBits } = require('discord.js');
const { DisTube } = require('distube');
const { Guilds, GuildVoiceStates,GuildMessages,MessageContent} = GatewayIntentBits;
//這行其實沒啥必要,只是寫了底下比較方便一點(?)
const { token } = require('./token.json');
const { prefix } = require('./config.json');
//這個prefix 是用來讓機器人知道這是指令不是對話的前綴字,要用!、?、*...皆可
});
const client = new Discord.Client({
intents: [Guilds, GuildVoiceStates,GuildMessages,MessageContent],
//上面說的方便就是這裡,不用前面接一堆GatewayIntentBits.OOO
});
const distube = new DisTube(client, {
searchSongs: 5,
searchCooldown: 30,
leaveOnEmpty: false,
leaveOnFinish: false,
leaveOnStop: false,
});
看到上方的程式碼底下有很多要調整得值意義分別是: