Tobkubos commited on
Commit
e4b505c
·
1 Parent(s): 550177e

bot connection

Browse files
Files changed (3) hide show
  1. .gitignore +4 -0
  2. index.js +24 -0
  3. package.json +18 -0
.gitignore ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ node_modules/
2
+ .env
3
+ .DS_Store
4
+ package-lock.json
index.js ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import dotenv from "dotenv";
2
+ dotenv.config();
3
+
4
+ import { Client, GatewayIntentBits, Events } from "discord.js";
5
+
6
+ const client = new Client({
7
+ intents: [
8
+ GatewayIntentBits.Guilds,
9
+ GatewayIntentBits.GuildMessages,
10
+ GatewayIntentBits.MessageContent,
11
+ ],
12
+ });
13
+
14
+ client.once(Events.ClientReady, () => {
15
+ console.log(`Bot ready: ${client.user.tag}`);
16
+ });
17
+
18
+ client.on(Events.MessageCreate, (message) => {
19
+ if (message.author.bot) return;
20
+ console.log(`Message from ${message.author.tag}: ${message.content}`);
21
+ });
22
+
23
+ console.log("Wczytany token:", process.env.DISCORD_TOKEN);
24
+ client.login(process.env.DISCORD_TOKEN);
package.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "discordbot",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "scripts": {
8
+ "start": "node index.js",
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "keywords": [],
12
+ "author": "",
13
+ "license": "ISC",
14
+ "dependencies": {
15
+ "discord.js": "^14.26.4",
16
+ "dotenv": "^17.4.2"
17
+ }
18
+ }