Requirements

  • You must have Node JS installed on your desktop or hosting.
  • You must have a text editor installed. (I recomment Atom)
  • You must have a discord account

Lets Get Started

const express = require("express");
const app = express();
const config = require("./config.json");
var server = require("http").createServer(app);app.get("/", (request, response) => {
console.log(Date.now() + " Ping Received");
response.sendStatus(200);
});const listener = server.listen(process.env.PORT, function() {
console.log("Your app is listening on port " + listener.address().port);
});setInterval(() => {
}, 280000);const Discord = require("discord.js");
const {Client, Attachment, Collection, RichEmbed } = require("discord.js");const client = new Client({
disableEveryone: true
});client.on("ready", () => {
console.log(
`Ready to serve on ${client.guilds.size} servers, for ${client.users.size} users.`
);
let activities = [
`${client.guilds.size} Guilds!`,
`${client.channels.size} Channels!`,
`${client.users.size} Members!`
],
i = 0;
setInterval(
() =>
client.user.setActivity(
`btc-help | ${activities[i++ % activities.length]}`,
{ type: "WATCHING" }
),
15000
);
});
client.on("message", message => {
if (message.author.bot) return;
if (message.content.indexOf(config.prefix) !== 0) return;const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
if(command === 'hello') {
message.reply("Hey, How are you?");
}
});
client.login(config.bot);
client.on("message", message => {
if (message.author.bot) return;
if (message.content.indexOf(config.prefix) !== 0) return;
const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
if(command === 'hello') {
message.reply("Hey, How are you?");
}
});
if(command === 'hello') {
//code
}
if(command === 'ping') {
//code
}
if(command === 'ping') {
//send the message to the channel
message.channel.send(`Ping: ${Math.round(client.ping)}ms`);
//send the message to the author
message.author.send(`Ping: ${Math.round(client.ping)}ms`);)
}
if(command === 'ping') {
//send the message to the channel
message.channel.send("Pinging....").then((msg)=>{
msg.edit(`Ping: ${Math.round(client.ping)}ms`);
//send the message to the author
message.author.send("Pinging....").then((msg)=>{
msg.edit(`Ping: ${Math.round(client.ping)}ms`);
}
node server.js

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store