mirror of
https://github.com/arthur-pbty/LazyBot.git
synced 2026-06-12 15:55:11 +02:00
finish organization event/command & add guild command in folder commands
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
const { Events } = require("discord.js");
|
||||
const db = require("../db");
|
||||
|
||||
module.exports = {
|
||||
name: Events.GuildMemberRemove,
|
||||
async execute(client, member) {
|
||||
db.get(
|
||||
"SELECT enabled, channel_id, message FROM goodbye_config WHERE guild_id = ?",
|
||||
[member.guild.id],
|
||||
(err, row) => {
|
||||
if (err || !row || !row.enabled) return;
|
||||
|
||||
let msg = row.message;
|
||||
|
||||
msg = msg
|
||||
.replace("{user}", member.user.username)
|
||||
.replace("{server}", member.guild.name);
|
||||
|
||||
const channel = member.guild.channels.cache.get(row.channel_id);
|
||||
if (channel) {
|
||||
channel.send(msg);
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user