disgames is an easy-to-use fully customizable npm package made to allow you to easily add games to your discord.js bot!
npm i disgames-js
To install the development version, you need git installed. After installing it, run
npm i npm i andrewthederp/Disgames-djs
const Discord = require("discord.js")
const disgames = require("disgames-js")
const client = new Discord.Client({ intents: ['Guilds', 'GuildMessages', 'MessageContent'] })
client.on('interactionCreate', async interaction => {
if (!interaction.isCommand()) return
new disgames.TicTacToe(interaction, await client.users.fetch(interaction.options.get("opponent",true).value)).start()
})
client.login('token')
The Akinator constructor takes two parameters. Interaction
(required) and options
(default:{childMode: false,region: 'people'}
). options
is expected to be an Object
containing childMode
(default:false
) and region
(default:'people'
) region
may be any of "people"/"animals"/"objects".
new disgames.Akinator(interaction,{false,'region'}).start()
The Checkers constructor takes two parameters. Interaction
(required) and opponent
(required). opponent
is expected to be a User object
.
new disgames.Checkers(interaction,await client.users.fetch(interaction.options.get("opponent",true).value).start()
The Chess constructor takes two parameters. Interaction
(required) and opponent
(required). opponent
is expected to be a User object
.
new disgames.Chess(interaction,await client.users.fetch(interaction.options.get("opponent",true).value).start()
The Hangman constructor takes two parameters. Interaction
(required) and options
(default:{min: 3, max: 7, word:undefined}
). options
is expected to be an Object
containing min
(default:3
) and max
(default:7
) and word
(default:undefined
)
if a word is provided it will be used regardless of whether a min/max was provided or not.
new disgames.Hangman(interaction,{min:3, max:7, word:undefined}).start()
The Madlibs constructor takes three parameters. Interaction
(required) and min
(default:5
) and max
(default:25
).
new disgames.Madlibs(interaction,5,25).start()
The Minesweeper constructor takes two parameters. Interaction
(required) and chance
(default:.17
). chance
determines the amount of bombs that will be on the board, .17
does not necessarily mean that there will be 17 bombs.
new disgames.Minesweeper(interaction,.17).start()
The RussianRoulette constructor takes two parameters. Interaction
(required) and opponent
(required).
new disgames.RussianRoulette(interaction,await client.users.fetch(interaction.options.get("opponent",true).value).start()
The RPS constructor takes two parameters. Interaction
(required) and opponent
(default: undefined
). If no opponent is passed then the player plays against the bot.
new disgames.RPS(interaction,await client.users.fetch(interaction.options.get("opponent",true).value).start()
The Snake constructor takes one parameter. Interaction
(required).
new disgames.Snake(interaction).start()
The Sokoban constructor takes two parameters. Interaction
(required) and options
(default: {player:'😳','playerOnTask':'😳',task:'❎',box:'🟫',boxOnTask:'✅'}
). options
will be used to format the board.
new disgames.Sokoban(interaction).start()
The TicTacToe constructor takes two parameters. Interaction
(required) and opponent
(required).
new disgames.TicTacToe(interaction, await client.users.fetch(interaction.options.get("opponent",true).value).start()
The Wordle constructor takes two parameters. Interaction
(required) and player
(required) and word
(default:a random word from words.txt).
new disgames.Wordle(interaction, interaction.user, 'hello').start()