Skip to content

Commit

Permalink
Initial commit and bot setup
Browse files Browse the repository at this point in the history
  • Loading branch information
itsnitinr committed Mar 3, 2021
0 parents commit 6afa5c5
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
node_modules/
.env
12 changes: 12 additions & 0 deletions bot.js
@@ -0,0 +1,12 @@
// Require dependencies
const { Client } = require('discord.js');
const dotenv = require('dotenv');

// Load environment variables
dotenv.config();

// Create a bot instance
const bot = new Client();

// Log our bot in
bot.login(process.env.DISCORD_BOT_TOKEN);
112 changes: 112 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions package.json
@@ -0,0 +1,20 @@
{
"name": "crypto-discord-bot",
"version": "1.0.0",
"description": "A Discord bot which fetches cryptocurrency prices and news",
"main": "bot.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"discord",
"bot",
"crypto"
],
"author": "Nitin Ranganath",
"license": "ISC",
"dependencies": {
"discord.js": "^12.5.1",
"dotenv": "^8.2.0"
}
}

4 comments on commit 6afa5c5

@judygreg54
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got an error with the "const bot = new Client();" when I typing the node. it shows "Client_Missing_intents". can you please advise what intents should we enter? thank you so much

@itsnitinr
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @judygreg54

I just checked the documentation and it seems like it has changed quite a bit. On line 2 on bot.js, change it to:

const { Client, Intents } = require('discord.js');

And on line 9 of bot.js, change it to:

const bot = new Client({ intents: [Intents.FLAGS.GUILDS] });

Hope it helps. Here's the documentation: https://discord.js.org/#/docs/main/stable/general/welcome

@judygreg54
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @judygreg54

I just checked the documentation and it seems like it has changed quite a bit. On line 2 on bot.js, change it to:

const { Client, Intents } = require('discord.js');

And on line 9 of bot.js, change it to:

const bot = new Client({ intents: [Intents.FLAGS.GUILDS] });

Hope it helps. Here's the documentation: https://discord.js.org/#/docs/main/stable/general/welcome

Thank you so much master. please keep helping and sharing your knowledge to others. <3

@itsnitinr
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to help! :) Let me know if you face any other difficulties. @judygreg54

Please sign in to comment.