Skip to content

CodyDimensions/discord.js-v13-for-replit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 

Repository files navigation

Discord.js v13 for replit

A discord.js v13 bot set up for replit

Click here to go to replit

How to use Discord.js v13 in Replit?

Code for the discord bot

const { Client, Message, MessageEmbed } = require('discord.js')
const client = new Client({
    partials: ["MESSAGE", "CHANNEL", "REACTION"],
    intents: 32767,
});

const config = require('./config.json')
const prefix = config.prefix
const token = config.token


client.on("ready", () => {
    console.log(`${client.user.tag} is ready!`)
    client.user.setActivity(`${prefix}help ~ test`)
});


client.login(token)

Create a config.json file for the prefix. Add a new environment secret for the bot token.

Updating Node.js v12 to Node.js v16 in Replit

Execute this script on the shell to install node.js v16:

npm init -y && npm i --save-dev node@16 && npm config set prefix=$(pwd)/node_modules/node && export PATH=$(pwd)/node_modules/node/bin:$PATH

Create a .replit file to execute node from the shell instead of the console.

run = "npm start"

Now, add a code to package.json file

  "scripts": {
    "start": "node ."
    }

If you had packages like discord.js v12 or sqlite before,please reinstall them.

npm uninstall discord.js && npm i discord.js

You can run the code now!

About

A discord.js v13 bot set up for replit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published