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 { Command } = require('discord-akairo');
|
||||||
|
const joinChannel = require('../../models').joinChannel;
|
||||||
|
|
||||||
class fakejoinCommand extends Command {
|
class fakejoinCommand extends Command {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -24,11 +25,16 @@ class fakejoinCommand extends Command {
|
||||||
|
|
||||||
async exec(message, args) {
|
async exec(message, args) {
|
||||||
let member;
|
let member;
|
||||||
|
const join = await joinChannel.findOne({where: {guildID: message.guild.id}});
|
||||||
|
|
||||||
|
if (join) {
|
||||||
if (args.user)
|
if (args.user)
|
||||||
member = message.guild.members.get(args.user.id);
|
member = message.guild.members.get(args.user.id);
|
||||||
else
|
else
|
||||||
member = message.guild.members.get(message.author.id);
|
member = message.guild.members.get(message.author.id);
|
||||||
|
} else {
|
||||||
|
return message.channel.send('There is no join channel setup');
|
||||||
|
}
|
||||||
|
|
||||||
this.client.emit('guildMemberAdd', member);
|
this.client.emit('guildMemberAdd', member);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
const { Command } = require('discord-akairo');
|
const { Command } = require('discord-akairo');
|
||||||
|
const leaveChannel = require('../../models').leaveChannel;
|
||||||
|
|
||||||
class fakeleaveCommand extends Command {
|
class fakeleaveCommand extends Command {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -24,10 +25,16 @@ class fakeleaveCommand extends Command {
|
||||||
|
|
||||||
async exec(message, args) {
|
async exec(message, args) {
|
||||||
let member;
|
let member;
|
||||||
|
const leave = await leaveChannel.findOne({where: {guildID: message.guild.id}});
|
||||||
|
|
||||||
|
if (leave) {
|
||||||
if (args.user)
|
if (args.user)
|
||||||
member = message.guild.members.get(args.user.id);
|
member = message.guild.members.get(args.user.id);
|
||||||
else
|
else
|
||||||
member = message.guild.members.get(message.author.id);
|
member = message.guild.members.get(message.author.id);
|
||||||
|
} else {
|
||||||
|
return message.channel.send('There is no leave channel setup');
|
||||||
|
}
|
||||||
|
|
||||||
this.client.emit('guildMemberRemove', member);
|
this.client.emit('guildMemberRemove', member);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue