-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.js
40 lines (36 loc) · 1.47 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const Discord = require('discord.js');
const fetch = require("node-fetch");
const express = require('express')
const app = express()
const port = 8080
app.get('/', (req, res) => res.send('Created By CodeWhiteWeb'))
app.listen(port, () =>
console.log(`Your app is listening to http://localhost:${port}`)
)
const client = new Discord.Client();
client.login(process.env.token);
client.on("ready", () => {
console.log(`Bot has started, with ${client.users.cache.size} users, in ${client.channels.cache.size} channels of ${client.guilds.cache.size} guilds.`);
client.user.setActivity(`Serving ${client.guilds.cache.size} servers`);
});
client.on("message", async message => {
if (message.channel.name == "chatbot") {
if (message.author.bot) return;
let uid = message.author.id
let msg = message.content
message.content = message.content.replace(/@(everyone)/gi, "everyone").replace(/@(here)/gi, "here");
if (message.content.includes(`@`)) {
return message.channel.send(`**:x: Please dont mention anyone**`);
}
message.channel.startTyping();
if (!message.content) return message.channel.send("Please say something.");
fetch(`http://api.brainshop.ai/get?bid=${bid}&key=${key}&uid=${uid}&msg=${msg}`)
.then(res => res.json())
.then(data => {
message.channel.send(`> ${message.content} \n <@${message.author.id}> ${data.cnt}`);
});
message.channel.stopTyping();
}
});
/* It will help me a lot if u give credits to Me(owner)*/
/* better version :- https://dsc.gg/chatari */