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!
- Host: GitHub
- URL: https://github.com/unusualabsurd/discordjs-games
- Owner: UnusualAbsurd
- Created: 2021-11-24T07:56:59.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-11-25T03:40:13.000Z (over 4 years ago)
- Last Synced: 2025-01-15T14:44:49.394Z (over 1 year ago)
- Topics: discord-games, discordjs-fun, discordjs-games, djs-game
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@unusualabsurd/discordjs-games
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
discordjs-games
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 })
}