Update index.js

Make prefix changeable, move token to config.js
This commit is contained in:
Julia 2021-09-05 19:44:28 +02:00 committed by GitHub
parent 25126a992b
commit a1b3cbdcd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,6 +3,7 @@ const { generateVideo } = require("./shitpost.js");
const request = require("request"); const request = require("request");
const fs = require("fs"); const fs = require("fs");
const path = require('path'); const path = require('path');
const config = require(`./config`);
const tempDir = "./temp"; const tempDir = "./temp";
@ -10,7 +11,7 @@ const client = new Client({ intents: [Intents.FLAGS.GUILD_MESSAGES, Intents.FLAG
// invite link for orig trolbot // invite link for orig trolbot
// https://discord.com/api/oauth2/authorize?client_id=882394859179216896&scope=bot&permissions=3263552 // https://discord.com/api/oauth2/authorize?client_id=882394859179216896&scope=bot&permissions=3263552
client.login(require("./token.js")); client.login(config.token);
if (!fs.existsSync(tempDir)) if (!fs.existsSync(tempDir))
fs.mkdir(tempDir); fs.mkdir(tempDir);
@ -36,13 +37,13 @@ client.on("messageCreate", (msg) =>
const args = msg.content.split(/ +/); const args = msg.content.split(/ +/);
const command = args.shift().toLowerCase(); const command = args.shift().toLowerCase();
if (command == "trol") if (command == config.prefix)
{ {
if (args[0] == "help") if (args[0] == "help")
{ {
const embed = new MessageEmbed() const embed = new MessageEmbed()
.setColor("#ffffff") .setColor("#ffffff")
.setTitle("trol helpy :^)") .setTitle(config.prefix " helpy :^)")
.addFields( .addFields(
{ name: "trol", value: "uses attachment (if any)" }, { name: "trol", value: "uses attachment (if any)" },
{ name: "trol <link>", value: "uses image link" }, { name: "trol <link>", value: "uses image link" },