0% found this document useful (0 votes)
51 views

Tutorial Discord

This document contains code for a Discord bot that responds to messages. It uses the Discord.js and Express libraries. The bot listens for the "Terserah mau isi apa" message and responds with the same message. It is hosted on Glitch and pinged every 4 minutes to keep the session alive. The package.json file defines the project details and dependencies.

Uploaded by

Nab Voice
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views

Tutorial Discord

This document contains code for a Discord bot that responds to messages. It uses the Discord.js and Express libraries. The bot listens for the "Terserah mau isi apa" message and responds with the same message. It is hosted on Glitch and pinged every 4 minutes to keep the session alive. The package.json file defines the project details and dependencies.

Uploaded by

Nab Voice
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

//bot.js | Copy yang dibawah ini!

const http = require('http');


const express = require('express');
const app = express();
app.get("/", (request, response) => {
console.log('Pinging');
response.sendStatus(200);
});
app.listen(process.env.PORT);
setInterval(() => {
http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me/`);
}, 280000);

const Discord = require('discord.js');


const client = new Discord.Client();

client.on('ready', () => {
console.log("saya telah online");
});

client.on('message', async message => {


if (message.content === "Terserah mau isi apa") {
message.channel.send('Terserah mau isi apa');
}
});

client.login(process.env.BOT)

//package.json copy yang dibawah ini!

{
"name": "Vins",
"version": "1.0.0",
"main": "bot.js",
"scripts": {
"start": "node bot.js"
},
"dependencies": {
"discord.js": "^12.2.0",
"request": "2.81.0",
"express": "^4.16.3",
"https": "^1.0.0",
"foreach-timeout": "2.0.2",
"express": "^4.16.3",
"map": "^1.0.1"
}
}

You might also like