|
@ -25,47 +25,6 @@ client.on("guildCreate", async guild => { |
|
|
console.error; |
|
|
console.error; |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
// Create "Awesome Mod" category for other channels to reside in
|
|
|
|
|
|
guild.channels.create('Awesome Mod', { |
|
|
|
|
|
type: 'category', |
|
|
|
|
|
position: 1, |
|
|
|
|
|
// Remove view permissions from "@everyone"
|
|
|
|
|
|
permissionOverwrites: [{ |
|
|
|
|
|
id: guild.id, |
|
|
|
|
|
deny: ['VIEW_CHANNEL'], |
|
|
|
|
|
}] |
|
|
|
|
|
}) |
|
|
|
|
|
.then(channel => { |
|
|
|
|
|
// Create "#bot-logs" text channel to track message deletes, edits, and channel creations
|
|
|
|
|
|
guild.channels.create('bot-logs', { |
|
|
|
|
|
type: 'text', |
|
|
|
|
|
parent: channel.id, |
|
|
|
|
|
// Remove view permissions from "@everyone"
|
|
|
|
|
|
permissionOverwrites: [{ |
|
|
|
|
|
id: guild.id, |
|
|
|
|
|
deny: ['VIEW_CHANNEL'], |
|
|
|
|
|
}] |
|
|
|
|
|
}).then(channel => { |
|
|
|
|
|
// Add the ID of the "#bot-logs" channel to the database
|
|
|
|
|
|
collection.updateOne({ guild_id: guild.id }, { $set: { "bot_logs_id": `${channel.id}` } }); |
|
|
|
|
|
}); |
|
|
|
|
|
// Create "#role-requests" text channel to have people request roles
|
|
|
|
|
|
guild.channels.create('role-requests', { |
|
|
|
|
|
type: 'text', |
|
|
|
|
|
parent: channel.id, |
|
|
|
|
|
// Remove view permissions from "@everyone"
|
|
|
|
|
|
permissionOverwrites: [{ |
|
|
|
|
|
id: guild.id, |
|
|
|
|
|
allow: ['VIEW_CHANNEL'], |
|
|
|
|
|
}] |
|
|
|
|
|
}).then(channel => { |
|
|
|
|
|
// Add the ID of the "#bot-logs" channel to the database
|
|
|
|
|
|
collection.updateOne({ guild_id: guild.id }, { $set: { "role_requests_id": `${channel.id}` } }); |
|
|
|
|
|
// Add slowmode
|
|
|
|
|
|
channel.setRateLimitPerUser(60); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
client.on("guildDelete", async guild => { |
|
|
client.on("guildDelete", async guild => { |
|
@ -94,6 +53,9 @@ client.on("message", async message => { |
|
|
case `${prefix}help`: |
|
|
case `${prefix}help`: |
|
|
helpMessage(message); |
|
|
helpMessage(message); |
|
|
break; |
|
|
break; |
|
|
|
|
|
case `${prefix}startlogs`: |
|
|
|
|
|
startLogs(message); |
|
|
|
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (message.content.toLowerCase().startsWith(`${prefix}bulkdelete`)) { |
|
|
if (message.content.toLowerCase().startsWith(`${prefix}bulkdelete`)) { |
|
@ -113,6 +75,38 @@ client.on("message", async message => { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
async function startLogs(message) { |
|
|
|
|
|
if (!message.member.hasPermission("ADMINISTRATOR") { |
|
|
|
|
|
message.reply("you do not have admin permissions!"); |
|
|
|
|
|
return; |
|
|
|
|
|
}) |
|
|
|
|
|
collection.findOne({ guild_id: message.guild.id }, (error, result) => { |
|
|
|
|
|
if (error) { |
|
|
|
|
|
console.error; |
|
|
|
|
|
} |
|
|
|
|
|
if (result.botLogsChannel) { |
|
|
|
|
|
botLogsChannel = result.bot_logs_id; |
|
|
|
|
|
if (message.guild.channels.cache.get(botLogsChannel)) { |
|
|
|
|
|
message.reply('bot logs channel already exists!'); |
|
|
|
|
|
} else { |
|
|
|
|
|
// Create "#bot-logs" text channel to track message deletes, edits, and channel creations
|
|
|
|
|
|
message.guild.channels.create('bot-logs', { |
|
|
|
|
|
type: 'text', |
|
|
|
|
|
parent: channel.id, |
|
|
|
|
|
// Remove view permissions from "@everyone"
|
|
|
|
|
|
permissionOverwrites: [{ |
|
|
|
|
|
id: guild.id, |
|
|
|
|
|
deny: ['VIEW_CHANNEL'], |
|
|
|
|
|
}] |
|
|
|
|
|
}).then(channel => { |
|
|
|
|
|
// Add the ID of the "#bot-logs" channel to the database
|
|
|
|
|
|
collection.updateOne({ guild_id: guild.id }, { $set: { "bot_logs_id": `${channel.id}` } }); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
async function userInfo(message) { |
|
|
async function userInfo(message) { |
|
|
if (!message.content.split(" ")[1]) { |
|
|
if (!message.content.split(" ")[1]) { |
|
|
message.reply("query must contain at least 3 characters!") |
|
|
message.reply("query must contain at least 3 characters!") |
|
@ -422,16 +416,6 @@ async function roleRequest(message) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
collection.findOne({ guild_id: message.guild.id }, (error, result) => { |
|
|
|
|
|
if (error) { |
|
|
|
|
|
console.error; |
|
|
|
|
|
} |
|
|
|
|
|
roleChannel = result.role_requests_id; |
|
|
|
|
|
if (message.channel.id !== roleChannel) { |
|
|
|
|
|
message.reply(`wrong channel! Roles can only be requested in <#${roleChannel}>.`); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const verificationEmbed = new Discord.MessageEmbed() |
|
|
const verificationEmbed = new Discord.MessageEmbed() |
|
|
.setTitle(`\`${message.author.tag}\` would like the **${role.name}** role. Are they worthy?`) |
|
|
.setTitle(`\`${message.author.tag}\` would like the **${role.name}** role. Are they worthy?`) |
|
|
.setDescription("React to this message to verify") |
|
|
.setDescription("React to this message to verify") |
|
@ -455,7 +439,6 @@ async function roleRequest(message) { |
|
|
} |
|
|
} |
|
|
}).catch(verificationEmbed => { verificationEmbed.edit("TIMEOUT") }); |
|
|
}).catch(verificationEmbed => { verificationEmbed.edit("TIMEOUT") }); |
|
|
}).catch(console.error); |
|
|
}).catch(console.error); |
|
|
}); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function bulkDelete(message) { |
|
|
async function bulkDelete(message) { |
|
@ -513,10 +496,12 @@ client.on('messageDelete', message => { |
|
|
if (error) { |
|
|
if (error) { |
|
|
console.error; |
|
|
console.error; |
|
|
} |
|
|
} |
|
|
|
|
|
if (result.bot_logs_id) { |
|
|
botLogsChannel = result.bot_logs_id; |
|
|
botLogsChannel = result.bot_logs_id; |
|
|
if (message.guild.channels.cache.get(botLogsChannel)) { |
|
|
if (message.guild.channels.cache.get(botLogsChannel)) { |
|
|
message.guild.channels.cache.get(botLogsChannel).send(deleteEmbed).catch(console.error); |
|
|
message.guild.channels.cache.get(botLogsChannel).send(deleteEmbed).catch(console.error); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@ -534,10 +519,12 @@ client.on('messageDeleteBulk', messages => { |
|
|
if (error) { |
|
|
if (error) { |
|
|
console.error; |
|
|
console.error; |
|
|
} |
|
|
} |
|
|
|
|
|
if (result.bot_logs_id) { |
|
|
botLogsChannel = result.bot_logs_id; |
|
|
botLogsChannel = result.bot_logs_id; |
|
|
if (messagesChannel.guild.channels.cache.get(botLogsChannel)) { |
|
|
if (messagesChannel.guild.channels.cache.get(botLogsChannel)) { |
|
|
messagesChannel.guild.channels.cache.get(botLogsChannel).send(bulkDeleteEmbed).catch(console.error); |
|
|
messagesChannel.guild.channels.cache.get(botLogsChannel).send(bulkDeleteEmbed).catch(console.error); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@ -558,10 +545,12 @@ client.on('messageUpdate', (originalMessage, editedMessage) => { |
|
|
if (error) { |
|
|
if (error) { |
|
|
console.error; |
|
|
console.error; |
|
|
} |
|
|
} |
|
|
|
|
|
if (result.bot_logs_id) { |
|
|
botLogsChannel = result.bot_logs_id; |
|
|
botLogsChannel = result.bot_logs_id; |
|
|
if (editedMessage.guild.channels.cache.get(botLogsChannel)) { |
|
|
if (editedMessage.guild.channels.cache.get(botLogsChannel)) { |
|
|
editedMessage.guild.channels.cache.get(botLogsChannel).send(editEmbed).catch(console.error); |
|
|
editedMessage.guild.channels.cache.get(botLogsChannel).send(editEmbed).catch(console.error); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
@ -588,10 +577,12 @@ client.on('channelCreate', channel => { |
|
|
if (error) { |
|
|
if (error) { |
|
|
console.error; |
|
|
console.error; |
|
|
} |
|
|
} |
|
|
|
|
|
if (result.bot_logs_id) { |
|
|
botLogsChannel = result.bot_logs_id; |
|
|
botLogsChannel = result.bot_logs_id; |
|
|
if (channel.guild.channels.cache.get(botLogsChannel)) { |
|
|
if (channel.guild.channels.cache.get(botLogsChannel)) { |
|
|
channel.guild.channels.cache.get(botLogsChannel).send(channelCreateEmbed).catch(console.error); |
|
|
channel.guild.channels.cache.get(botLogsChannel).send(channelCreateEmbed).catch(console.error); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@ -615,6 +606,7 @@ client.on('messageReactionAdd', (messageReaction, user) => { |
|
|
if (error) { |
|
|
if (error) { |
|
|
console.error; |
|
|
console.error; |
|
|
} |
|
|
} |
|
|
|
|
|
if (result.bot_logs_id) |
|
|
botLogsChannel = result.bot_logs_id; |
|
|
botLogsChannel = result.bot_logs_id; |
|
|
if (messageReaction.message.guild.channels.cache.get(botLogsChannel)) { |
|
|
if (messageReaction.message.guild.channels.cache.get(botLogsChannel)) { |
|
|
messageReaction.message.guild.channels.cache.get(botLogsChannel).send(messageReactionAddEmbed).catch(console.error); |
|
|
messageReaction.message.guild.channels.cache.get(botLogsChannel).send(messageReactionAddEmbed).catch(console.error); |
|
@ -641,10 +633,12 @@ client.on('messageReactionRemove', (messageReaction, user) => { |
|
|
if (error) { |
|
|
if (error) { |
|
|
console.error; |
|
|
console.error; |
|
|
} |
|
|
} |
|
|
|
|
|
if (result.bot_logs_id) { |
|
|
botLogsChannel = result.bot_logs_id; |
|
|
botLogsChannel = result.bot_logs_id; |
|
|
if (messageReaction.message.guild.channels.cache.get(botLogsChannel)) { |
|
|
if (messageReaction.message.guild.channels.cache.get(botLogsChannel)) { |
|
|
messageReaction.message.guild.channels.cache.get(botLogsChannel).send(messageReactionRemoveEmbed).catch(console.error); |
|
|
messageReaction.message.guild.channels.cache.get(botLogsChannel).send(messageReactionRemoveEmbed).catch(console.error); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@ -661,10 +655,12 @@ client.on('roleCreate', role => { |
|
|
if (error) { |
|
|
if (error) { |
|
|
console.error; |
|
|
console.error; |
|
|
} |
|
|
} |
|
|
|
|
|
if (result.bot_logs_id) { |
|
|
botLogsChannel = result.bot_logs_id; |
|
|
botLogsChannel = result.bot_logs_id; |
|
|
if (role.guild.channels.cache.get(botLogsChannel)) { |
|
|
if (role.guild.channels.cache.get(botLogsChannel)) { |
|
|
role.guild.channels.cache.get(botLogsChannel).send(roleCreateEmbed).catch(console.error); |
|
|
role.guild.channels.cache.get(botLogsChannel).send(roleCreateEmbed).catch(console.error); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@ -681,10 +677,12 @@ client.on('roleDelete', role => { |
|
|
if (error) { |
|
|
if (error) { |
|
|
console.error; |
|
|
console.error; |
|
|
} |
|
|
} |
|
|
|
|
|
if (result.botLogsChannel) { |
|
|
botLogsChannel = result.bot_logs_id; |
|
|
botLogsChannel = result.bot_logs_id; |
|
|
if (role.guild.channels.cache.get(botLogsChannel)) { |
|
|
if (role.guild.channels.cache.get(botLogsChannel)) { |
|
|
role.guild.channels.cache.get(botLogsChannel).send(roleDeleteEmbed).catch(console.error); |
|
|
role.guild.channels.cache.get(botLogsChannel).send(roleDeleteEmbed).catch(console.error); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@ -701,10 +699,12 @@ client.on('roleUpdate', (oldRole, newRole) => { |
|
|
if (error) { |
|
|
if (error) { |
|
|
console.error; |
|
|
console.error; |
|
|
} |
|
|
} |
|
|
|
|
|
if (result.bot_logs_id) { |
|
|
botLogsChannel = result.bot_logs_id; |
|
|
botLogsChannel = result.bot_logs_id; |
|
|
if (newRole.guild.channels.cache.get(botLogsChannel)) { |
|
|
if (newRole.guild.channels.cache.get(botLogsChannel)) { |
|
|
newRole.guild.channels.cache.get(botLogsChannel).send(roleUpdateEmbed).catch(console.error); |
|
|
newRole.guild.channels.cache.get(botLogsChannel).send(roleUpdateEmbed).catch(console.error); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|