discord-snake

A snake game framework for discord.js bots

Usage no npm install needed!

<script type="module">
  import discordSnake from 'https://cdn.skypack.dev/discord-snake';
</script>

README

Discord-Snake Framwork!

How to install

All you need to do is use to cli of npm/yarn and add the package

npm install discord-snake
yarn add discord-snake

Example Using

Here will be a basic usage with discord.js:

const SnakeFramework = require('discord-snake');
const discord = require('discord.js');

const client = new discord.Client({ 
    // Intent stuff here
});

const config = {
    token: "",
    prefix: "!"
}

const Snake = new SnakeFramework({
    title: 'Snake Game',
    color: 'GREEN',
    timestamp: false,
    gameOverTitle: 'Game Over!'
});

client.on('ready', () => {
    console.log("Bot's Ready!");
});

client.on('messageCreate', async(message) => {
    if(!message.content.startsWith(config.prefix) || message.author.bot) return;

    const args = message.content.slice(config.prefix.length).trim().split(/[ ]+/);
    const cmd = args.shift().toLowerCase();

    if(cmd === "snake") {
        return Snake.CreateNewGame(message);
    }
})

client.login(config.token);

In Discord Images

Authors (1)

Me!