1.0.9 • Published 3 years ago

snakecord v1.0.9

Weekly downloads
28
License
ISC
Repository
github
Last release
3 years ago

Snakecord

You've heard of the famous Snake game, right? Well, this npm/yarn package allows you to create your own CUSTOM Snake games, directly inside Discord via Discord bots!

This package does NOT support the master branch of Discord.js! Please use the latest version of Discord.js v12 for this package to work correctly!

Installation

npm install snakecord
yarn add snakecord

Features

  • Easy to use
  • Clean and focused
  • Actively maintained

Examples

JavaScript

const { SnakeGame } = require('snakecord');
const Discord = require("discord.js");
const client = new Discord.Client();

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

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

client.on('ready', () => {
    console.log('Ready!');
    client.user.setActivity(`${config.prefix}help`);
});

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

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

    if(command === 'test') {
        return message.channel.send('Test command works.');
    } else if(command === 'snake' || command === 'snakegame') {
        return snakeGame.newGame(message);
    } else if(command === 'help' || command === 'h') {
        const embed = new Discord.MessageEmbed()
            .setTitle("Help Menu")
            .addFields(
                { name: 'test', value: "Check the command handler", inline: true },
                { name: 'snake', value: "Play the snake game", inline: true },
                { name: 'help', value: "Show this list", inline: true }
            )
            .setColor('RANDOM')
            .setTimestamp();

        return message.channel.send(embed);
    }
});

client.login(config.token);

In Action

1

2

To-Do

  • Optimizations and more optimizations
  • Add some sort of changelog
  • Rewrite the whole thing in TypeScript DONE
  • Add JSDocs for easier development
  • Add more features (including but not limited to)
    • Board size customizations DONE
    • Server highscore tracking/leaderboards
    • Color customizations

Authors

1.0.9

3 years ago

1.1.0-beta.7

3 years ago

1.1.0-beta.6

3 years ago

1.0.8

3 years ago

1.1.0-beta.2

3 years ago

1.1.0-beta.1

3 years ago

1.1.0-beta.0

3 years ago

1.1.0-beta.5

3 years ago

1.1.0-beta.4

3 years ago

1.1.0-beta.3

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago