forked from Supositware/Haha-Yes
Chech if these files exists
This commit is contained in:
parent
da53c24feb
commit
e9f73ab462
3 changed files with 164 additions and 160 deletions
|
@ -1,5 +1,5 @@
|
||||||
const { Listener } = require('discord-akairo');
|
const { Listener } = require('discord-akairo');
|
||||||
const reload = require('auto-reload');
|
const fs = require('fs');
|
||||||
const rand = require('../../rand.js');
|
const rand = require('../../rand.js');
|
||||||
|
|
||||||
class guildMemberAddListener extends Listener {
|
class guildMemberAddListener extends Listener {
|
||||||
|
@ -11,8 +11,8 @@ class guildMemberAddListener extends Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
async exec(guild) {
|
async exec(guild) {
|
||||||
let welcome = reload(`../../welcome/${guild.guild.id}.json`);
|
if (fs.existsSync(`./welcome/${guild.guild.id}.json`)) {
|
||||||
|
let welcome = require(`../../welcome/${guild.guild.id}.json`);
|
||||||
const channel = this.client.channels.get(welcome['channel']);
|
const channel = this.client.channels.get(welcome['channel']);
|
||||||
|
|
||||||
let welcomeMessage = welcome['message'];
|
let welcomeMessage = welcome['message'];
|
||||||
|
@ -41,5 +41,6 @@ class guildMemberAddListener extends Listener {
|
||||||
return channel.send(welcomeMessage);
|
return channel.send(welcomeMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
module.exports = guildMemberAddListener;
|
module.exports = guildMemberAddListener;
|
|
@ -1,5 +1,5 @@
|
||||||
const { Listener } = require('discord-akairo');
|
const { Listener } = require('discord-akairo');
|
||||||
const reload = require('auto-reload');
|
const fs = require('fs');
|
||||||
const rand = require('../../rand.js');
|
const rand = require('../../rand.js');
|
||||||
|
|
||||||
class guildMemberRemoveListener extends Listener {
|
class guildMemberRemoveListener extends Listener {
|
||||||
|
@ -11,7 +11,8 @@ class guildMemberRemoveListener extends Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
async exec(guild) {
|
async exec(guild) {
|
||||||
let bye = reload(`../../bye/${guild.guild.id}.json`);
|
if (fs.existsSync(`./bye/${guild.guild.id}.json`)) {
|
||||||
|
let bye = require(`../../bye/${guild.guild.id}.json`);
|
||||||
|
|
||||||
const channel = this.client.channels.get(bye['channel']);
|
const channel = this.client.channels.get(bye['channel']);
|
||||||
|
|
||||||
|
@ -41,5 +42,6 @@ class guildMemberRemoveListener extends Listener {
|
||||||
return channel.send(byeMessage);
|
return channel.send(byeMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
module.exports = guildMemberRemoveListener;
|
module.exports = guildMemberRemoveListener;
|
|
@ -5,6 +5,7 @@ const reactObject = require('../../json/react.json');
|
||||||
const imgResponseObject = require('../../json/imgreply.json');
|
const imgResponseObject = require('../../json/imgreply.json');
|
||||||
const rand = require('../../rand.js');
|
const rand = require('../../rand.js');
|
||||||
const reload = require('auto-reload');
|
const reload = require('auto-reload');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
class messageListener extends Listener {
|
class messageListener extends Listener {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -41,12 +42,9 @@ class messageListener extends Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// User autoresponse
|
// User autoresponse
|
||||||
let customresponse;
|
|
||||||
try {
|
if (fs.existsSync(`./tag/${message.guild.id}.json`)) {
|
||||||
customresponse = reload(`../../tag/${message.guild.id}.json`);
|
let customresponse = require(`../../tag/${message.guild.id}.json`);
|
||||||
} catch (err) {
|
|
||||||
null;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if(customresponse[message_content]) {
|
if(customresponse[message_content]) {
|
||||||
|
@ -180,6 +178,9 @@ class messageListener extends Listener {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
null;
|
null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue