An open API service indexing awesome lists of open source software.

https://github.com/unusualabsurd/discordjs-games

Create games easily from discord.js client using this package!
https://github.com/unusualabsurd/discordjs-games

discord-games discordjs-fun discordjs-games djs-game

Last synced: about 2 months ago
JSON representation

Create games easily from discord.js client using this package!

Awesome Lists containing this project

README

          


discordjs-games


Wumpus Gaming

Create games easily from discord.js client using this package!


## Requirements
```diff
+ discord.js version 13
+ node.js v16.6+
```

# Setup basic discord.js client starter pack and the VoiceChatGame client
### Full discord.js guide

```js
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
}
})
```

## Creating the games
```js
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}`))
}
```

# Scramble Game
```js
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 })
}