forked from Supositware/Haha-Yes
Send a message when no join/leave channel is setup
This commit is contained in:
parent
951f2d763e
commit
64105bbc89
2 changed files with 21 additions and 8 deletions
|
@ -1,4 +1,5 @@
|
|||
const { Command } = require('discord-akairo');
|
||||
const joinChannel = require('../../models').joinChannel;
|
||||
|
||||
class fakejoinCommand extends Command {
|
||||
constructor() {
|
||||
|
@ -24,11 +25,16 @@ class fakejoinCommand extends Command {
|
|||
|
||||
async exec(message, args) {
|
||||
let member;
|
||||
const join = await joinChannel.findOne({where: {guildID: message.guild.id}});
|
||||
|
||||
if (join) {
|
||||
if (args.user)
|
||||
member = message.guild.members.get(args.user.id);
|
||||
else
|
||||
member = message.guild.members.get(message.author.id);
|
||||
} else {
|
||||
return message.channel.send('There is no join channel setup');
|
||||
}
|
||||
|
||||
this.client.emit('guildMemberAdd', member);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
const { Command } = require('discord-akairo');
|
||||
const leaveChannel = require('../../models').leaveChannel;
|
||||
|
||||
class fakeleaveCommand extends Command {
|
||||
constructor() {
|
||||
|
@ -24,10 +25,16 @@ class fakeleaveCommand extends Command {
|
|||
|
||||
async exec(message, args) {
|
||||
let member;
|
||||
const leave = await leaveChannel.findOne({where: {guildID: message.guild.id}});
|
||||
|
||||
if (leave) {
|
||||
if (args.user)
|
||||
member = message.guild.members.get(args.user.id);
|
||||
else
|
||||
member = message.guild.members.get(message.author.id);
|
||||
} else {
|
||||
return message.channel.send('There is no leave channel setup');
|
||||
}
|
||||
|
||||
this.client.emit('guildMemberRemove', member);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue