JavaScript Discord Bot Tutorial | DevDungeon

Store the document as “bot.js”. make sure the file doesn’t store with a .txt document extension.You can close your textual content editor.

Installing Bot Dependencies

Open a command spark off Discord bot . On home windows, you could seek “Cmd” in the windows seek area within the begin Menu. On Mac, you could search spotlight for “Command set off.”Navigate in your bot folder in your desktop. as an example, you can type cd\users\Default desktop\desktop\DiscordBotfoldername.

Type npm installation winston –keep and press ↵ enter. With Node.js established, this line will mechanically download the dependencies on your bot for your desktop folder.

Kind npm install and press ↵ enter. That code will make sure there’s nothing else you need to put in to your bot to currently have code in your bot and could check that your code works within the subsequent component.

Jogging the Bot

Type node bot.js and press ↵ enter in the command spark off. in case you get an error line, you did some thing incorrect.

Create a Bot in Discord

Type “!Intro” in Discord. You’ll want to kind this inside the channel your bot is in. the example code furnished triggers the bot to respond “Pong!” to text starting with “!”. So to test if the bot is running, type “!Intro” and anticipate a response.