Update index.js
Browse files
index.js
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
|
|
| 1 |
const { Client, GatewayIntentBits } = require("discord.js");
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
const client = new Client({
|
| 4 |
intents: [
|
| 5 |
GatewayIntentBits.Guilds,
|
|
@@ -18,10 +30,6 @@ client.on("messageCreate", async (message) => {
|
|
| 18 |
if (message.content === "!ping") {
|
| 19 |
message.reply("Pong!");
|
| 20 |
}
|
| 21 |
-
|
| 22 |
-
if (message.content === "!hello") {
|
| 23 |
-
message.reply("Hello!");
|
| 24 |
-
}
|
| 25 |
});
|
| 26 |
|
| 27 |
client.login(process.env.DISCORD_TOKEN);
|
|
|
|
| 1 |
+
const express = require("express");
|
| 2 |
const { Client, GatewayIntentBits } = require("discord.js");
|
| 3 |
|
| 4 |
+
const app = express();
|
| 5 |
+
const PORT = process.env.PORT || 7860;
|
| 6 |
+
|
| 7 |
+
app.get("/", (req, res) => {
|
| 8 |
+
res.send("Discord Bot is Running!");
|
| 9 |
+
});
|
| 10 |
+
|
| 11 |
+
app.listen(PORT, () => {
|
| 12 |
+
console.log(`Web server running on port ${PORT}`);
|
| 13 |
+
});
|
| 14 |
+
|
| 15 |
const client = new Client({
|
| 16 |
intents: [
|
| 17 |
GatewayIntentBits.Guilds,
|
|
|
|
| 30 |
if (message.content === "!ping") {
|
| 31 |
message.reply("Pong!");
|
| 32 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
});
|
| 34 |
|
| 35 |
client.login(process.env.DISCORD_TOKEN);
|