All Projects → jowsey → Discord.js Menu

jowsey / Discord.js Menu

Licence: mit
💬 Easily create Discord.js v12 embed menus with reactions and unlimited customizable pages.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Discord.js Menu

Commando
Official command framework for discord.js
Stars: ✭ 434 (+387.64%)
Mutual labels:  discord-api, bot, discord-bot, framework, discord
Nostrum
Elixir Discord Library
Stars: ✭ 274 (+207.87%)
Mutual labels:  discord-api, bot, discord-bot, library, discord
Smorebot
SmoreBot is a fun, lightweight, multipurpose bot packed with features.
Stars: ✭ 51 (-42.7%)
Mutual labels:  discord-api, bot, discord-bot, discord
Javacord
An easy to use multithreaded library for creating Discord bots in Java.
Stars: ✭ 368 (+313.48%)
Mutual labels:  discord-api, bot, discord-bot, discord
Bot
A Discord bot for all your needs. With memes, utilities, moderation & more, Fire is the only bot you'll need.
Stars: ✭ 79 (-11.24%)
Mutual labels:  discord-api, bot, discord-bot, discord
Basicbot
A basic example of a Discord Bot written in Python. (discord.py)
Stars: ✭ 73 (-17.98%)
Mutual labels:  discord-api, bot, discord-bot, discord
Discordeno
Discord API library for Deno
Stars: ✭ 254 (+185.39%)
Mutual labels:  discord-api, discord-bot, library, discord
Xiao
Xiao is a Discord bot coded in JavaScript with discord.js using the Commando command framework. With over 500 commands, she is one of the most feature-rich bots out there. Formerly XiaoBot.
Stars: ✭ 302 (+239.33%)
Mutual labels:  discord-api, bot, discord-bot, discord
Dsharpplus
A .NET Standard library for making bots using the Discord API.
Stars: ✭ 635 (+613.48%)
Mutual labels:  discord-api, bot, discord-bot, discord
Create Discord Bot
Create Discord bots using a simple widget-based framework.
Stars: ✭ 70 (-21.35%)
Mutual labels:  bot, discord-bot, framework, discord
Deku
Multi-purpose discord bot built with discord.js
Stars: ✭ 13 (-85.39%)
Mutual labels:  discord-api, bot, discord-bot, discord
Aegis.cpp
Discord C++ library for interfacing with the API. Join our server:
Stars: ✭ 198 (+122.47%)
Mutual labels:  discord-api, bot, library, discord
Lenoxbot
🖥️ LenoxBot is a Discord bot that offers many cool new features to your Discord server!
Stars: ✭ 163 (+83.15%)
Mutual labels:  discord-api, bot, discord-bot, discord
Discord4j
Discord4J is a fast, powerful, unopinionated, reactive library to enable quick and easy development of Discord bots for Java, Kotlin, and other JVM languages using the official Discord Bot API.
Stars: ✭ 973 (+993.26%)
Mutual labels:  discord-api, bot, discord-bot, discord
Discord.js
discord.js is a powerful Node.js module that allows you to easily interact with the Discord API.
Stars: ✭ 16,432 (+18362.92%)
Mutual labels:  discord-api, bot, discord-bot, discord
Discord Panel
📊 User friendly dashboard/tool for discord bot developpers to manage servers
Stars: ✭ 116 (+30.34%)
Mutual labels:  discord-api, bot, discord-bot, discord
Music Bot
Simple music bot with a full-blown queue system that is easy to understand
Stars: ✭ 102 (+14.61%)
Mutual labels:  discord-api, bot, discord-bot, discord
Discord Bot Client
A patched version of discord, with bot login support
Stars: ✭ 441 (+395.51%)
Mutual labels:  discord-api, bot, discord-bot, discord
Modmail
A feature rich discord Modmail bot
Stars: ✭ 957 (+975.28%)
Mutual labels:  discord-api, bot, discord-bot, discord
Nino
🔨 Advanced and cute moderation discord bot as an entry of Discord's Hack Week!
Stars: ✭ 78 (-12.36%)
Mutual labels:  discord-api, bot, discord-bot, discord

Easily create Discord.js embed menus with reactions and unlimited customisable pages.
Need help? Join the support server! https://discord.gg/VBDhRc8


npm npm npm (prod) dependency version

Project Summary

Create flexible, understandable and performant Discord reaction menus with ease. This package is an addon for Discord.js that automates all aspects of a reaction-based navigation menu.
Besides creating it, of course. It'd be pretty useless if you couldn't create the menus yourself.

Learn Discord.js-Menu in Y minutes.

Here's a fast, fully-featured demo of Discord.js-menu. With one read-through of this demo, you should have all you need to create your own menus from scratch.
All values have TypeScript / TSDoc types, so if you use an editor like VSCode, you should get real-time code suggestions and tooltips where appropriate.

/* Import all the usual stuff. This shouldn't be anything new. */
const { Client, MessageEmbed } = require('discord.js')
const { Menu } = require('discord.js-menu')
const client = new Client()

/* Run this code every time a new message is sent. */
client.on('message', message => {
    if (message.content === "!help") {
        /*
         * The menu class takes 4 parameters. 
         * 1) A channel to send the menu to
         * 2) A user ID to give control over the navigation, 
         * 3) An array of Page objects, each being a unique page of the menu
         * 4) How long, in milliseconds, you want the menu to wait for new reactions
         */
        let helpMenu = new Menu(message.channel, message.author.id, [
            {
                /*
                 * A page object consists of three items:
                 * 1) A name. This is used as a unique destination name for reactions.
                 * 2) Some content. This is a rich embed. 
                 * You can use {object: formatting} or .functionFormatting() for embeds. Whichever you prefer.
                 * 3) A set of reactions, linked to either a page destination or a function.* (See example pages)
                 * 
                 * Reactions can be emojis or custom emote IDs, and reaction destinations can be either the names
                 * of pages, () => { functions }, or special destination names. See below for a list of these.
                 */

                /* You can call pages whatever you like. The first in the array is always loaded first. */
                name: 'main',
                content: new MessageEmbed({
                    title: 'Help Menu',
                    description: 'This is some helpful info!',
                    fields: [
                        {
                            name: "Command: Ban",
                            value: "This command bans people.",
                            inline: true
                        }
                    ]
                }),
                reactions: {
                    '😳': 'extra',
                    '😀': async () => {
                        // You can run whatever you like in functions.
                        let res = await message.channel.send("Hey-")
                        setTimeout(() => {
                            return res.edit("listen!")
                        }, 1000)
                    }
                }
            },
            {
                name: 'extra',
                content: new MessageEmbed({
                    title: 'Extra menu',
                    description: 'This is another page.'
                }),
                reactions: {
                    /* You can use custom emotes by using their ID instead of an emoji. */
                    '711632156497019021': 'main',
                    '711840938303847401': 'delete',
                }
            }
        ], 300000)

        /* Run Menu.start() when you're ready to send the menu in chat.
         * Once sent, the menu will automatically handle everything else.
         */ 
        helpMenu.start()

        /* The menu also has a singular event you can use for, well, whatever you like.
         * The "pageChange" event fires just before a new page is sent. You can use
         * this to edit pages on the fly, or run some other logic.
         * It's your menu, man, do whatever.
         * 
         * The "destination" is the Page object it's about to change to.
         */
        helpMenu.on('pageChange', destination => {
            destination.content.title = "Hey, " + message.author.username
        })
    }
})

client.login("Get your bot's oauth token at https://discord.com/developers/applications")

You get the idea.

Special Destinations

You may have noticed I mentioned "special destinations" above.
Discord.js-menu comes with 6 pre-defined destinations with specific uses.

Destination Function
first Goes to the first page in the array.
last Goes to the last page in the array.
previous Goes to the previous page in the array.
next Goes to the next page in the array.
stop Removes reactions from the embed and stops updating the menu.
delete Stops the menu and deletes the message.

Note that whilst calling a page one of these wouldn't break anything (the page would still be accessible using, ironically, the special destinations) you wouldn't be able to directly link to it.

Contributing

Right now, the development pipeline is super simple. The Standard code style is used to keep styling consistent, but besides that, there's not much going on.
Feel free to PR anything you think others would find useful. I'll gladly approve new contributions!

Acknowledgements

Some parts of this project were inspired by Juby210's discord.js-reaction-menu.
Thank you to Juby210 for releasing their code to the public and thus inspiring me to create my own implementation!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].