diff --git a/config.json.example b/config.json.example index f00a04d..9a62eca 100644 --- a/config.json.example +++ b/config.json.example @@ -1,14 +1,18 @@ { "token": "", "staff_channel": "", + "joinleave-logs": "", "ticket_category": "", - "ticket_bot": "557628352828014614", + "ticket_bot": "", "ticket_detect_phrase": "Welcome", "ticket_channel_prefix": "ticket-", "staff_ping": "@here", "auto_accept": { - "threshold": 5, - "remove_roles": [], - "add_roles": [] - } + "threshold": 4, + "remove_roles": [""], + "add_roles": [""], + "welcome_message": "Welcome %user%! Please be sure to read <#> and get some <#>!", + "welcome_channel": "" + }, + "ntfyUrl": "" } \ No newline at end of file diff --git a/index.js b/index.js index e0fcc79..d0d2d1d 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ const config = require("./config.json"); 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") var staffChannel; 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 process.on('unhandledRejection', (error) => { // Log a full error with line number