hello guys.
i just made a discord bot with glitch and i want to download it and start it from my pc how can i do it?
In tools -> import and export -> download project
Youāll need a program like 7zip to open the tgz file though glitch canāt export to a .zip format.
woww you are so fast my friend thank you !!
I downloaded it but now how do I run it on my computer
i downloaded the node.js but when i try to run it i keep getting some errors
Do npm install
in your project directory in a command prompt itāll download everything your bot needs to run
Do you use process.env.TOKEN
or process.env.token
in your code. Depending on what you put after process.env. run the command set {whatever you put after process.env}={bottokenhere}
make sure to not put spaces around =.
Alternativley you can install the dotenv package to do the same thing glitch does with your .env files.
this is my .env file
GLITCH_DEBUGGER=
Environment Config
store your secrets and config variables in here
only invited collaborators will be able to see your .env values
Note: comments will be visible to remixes so donāt put secrets in comments!
reference these in your code with process.env.SECRET
SECRET=
MADE_WITH=
TOKEN=[ token removed by Glitch Support]
note: .env is a shell file so there canāt be spaces around =
Scrubbed by Glitch 2020-09-22T16:07:30+0000
oh
reference these in your code with process.env.SECRET
SECRET=
MADE_WITH=
TOKEN=NzU3OTc2NzgyND
Please donāt paste your token here it can give otherās control of your discord bot
Just copy and paste this file into another .env file in your local copy
Then run npm install dotenv
In your main file like server.js or index.js add this line somewhere before you start the bot.
require('dotenv').config()
This will load your .env file into process.env before your bot starts
yes i know i change it
i just want to show you how its write in my env file
ohh now i get those errors
C:\Users\Administrator\Desktop\app>node server.js
cape.js loaded!
guides.js loaded!
help.js loaded!
info.js loaded!
status.js loaded!
wings1.js loaded!
wings2.js loaded!
wings3.js loaded!
(node:1980) UnhandledPromiseRejectionWarning: Error: Incorrect login details were provided.
at WebSocketConnection. (C:\Users\Administrator\Desktop\app\node_modules\discord.js\src\client\ClientManager.js:48:41)
at Object.onceWrapper (events.js:422:26)
at WebSocketConnection.emit (events.js:315:20)
at WebSocketConnection.onClose (C:\Users\Administrator\Desktop\app\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:393:10)
at WebSocket.onClose (C:\Users\Administrator\Desktop\app\node_modules\ws\lib\event-target.js:124:16)
at WebSocket.emit (events.js:315:20)
at WebSocket.emitClose (C:\Users\Administrator\Desktop\app\node_modules\ws\lib\websocket.js:191:10)
at TLSSocket.socketOnClose (C:\Users\Administrator\Desktop\app\node_modules\ws\lib\websocket.js:850:15)
at TLSSocket.emit (events.js:327:22)
at net.js:674:12
(node:1980) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catc
h(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:1980) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
C:\Users\Administrator\Desktop\app>
this is the start of my server.js file
const Discord = require(ādiscord.jsā)
const bot = new Discord.Client()
const {prefix, config} = require("./config.json")
const fs = require(āfsā);
bot.commands = new Discord.Collection();
change it to this?
const Discord = require(ādiscord.jsā)
const bot = new Discord.Client()
const {prefix, config} = require("./config.json")
const fs = require(āfsā);
require(ādotenvā).config()
bot.commands = new Discord.Collection();
Yeah that will work if you created the .env file so that itās exactly the same as your glitch one
Why was this flagged? I donāt get it.
i just did and this is what i get now
Get a new token I guess, and put the new one into your .env, I suppose the old one got invalidated
i tried this also =\ i get the same error
and i also try to create a new bot from my discord developer and still the same error
It defintley is due to an invalid token
Stuff gets flagged almost randomly. I suspect thereās some troll who flags stuff for fun, or the systemās spam detector sometimes gets tricked.
everything is ok (
i did what javvarchive told me but on my linux system and its all works great !!
i dont know why in the windows its not worked