+ discord.js version 13
+ node.js v16.6+
const Discord = require('discord.js');
const { VoiceChatGame } = require('@unusualabsurd/discordjs-games')
const client = new Discord.Client({
intents: 32767
})
const prefix = "YOUR_PREFIX_HERE"
client.on('ready', () => console.log(`Logged in as ${client.user.tag}`));
const vcGame = new VoiceChatGame(client);
client.on('messageCreate', async message => {
if(message.author.bot || !message.guild || !message.content.startsWith(prefix)) return;
const [cmd, ...args] = message.content.slice(prefix.length)
.trim()
.split(/ +/g)
const command = cmd.toLowerCase();
if(command === 'youtube') {
// Code Here
}
})
if(command === 'youtube') {
// message.member.voice.channel = the voice channel the user is in
vcGame.createGame(message.member.voice.channel, 'youtube')
.then(g => message.reply(`Invite Link: ${g.invite} | Invite Code: ${g.code}`))
}
const { scrambleGame } = require('@unusualabsurd/discordjs-games')
if(command === 'scramble') {
// Time option must be a number and it is read as milliseconds
scrambleGame(message, null, { time: 30 * 1000 })
}