Changed all double quote to backticks

main
Killian 4 years ago
parent c86457cbfe
commit d0a74e3f48

@ -1,19 +1,19 @@
const Command = require("../../Structure/Command.js");
const Command = require(`../../Structure/Command.js`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "help",
description: "Return the commands list.",
category: "Bot",
name: `help`,
description: `Return the commands list.`,
category: `Bot`,
enabled: true,
aliases: ["?"],
aliases: [`?`],
cooldown: 3,
dmOnly: false,
});
}
async run(message, args) {
message.chat.sendMessage("Here are the commands you can use ! https://github.com/Mr-KayJayDee/instagram-bot#available-commands")
message.chat.sendMessage(`Here are the commands you can use ! https://github.com/Mr-KayJayDee/instagram-bot#available-commands`)
}
}

@ -1,13 +1,13 @@
const Command = require("../../Structure/Command.js");
const Command = require(`../../Structure/Command.js`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "ping",
description: "Return the bot ping.",
category: "Bot",
name: `ping`,
description: `Return the bot ping.`,
category: `Bot`,
enabled: true,
aliases: ["latency"],
aliases: [`latency`],
cooldown: 3,
dmOnly: false,
});

@ -1,12 +1,12 @@
let Command = require(`../../Structure/Command.js`);
const DIG = require("discord-image-generation");
const DIG = require(`discord-image-generation`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "ad",
description: "Display an ad image.",
category: "Images",
name: `ad`,
description: `Display an ad image.`,
category: `Images`,
enabled: true,
aliases: [],
cooldown: 3,
@ -17,7 +17,7 @@ module.exports = class extends Command {
async run(message, args) {
let avatar = message.author.avatarURL;
let img = await new DIG.Ad().getImage(avatar);
message.chat.sendMessage("Please wait we're generating your image...");
message.chat.sendMessage(`Please wait we're generating your image...`);
message.chat.sendPhoto(img);
}
};

@ -1,12 +1,12 @@
let Command = require(`../../Structure/Command.js`);
const DIG = require("discord-image-generation");
const DIG = require(`discord-image-generation`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "affect",
description: "Return an affect image.",
category: "Images",
name: `affect`,
description: `Return an affect image.`,
category: `Images`,
enabled: true,
aliases: [],
cooldown: 3,
@ -17,7 +17,7 @@ module.exports = class extends Command {
async run(message, args) {
let avatar = message.author.avatarURL;
let img = await new DIG.Affect().getImage(avatar);
message.chat.sendMessage("Please wait we're generating your image...");
message.chat.sendMessage(`Please wait we're generating your image...`);
message.chat.sendPhoto(img);
}
};

@ -1,12 +1,12 @@
let Command = require(`../../Structure/Command.js`);
const DIG = require("discord-image-generation");
const DIG = require(`discord-image-generation`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "beautiful",
description: "Return a beautiful image.",
category: "Images",
name: `beautiful`,
description: `Return a beautiful image.`,
category: `Images`,
enabled: true,
aliases: [],
cooldown: 3,
@ -17,7 +17,7 @@ module.exports = class extends Command {
async run(message, args) {
let avatar = message.author.avatarURL;
let img = await new DIG.Beautiful().getImage(avatar);
message.chat.sendMessage("Please wait we're generating your image...");
message.chat.sendMessage(`Please wait we're generating your image...`);
message.chat.sendPhoto(img);
}
};

@ -1,12 +1,12 @@
let Command = require(`../../Structure/Command.js`);
const DIG = require("discord-image-generation");
const DIG = require(`discord-image-generation`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "blur",
description: "Return a blured image.",
category: "Images",
name: `blur`,
description: `Return a blured image.`,
category: `Images`,
enabled: true,
aliases: [],
cooldown: 3,
@ -17,7 +17,7 @@ module.exports = class extends Command {
async run(message, args) {
let avatar = message.author.avatarURL;
let img = await new DIG.Blur().getImage(avatar);
message.chat.sendMessage("Please wait we're generating your image...");
message.chat.sendMessage(`Please wait we're generating your image...`);
message.chat.sendPhoto(img);
}
};

@ -1,12 +1,12 @@
let Command = require(`../../Structure/Command.js`);
const DIG = require("discord-image-generation");
const DIG = require(`discord-image-generation`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "circle",
description: "Return a circled image.",
category: "Images",
name: `circle`,
description: `Return a circled image.`,
category: `Images`,
enabled: true,
aliases: [],
cooldown: 3,
@ -17,7 +17,7 @@ module.exports = class extends Command {
async run(message, args) {
let avatar = message.author.avatarURL;
let img = await new DIG.Circle().getImage(avatar);
message.chat.sendMessage("Please wait we're generating your image...");
message.chat.sendMessage(`Please wait we're generating your image...`);
message.chat.sendPhoto(img);
}
};

@ -1,12 +1,12 @@
let Command = require(`../../Structure/Command.js`);
const DIG = require("discord-image-generation");
const DIG = require(`discord-image-generation`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "confusedstonk",
description: "Return a confused stonk image.",
category: "Images",
name: `confusedstonk`,
description: `Return a confused stonk image.`,
category: `Images`,
enabled: true,
aliases: [],
cooldown: 3,
@ -17,7 +17,7 @@ module.exports = class extends Command {
async run(message, args) {
let avatar = message.author.avatarURL;
let img = await new DIG.ConfusedStonk().getImage(avatar);
message.chat.sendMessage("Please wait we're generating your image...");
message.chat.sendMessage(`Please wait we're generating your image...`);
message.chat.sendPhoto(img);
}
};

@ -1,12 +1,12 @@
let Command = require(`../../Structure/Command.js`);
const DIG = require("discord-image-generation");
const DIG = require(`discord-image-generation`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "delete",
description: "Return a dalete image.",
category: "Images",
name: `delete`,
description: `Return a dalete image.`,
category: `Images`,
enabled: true,
aliases: [],
cooldown: 3,
@ -17,7 +17,7 @@ module.exports = class extends Command {
async run(message, args) {
let avatar = message.author.avatarURL;
let img = await new DIG.Delete().getImage(avatar);
message.chat.sendMessage("Please wait we're generating your image...");
message.chat.sendMessage(`Please wait we're generating your image...`);
message.chat.sendPhoto(img);
}
};

@ -1,12 +1,12 @@
let Command = require(`../../Structure/Command.js`);
const DIG = require("discord-image-generation");
const DIG = require(`discord-image-generation`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "facepalm",
description: "Return a facepalm.",
category: "Images",
name: `facepalm`,
description: `Return a facepalm.`,
category: `Images`,
enabled: true,
aliases: [],
cooldown: 3,
@ -17,7 +17,7 @@ module.exports = class extends Command {
async run(message, args) {
let avatar = message.author.avatarURL;
let img = await new DIG.Facepalm().getImage(avatar);
message.chat.sendMessage("Please wait we're generating your image...");
message.chat.sendMessage(`Please wait we're generating your image...`);
message.chat.sendPhoto(img);
}
};

@ -1,12 +1,12 @@
let Command = require(`../../Structure/Command.js`);
const DIG = require("discord-image-generation");
const DIG = require(`discord-image-generation`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "gay",
description: "Return a gay image.",
category: "Images",
name: `gay`,
description: `Return a gay image.`,
category: `Images`,
enabled: true,
aliases: [],
cooldown: 3,
@ -17,7 +17,7 @@ module.exports = class extends Command {
async run(message, args) {
let avatar = message.author.avatarURL;
let img = await new DIG.Gay().getImage(avatar);
message.chat.sendMessage("Please wait we're generating your image...");
message.chat.sendMessage(`Please wait we're generating your image...`);
message.chat.sendPhoto(img);
}
};

@ -1,12 +1,12 @@
let Command = require(`../../Structure/Command.js`);
const DIG = require("discord-image-generation");
const DIG = require(`discord-image-generation`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "greyscale",
description: "Return a greyscaled image.",
category: "Images",
name: `greyscale`,
description: `Return a greyscaled image.`,
category: `Images`,
enabled: true,
aliases: [],
cooldown: 3,
@ -17,7 +17,7 @@ module.exports = class extends Command {
async run(message, args) {
let avatar = message.author.avatarURL;
let img = await new DIG.Greyscale().getImage(avatar);
message.chat.sendMessage("Please wait we're generating your image...");
message.chat.sendMessage(`Please wait we're generating your image...`);
message.chat.sendPhoto(img);
}
};

@ -1,12 +1,12 @@
let Command = require(`../../Structure/Command.js`);
const DIG = require("discord-image-generation");
const DIG = require(`discord-image-generation`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "hitler",
description: "Return an hitler image.",
category: "Images",
name: `hitler`,
description: `Return an hitler image.`,
category: `Images`,
enabled: true,
aliases: [],
cooldown: 3,
@ -17,7 +17,7 @@ module.exports = class extends Command {
async run(message, args) {
let avatar = message.author.avatarURL;
let img = await new DIG.Hitler().getImage(avatar);
message.chat.sendMessage("Please wait we're generating your image...");
message.chat.sendMessage(`Please wait we're generating your image...`);
message.chat.sendPhoto(img);
}
};

@ -1,12 +1,12 @@
let Command = require(`../../Structure/Command.js`);
const DIG = require("discord-image-generation");
const DIG = require(`discord-image-generation`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "invert",
description: "Returnan inverted image.",
category: "Images",
name: `invert`,
description: `Returnan inverted image.`,
category: `Images`,
enabled: true,
aliases: [],
cooldown: 3,
@ -17,7 +17,7 @@ module.exports = class extends Command {
async run(message, args) {
let avatar = message.author.avatarURL;
let img = await new DIG.Invert().getImage(avatar);
message.chat.sendMessage("Please wait we're generating your image...");
message.chat.sendMessage(`Please wait we're generating your image...`);
message.chat.sendPhoto(img);
}
};

@ -1,12 +1,12 @@
let Command = require(`../../Structure/Command.js`);
const DIG = require("discord-image-generation");
const DIG = require(`discord-image-generation`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "jail",
description: "Return a jail image.",
category: "Images",
name: `jail`,
description: `Return a jail image.`,
category: `Images`,
enabled: true,
aliases: [],
cooldown: 3,
@ -17,7 +17,7 @@ module.exports = class extends Command {
async run(message, args) {
let avatar = message.author.avatarURL;
let img = await new DIG.Jail().getImage(avatar);
message.chat.sendMessage("Please wait we're generating your image...");
message.chat.sendMessage(`Please wait we're generating your image...`);
message.chat.sendPhoto(img);
}
};

@ -1,24 +1,24 @@
let Command = require(`../../Structure/Command.js`);
const DIG = require("discord-image-generation");
const DIG = require(`discord-image-generation`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "lisapresentation",
description: "Return a lisa presentation image.",
category: "Images",
name: `lisapresentation`,
description: `Return a lisa presentation image.`,
category: `Images`,
enabled: true,
aliases: ["lisa"],
aliases: [`lisa`],
cooldown: 3,
dmOnly: false,
});
}
async run(message, args) {
let text = args.join(" ")
let text = args.join(` `)
if(!text) text = message.author.username;
let img = await new DIG.LisaPresentation().getImage(text);
message.chat.sendMessage("Please wait we're generating your image...");
message.chat.sendMessage(`Please wait we're generating your image...`);
message.chat.sendPhoto(img);
}
};

@ -1,12 +1,12 @@
let Command = require(`../../Structure/Command.js`);
const DIG = require("discord-image-generation");
const DIG = require(`discord-image-generation`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "mms",
description: "Return an m&ms image.",
category: "Images",
name: `mms`,
description: `Return an m&ms image.`,
category: `Images`,
enabled: true,
aliases: [],
cooldown: 3,
@ -17,7 +17,7 @@ module.exports = class extends Command {
async run(message, args) {
let avatar = message.author.avatarURL;
let img = await new DIG.Mms().getImage(avatar);
message.chat.sendMessage("Please wait we're generating your image...");
message.chat.sendMessage(`Please wait we're generating your image...`);
message.chat.sendPhoto(img);
}
};

@ -1,12 +1,12 @@
let Command = require(`../../Structure/Command.js`);
const DIG = require("discord-image-generation");
const DIG = require(`discord-image-generation`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "notstonk",
description: "Return a not stonk image.",
category: "Images",
name: `notstonk`,
description: `Return a not stonk image.`,
category: `Images`,
enabled: true,
aliases: [],
cooldown: 3,
@ -17,7 +17,7 @@ module.exports = class extends Command {
async run(message, args) {
let avatar = message.author.avatarURL;
let img = await new DIG.NotStonk().getImage(avatar);
message.chat.sendMessage("Please wait we're generating your image...");
message.chat.sendMessage(`Please wait we're generating your image...`);
message.chat.sendPhoto(img);
}
};

@ -1,12 +1,12 @@
let Command = require(`../../Structure/Command.js`);
const DIG = require("discord-image-generation");
const DIG = require(`discord-image-generation`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "poutine",
description: "Return a poutine image.",
category: "Images",
name: `poutine`,
description: `Return a poutine image.`,
category: `Images`,
enabled: true,
aliases: [],
cooldown: 3,
@ -17,7 +17,7 @@ module.exports = class extends Command {
async run(message, args) {
let avatar = message.author.avatarURL;
let img = await new DIG.Poutine().getImage(avatar);
message.chat.sendMessage("Please wait we're generating your image...");
message.chat.sendMessage(`Please wait we're generating your image...`);
message.chat.sendPhoto(img);
}
};

@ -1,12 +1,12 @@
let Command = require(`../../Structure/Command.js`);
const DIG = require("discord-image-generation");
const DIG = require(`discord-image-generation`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "rip",
description: "Return a RIP image.",
category: "Images",
name: `rip`,
description: `Return a RIP image.`,
category: `Images`,
enabled: true,
aliases: [],
cooldown: 3,
@ -17,7 +17,7 @@ module.exports = class extends Command {
async run(message, args) {
let avatar = message.author.avatarURL;
let img = await new DIG.Rip().getImage(avatar);
message.chat.sendMessage("Please wait we're generating your image...");
message.chat.sendMessage(`Please wait we're generating your image...`);
message.chat.sendPhoto(img);
}
};

@ -1,12 +1,12 @@
let Command = require(`../../Structure/Command.js`);
const DIG = require("discord-image-generation");
const DIG = require(`discord-image-generation`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "sepia",
description: "Return a sepia image.",
category: "Images",
name: `sepia`,
description: `Return a sepia image.`,
category: `Images`,
enabled: true,
aliases: [],
cooldown: 3,
@ -17,7 +17,7 @@ module.exports = class extends Command {
async run(message, args) {
let avatar = message.author.avatarURL;
let img = await new DIG.Sepia().getImage(avatar);
message.chat.sendMessage("Please wait we're generating your image...");
message.chat.sendMessage(`Please wait we're generating your image...`);
message.chat.sendPhoto(img);
}
};

@ -1,12 +1,12 @@
let Command = require(`../../Structure/Command.js`);
const DIG = require("discord-image-generation");
const DIG = require(`discord-image-generation`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "stonk",
description: "Return a stonk image.",
category: "Images",
name: `stonk`,
description: `Return a stonk image.`,
category: `Images`,
enabled: true,
aliases: [],
cooldown: 3,
@ -17,7 +17,7 @@ module.exports = class extends Command {
async run(message, args) {
let avatar = message.author.avatarURL;
let img = await new DIG.Stonk().getImage(avatar);
message.chat.sendMessage("Please wait we're generating your image...");
message.chat.sendMessage(`Please wait we're generating your image...`);
message.chat.sendPhoto(img);
}
};

@ -1,12 +1,12 @@
let Command = require(`../../Structure/Command.js`);
const DIG = require("discord-image-generation");
const DIG = require(`discord-image-generation`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "tatoo",
description: "Return a tatoo image.",
category: "Images",
name: `tatoo`,
description: `Return a tatoo image.`,
category: `Images`,
enabled: true,
aliases: [],
cooldown: 3,
@ -17,7 +17,7 @@ module.exports = class extends Command {
async run(message, args) {
let avatar = message.author.avatarURL;
let img = await new DIG.Tatoo().getImage(avatar);
message.chat.sendMessage("Please wait we're generating your image...");
message.chat.sendMessage(`Please wait we're generating your image...`);
message.chat.sendPhoto(img);
}
};

@ -1,12 +1,12 @@
let Command = require(`../../Structure/Command.js`);
const DIG = require("discord-image-generation");
const DIG = require(`discord-image-generation`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "thomas",
description: "Return a thomas image.",
category: "Images",
name: `thomas`,
description: `Return a thomas image.`,
category: `Images`,
enabled: true,
aliases: [],
cooldown: 3,
@ -17,7 +17,7 @@ module.exports = class extends Command {
async run(message, args) {
let avatar = message.author.avatarURL;
let img = await new DIG.Thomas().getImage(avatar);
message.chat.sendMessage("Please wait we're generating your image...");
message.chat.sendMessage(`Please wait we're generating your image...`);
message.chat.sendPhoto(img);
}
};

@ -1,12 +1,12 @@
let Command = require(`../../Structure/Command.js`);
const DIG = require("discord-image-generation");
const DIG = require(`discord-image-generation`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "trash",
description: "Return a trash image.",
category: "Images",
name: `trash`,
description: `Return a trash image.`,
category: `Images`,
enabled: true,
aliases: [],
cooldown: 3,
@ -17,7 +17,7 @@ module.exports = class extends Command {
async run(message, args) {
let avatar = message.author.avatarURL;
let img = await new DIG.Trash().getImage(avatar);
message.chat.sendMessage("Please wait we're generating your image...");
message.chat.sendMessage(`Please wait we're generating your image...`);
message.chat.sendPhoto(img);
}
};

@ -1,12 +1,12 @@
let Command = require(`../../Structure/Command.js`);
const DIG = require("discord-image-generation");
const DIG = require(`discord-image-generation`);
module.exports = class extends Command {
constructor(client) {
super(client, {
name: "wanted",
description: "Return a wanted image.",
category: "Images",
name: `wanted`,
description: `Return a wanted image.`,
category: `Images`,
enabled: true,
aliases: [],
cooldown: 3,
@ -16,8 +16,8 @@ module.exports = class extends Command {
async run(message, args) {
let avatar = message.author.avatarURL;
let img = await new DIG.Wanted().getImage(avatar, "$");
message.chat.sendMessage("Please wait we're generating your image...");
let img = await new DIG.Wanted().getImage(avatar, `$`);
message.chat.sendMessage(`Please wait we're generating your image...`);
message.chat.sendPhoto(img);
}
};

@ -4,11 +4,11 @@ module.exports = class {
}
async emit() {
this.client.logger.log(`Logged in as ${this.client.user.fullName} (${this.client.user.username}).`, "ready");
this.client.logger.log(`Followers: ${this.client.user.followerCount}`, "ready");
this.client.logger.log(`Following: ${this.client.user.followingCount}`, "ready");
this.client.logger.log(`Business : ${this.client.user.isBusiness}`, "ready");
this.client.logger.log(`Verified: ${this.client.user.isVerified}`, "ready");
this.client.logger.log(`Private: ${this.client.user.isPrivate}`, "ready");
this.client.logger.log(`Logged in as ${this.client.user.fullName} (${this.client.user.username}).`, `ready`);
this.client.logger.log(`Followers: ${this.client.user.followerCount}`, `ready`);
this.client.logger.log(`Following: ${this.client.user.followingCount}`, `ready`);
this.client.logger.log(`Business : ${this.client.user.isBusiness}`, `ready`);
this.client.logger.log(`Verified: ${this.client.user.isVerified}`, `ready`);
this.client.logger.log(`Private: ${this.client.user.isPrivate}`, `ready`);
}
}

@ -1,4 +1,4 @@
const Collection = require("@discordjs/collection");
const Collection = require(`@discordjs/collection`);
module.exports = class {
constructor(client) {
@ -31,13 +31,13 @@ module.exports = class {
this.client.commands.get(this.client.aliases.get(command));
if (!cmd) return;
this.client.logger.log(`${message.author.username} (${message.authorID}) ran command ${cmd.help.name}`, "cmd")
this.client.logger.log(`${message.author.username} (${message.authorID}) ran command ${cmd.help.name}`, `cmd`)
if (!cmd.conf.enabled) {
return message.chat.sendMessage("Sorry this command is disabled.");
return message.chat.sendMessage(`Sorry this command is disabled.`);
}
if (cmd.conf.dmOnly && message.chat.isGroup) {
return message.chat.sendMessage("Sorry this command is usable only in a private conversation.");
return message.chat.sendMessage(`Sorry this command is usable only in a private conversation.`);
}
if (!this.client.cooldowns.has(cmd.help.name)) {

@ -1,46 +1,46 @@
const { bgBlue, black, green } = require("chalk");
const { bgBlue, black, green } = require(`chalk`);
function dateTimePad(value, digits){
let number = value
while (number.toString().length < digits) {
number = "0" + number
number = `0` + number
}
return number;
}
function format(tDate){
return (tDate.getFullYear() + "-" +
dateTimePad((tDate.getMonth() + 1), 2) + "-" +
dateTimePad(tDate.getDate(), 2) + " " +
dateTimePad(tDate.getHours(), 2) + ":" +
dateTimePad(tDate.getMinutes(), 2) + ":" +
dateTimePad(tDate.getSeconds(), 2) + "." +
return (tDate.getFullYear() + `-` +
dateTimePad((tDate.getMonth() + 1), 2) + `-` +
dateTimePad(tDate.getDate(), 2) + ` ` +
dateTimePad(tDate.getHours(), 2) + `:` +
dateTimePad(tDate.getMinutes(), 2) + `:` +
dateTimePad(tDate.getSeconds(), 2) + `.` +
dateTimePad(tDate.getMilliseconds(), 3))
}
module.exports = class Logger {
static log (content, type = "log") {
static log (content, type = `log`) {
const date = `[${format(new Date(Date.now()))}]:`;
switch (type) {
case "log": {
case `log`: {
return console.log(`${date} ${bgBlue(type.toUpperCase())} ${content} `);
}
case "warn": {
case `warn`: {
return console.log(`${date} ${black.bgYellow(type.toUpperCase())} ${content} `);
}
case "error": {
case `error`: {
return console.log(`${date} ${black.bgRed(type.toUpperCase())} ${content} `);
}
case "debug": {
case `debug`: {
return console.log(`${date} ${green(type.toUpperCase())} ${content} `);
}
case "cmd": {
case `cmd`: {
return console.log(`${date} ${black.bgWhite(type.toUpperCase())} ${content}`);
}
case "ready": {
case `ready`: {
return console.log(`${date} ${black.bgGreen(type.toUpperCase())} ${content}`);
}
default: throw new TypeError("Logger type must be either warn, debug, log, ready, cmd or error.");
default: throw new TypeError(`Logger type must be either warn, debug, log, ready, cmd or error.`);
}
}
};

@ -1,7 +1,7 @@
const mongoose = require("mongoose"),
const mongoose = require(`mongoose`),
Schema = mongoose.Schema;
module.exports = mongoose.model("GroupMembers", new Schema({
module.exports = mongoose.model(`GroupMembers`, new Schema({
id: String,
groupID: String,
}));

@ -1,7 +1,7 @@
const mongoose = require("mongoose"),
const mongoose = require(`mongoose`),
Schema = mongoose.Schema;
module.exports = mongoose.model("Groups", new Schema({
module.exports = mongoose.model(`Groups`, new Schema({
groupID: String,
reminds: {
type: Array,

@ -1,7 +1,7 @@
const mongoose = require("mongoose"),
const mongoose = require(`mongoose`),
Schema = mongoose.Schema;
module.exports = mongoose.model("Users", new Schema({
module.exports = mongoose.model(`Users`, new Schema({
id: String,
reminds: {
type: Array,

@ -1,16 +1,16 @@
const { Client } = require("@androz2091/insta.js"),
Collection = require("@discordjs/collection")
path = require("path");
const { Client } = require(`@androz2091/insta.js`),
Collection = require(`@discordjs/collection`)
path = require(`path`);
class InstaBot extends Client {
constructor(options) {
super(options);
["commands", "aliases", "cooldowns"].forEach(x => this[x] = new Collection());
this.config = require("../config");
this.logger = require("../Helpers/logger");
this.usersData = require("../Models/Users");
this.groupsData = require("../Models/Groups")
this.groupMembersData = require("../Models/GroupMembers")
[`commands`, `aliases`, `cooldowns`].forEach(x => this[x] = new Collection());
this.config = require(`../config`);
this.logger = require(`../Helpers/logger`);
this.usersData = require(`../Models/Users`);
this.groupsData = require(`../Models/Groups`)
this.groupMembersData = require(`../Models/GroupMembers`)
this.databaseCache = {};
this.databaseCache.users = new Collection();
this.databaseCache.groups = new Collection();
@ -55,7 +55,7 @@ class InstaBot extends Client {
if (this.databaseCache.users.get(userID)) {
return isLean ? this.databaseCache.users.get(userID).toJSON() : this.databaseCache.users.get(userID);
} else {
let userData = (isLean ? await this.usersData.findOne({ id: userID }).populate("members").lean() : await this.usersData.findOne({ id: userID }).populate("members"));
let userData = (isLean ? await this.usersData.findOne({ id: userID }).populate(`members`).lean() : await this.usersData.findOne({ id: userID }).populate(`members`));
if (userData) {
if (!isLean) this.databaseCache.users.set(userID, userData);
return userData;
@ -72,7 +72,7 @@ class InstaBot extends Client {
if (this.databaseCache.groupMembers.get(`${userID}-${groupID}`)) {
return isLean ? this.databaseCache.groupMembers.get(`${userID}-${groupID}`).toJSON() : this.databaseCache.groupMembers.get(`${userID}-${groupID}`);
} else {
let groupMemberData = (isLean ? await this.groupMembersData.findOne({ id: userID, groupID: groupID }).populate("members").lean() : await this.groupMembersData.findOne({ id: userID, groupID: groupID }).populate("members"));
let groupMemberData = (isLean ? await this.groupMembersData.findOne({ id: userID, groupID: groupID }).populate(`members`).lean() : await this.groupMembersData.findOne({ id: userID, groupID: groupID }).populate(`members`));
if (groupMemberData) {
if (!isLean) this.databaseCache.groupMembers.set(`${userID}-${groupID}`, groupMemberData);
return groupMemberData;
@ -89,7 +89,7 @@ class InstaBot extends Client {
if (this.databaseCache.groups.get(groupID)) {
return isLean ? this.databaseCache.groupMembers.get(groupID).toJSON() : this.databaseCache.groupMembers.get(groupID);
} else {
let groupData = (isLean ? await this.groupMembersData.findOne({ groupID: groupID }).populate("members").lean() : await this.groupMembersData.findOne({ groupID: groupID }).populate("members"));
let groupData = (isLean ? await this.groupMembersData.findOne({ groupID: groupID }).populate(`members`).lean() : await this.groupMembersData.findOne({ groupID: groupID }).populate(`members`));
if (groupData) {
if (!isLean) this.databaseCache.groupMembers.set(groupID, groupData);
return groupData;

@ -1,37 +1,38 @@
const InstaBot = require("./Structure/Client"),
const InstaBot = require(`./Structure/Client`),
client = new InstaBot();
const util = require("util"),
fs = require("fs"),
const util = require(`util`),
fs = require(`fs`),
readdir = util.promisify(fs.readdir),
mongoose = require("mongoose");
require("dotenv").config();
mongoose = require(`mongoose`);
require(`dotenv`).config();
const initialize = async () => {
let directories = await readdir("./Commands/");
let directories = await readdir(`./Commands/`);
directories.forEach(async (dir) => {
let commands = await readdir("./Commands/" + dir + "/");
commands.filter((cmd) => cmd.split(".").pop() === "js").forEach((cmd) => {
const response = client.loadCommand("./Commands/" + dir, cmd);
let commands = await readdir(`./Commands/` + dir + `/`);
commands.filter((cmd) => cmd.split(`.`).pop() === `js`).forEach((cmd) => {
const response = client.loadCommand(`./Commands/` + dir, cmd);
if (response) {
client.logger.log(response, "error");
client.logger.log(response, `error`);
}
});
});
const evtFiles = await readdir("./Events/");
const evtFiles = await readdir(`./Events/`);
evtFiles.forEach((file) => {
const eventName = file.split(".")[0];
const eventName = file.split(`.`)[0];
const event = new (require(`./Events/${file}`))(client);
client.on(eventName, (...args) => event.emit(...args));
delete require.cache[require.resolve(`./Events/${file}`)];
});
client.login(process.env.BOTUSERNAME, process.env.PASSWORD);
client.on('rawFbns', (data) => console.log(data));
mongoose.connect(process.env.DATABASEURL, { useNewUrlParser: true, useUnifiedTopology: true }).then(() => {
client.logger.log("Connected to the Mongodb database.", "ready");
client.logger.log(`Connected to the Mongodb database.`, `ready`);
}).catch((err) => {
client.logger.log("Unable to connect to the Mongodb database. Error:"+err, "error");
client.logger.log(`Unable to connect to the Mongodb database. Error:`+err, `error`);
});
};
initialize();
Loading…
Cancel
Save