add joinleave logs
This commit is contained in:
parent
71da6087f8
commit
af8eaa1a02
|
@ -1,14 +1,18 @@
|
||||||
{
|
{
|
||||||
"token": "",
|
"token": "",
|
||||||
"staff_channel": "",
|
"staff_channel": "",
|
||||||
|
"joinleave-logs": "",
|
||||||
"ticket_category": "",
|
"ticket_category": "",
|
||||||
"ticket_bot": "557628352828014614",
|
"ticket_bot": "",
|
||||||
"ticket_detect_phrase": "Welcome",
|
"ticket_detect_phrase": "Welcome",
|
||||||
"ticket_channel_prefix": "ticket-",
|
"ticket_channel_prefix": "ticket-",
|
||||||
"staff_ping": "@here",
|
"staff_ping": "@here",
|
||||||
"auto_accept": {
|
"auto_accept": {
|
||||||
"threshold": 5,
|
"threshold": 4,
|
||||||
"remove_roles": [],
|
"remove_roles": [""],
|
||||||
"add_roles": []
|
"add_roles": [""],
|
||||||
}
|
"welcome_message": "Welcome %user%! Please be sure to read <#> and get some <#>!",
|
||||||
|
"welcome_channel": ""
|
||||||
|
},
|
||||||
|
"ntfyUrl": ""
|
||||||
}
|
}
|
38
index.js
38
index.js
|
@ -1,6 +1,6 @@
|
||||||
const config = require("./config.json");
|
const config = require("./config.json");
|
||||||
const Discord = require("discord.js");
|
const Discord = require("discord.js");
|
||||||
const client = new Discord.Client({ intents: ["Guilds", "GuildMembers", "GuildMessages", "MessageContent", "GuildMessageReactions", "DirectMessageReactions"] })
|
const client = new Discord.Client({ intents: ["Guilds", "GuildMembers", "GuildMessages", "MessageContent", "GuildMessageReactions", "DirectMessageReactions", "GuildBans", "GuildPresences"] })
|
||||||
const colors = require("colors")
|
const colors = require("colors")
|
||||||
var staffChannel;
|
var staffChannel;
|
||||||
client.on("ready", () => {
|
client.on("ready", () => {
|
||||||
|
@ -412,6 +412,42 @@ client.on("interactionCreate", async (interaction) => {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
client.on("guildMemberAdd", async (member) => {
|
||||||
|
// Get the joinleave-log channel
|
||||||
|
let channel = client.channels.cache.get(config.joinleave_logs);
|
||||||
|
// If the channel is not found, return
|
||||||
|
if (!channel) return;
|
||||||
|
|
||||||
|
// Send the message
|
||||||
|
channel.send({
|
||||||
|
content: `:heavy_plus_sign: ${member} ${member.user.tag} (${member.user.id}) joined the server`
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on("guildMemberRemove", async (member) => {
|
||||||
|
// Get the joinleave-log channel
|
||||||
|
let channel = client.channels.cache.get(config.joinleave_logs);
|
||||||
|
// If the channel is not found, return
|
||||||
|
if (!channel) return;
|
||||||
|
|
||||||
|
// Send the message
|
||||||
|
channel.send({
|
||||||
|
content: `:heavy_minus_sign: ${member} ${member.user.tag} (${member.user.id}) left the server`
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on("guildBanAdd", async (member) => {
|
||||||
|
// Get the joinleave-log channel
|
||||||
|
let channel = client.channels.cache.get(config.joinleave_logs);
|
||||||
|
// If the channel is not found, return
|
||||||
|
if (!channel) return;
|
||||||
|
|
||||||
|
// Send the message
|
||||||
|
channel.send({
|
||||||
|
content: `:hammer: ${member.user} ${member.user.tag} (${member.user.id}) was banned`
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Lets actually handle exceptions now
|
// Lets actually handle exceptions now
|
||||||
process.on('unhandledRejection', (error) => {
|
process.on('unhandledRejection', (error) => {
|
||||||
// Log a full error with line number
|
// Log a full error with line number
|
||||||
|
|
Loading…
Reference in a new issue