Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including discord.js.old with all npm packages installed. Try it out:

/** * A ping pong bot, whenever you send "ping", it replies "pong". */ // Import the discord.js module const Discord = require('discord.js'); // Create an instance of a Discord client const client = new Discord.Client(); /** * The ready event is vital, it means that only _after_ this will your bot start reacting to information * received from Discord */ client.on('ready', () => { console.log('I am ready!'); }); // Create an event listener for messages client.on('message', message => { // If the message is "ping" if (message.content === 'ping') { // Send "pong" to the same channel message.channel.send('pong'); } }); // Log our bot in using the token from https://discordapp.com/developers/applications/me client.login('your token here');

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

discord.js.old v11.6.5

A powerful library for interacting with the Discord API |

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free