@ -43,36 +43,6 @@ client.on("ready", () => {
} ) ;
} ) ;
client . on ( "message" , async message => {
client . on ( "message" , async message => {
const filter = reaction => {
return reaction . emoji . name === '😎' ;
} ;
const collector = message . createReactionCollector ( filter ) ;
collector . on ( 'collect' , ( reaction , user ) => {
if ( reaction . count === 1 ) {
const kulboardEmbed = new Discord . MessageEmbed ( )
. setTitle ( "Very kül message" )
. setURL ( message . url )
. setAuthor ( message . author ? message . author . tag : "Unknown: click on the link to find out" , message . author ? message . author . avatarURL ( ) : client . user . defaultAvatarURL )
. addField ( "Message" , message . content )
. addField ( "Channel" , message . channel )
. setFooter ( "Message ID: " + message . id )
. setColor ( "00c5ff" )
. setTimestamp ( ) ;
collection . findOne ( { guild_id : message . guild . id } , ( error , result ) => {
if ( error ) {
console . error ;
}
if ( result . kulboard_id ) {
kulboardChannel = result . kulboard_id ;
if ( message . guild . channels . cache . get ( kulboardChannel ) ) {
message . guild . channels . cache . get ( kulboardChannel ) . send ( kulboardEmbed ) . catch ( console . error ) ;
}
}
} ) ;
}
} ) ;
if ( ! message . content . startsWith ( prefix ) || message . author . bot ) {
if ( ! message . content . startsWith ( prefix ) || message . author . bot ) {
return ; j
return ; j
}
}
@ -687,42 +657,32 @@ async function bulkDelete(message) {
} ) . catch ( console . error ) ;
} ) . catch ( console . error ) ;
}
}
client . on ( 'messageDelete' , message => {
client . on ( 'messageDelete' , msg => {
let messageContent = message . content ;
msg . channel . messages . fetch ( msg . id )
let messageAvatar ;
. then ( message => {
const messageID = message . id ;
const deleteEmbed = new Discord . MessageEmbed ( )
let messageAuthor ;
. setTitle ( 'Message Deleted' )
if ( message . author ) {
. setAuthor ( message . author . tag , message . author . avatarURL ( ) )
messageAuthor = message . author . tag ;
. setURL ( message . url )
messageAvatar = message . author . avatarURL ( ) ;
. addField ( 'Author' , message . author . tag )
} else {
. addField ( 'Message' , message . content )
messageAuthor = "Message was not cached" ;
. setThumbnail ( message . author . avatarURL ( ) )
messageAvatar = client . user . defaultAvatarURL ;
. setFooter ( "ID: " + message . id )
}
. setTimestamp ( )
if ( ! messageContent ) {
. setColor ( 'e7778b' ) ;
messageContent = "[NONE]" ;
}
const deleteEmbed = new Discord . MessageEmbed ( )
. setTitle ( 'Message Deleted' )
. setURL ( message . url )
. addField ( 'Author' , messageAuthor )
. addField ( 'Message' , messageContent )
. setThumbnail ( messageAvatar )
. setFooter ( "ID: " + messageID )
. setTimestamp ( )
. setColor ( 'e7778b' ) ;
collection . findOne ( { guild_id : message . guild . id } , ( error , result ) => {
collection . findOne ( { guild_id : message . guild . id } , ( error , result ) => {
if ( error ) {
if ( error ) {
console . error ;
console . error ;
}
}
if ( result . bot_logs_id ) {
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 ) ;
}
}
}
}
} ) ;
} ) ;
} ) ;
} ) ;
} ) ;
client . on ( 'messageDeleteBulk' , messages => {
client . on ( 'messageDeleteBulk' , messages => {
@ -807,22 +767,65 @@ client.on('channelCreate', channel => {
} ) ;
} ) ;
client . on ( 'messageReactionAdd' , ( messageReaction , user ) => {
client . on ( 'messageReactionAdd' , ( messageReaction , user ) => {
const userTag = user . tag ;
messageReaction . message . channel . messages . fetch ( messageReaction . message . id )
const emoji = messageReaction . emoji . name ;
. then ( message => {
const numEmoji = messageReaction . count ;
const emoji = messageReaction . emoji . name ;
let messageContent = messageReaction . message . content ;
const numEmoji = message . reactions . cache . get ( emoji ) . count ;
if ( ! messageContent ) {
const messageReactionAddEmbed = new Discord . MessageEmbed ( )
messageContent = "[NONE]" ;
. setTitle ( "Reaction Added" )
}
. setURL ( message . url )
let channelCategory ;
. addField ( "Message" , message . content )
const messageReactionAddEmbed = new Discord . MessageEmbed ( )
. addField ( "Reactions" , ` \` ${ user . tag } \` reacted with \` ${ emoji } \` , along with ${ numEmoji - 1 } other people in ${ messageReaction . message . channel } . ` )
. setTitle ( "Reaction Added" )
. setFooter ( "Message ID: " + messageReaction . message . id )
. setURL ( messageReaction . message . url )
. setThumbnail ( message . author . avatarURL ( ) )
. addField ( "Message" , messageContent )
. setTimestamp ( )
. addField ( "Reactions" , ` ${ userTag } reacted with ${ emoji } , along with ${ numEmoji - 1 } other people in ${ messageReaction . message . channel } . ` )
. setColor ( '00aaff' ) ;
. setFooter ( "Message ID: " + messageReaction . message . id )
. setTimestamp ( )
const kulboardEmbed = new Discord . MessageEmbed ( )
. setColor ( '00aaff' ) ;
. setTitle ( "Very kül message" )
. setURL ( message . url )
. setAuthor ( message . author , message . author . avatarURL ( ) )
. addField ( "Message" , message . content )
. addField ( "Channel" , message . channel )
. setThumbnail ( message . author . avatarURL ( ) )
. setFooter ( "Message ID: " + message . id )
. setColor ( "00c5ff" )
. setTimestamp ( ) ;
collection . findOne ( { guild_id : messageReaction . message . guild . id } , ( error , result ) => {
if ( error ) {
console . error ;
}
if ( result . bot_logs_id ) {
botLogsChannel = result . bot_logs_id ;
if ( message . guild . channels . cache . get ( botLogsChannel ) ) {
message . guild . channels . cache . get ( botLogsChannel ) . send ( messageReactionAddEmbed ) . catch ( console . error ) ;
}
if ( result . kulboard_id ) {
kulboardChannel = result . kulboard_id ;
if ( message . guild . channels . cache . get ( kulboardChannel ) ) {
message . guild . channels . cache . get ( kulboardChannel ) . send ( kulboardEmbed ) . catch ( console . error ) ;
}
}
}
} ) ;
} ) ;
} ) ;
client . on ( 'messageReactionRemove' , ( messageReaction , user ) => {
messageReaction . message . channel . messages . fetch ( messageReaction . message . id )
. then ( message => {
const emoji = messageReaction . emoji . name ;
const messageReactionRemoveEmbed = new Discord . MessageEmbed ( )
. setTitle ( "Reaction Removed" )
. setURL ( message . url )
. addField ( "Message" , message . content )
. addField ( "Reactions" , ` \` ${ user . tag } \` removed their reaction \` ${ emoji } \` in ${ messageReaction . message . channel } . ` )
. setFooter ( "Message ID: " + messageReaction . message . id )
. setThumbnail ( message . author . avatarURL ( ) )
. setTimestamp ( )
. setColor ( 'e7778b' ) ;
collection . findOne ( { guild_id : messageReaction . message . guild . id } , ( error , result ) => {
collection . findOne ( { guild_id : messageReaction . message . guild . id } , ( error , result ) => {
if ( error ) {
if ( error ) {
console . error ;
console . error ;
@ -830,38 +833,10 @@ client.on('messageReactionAdd', (messageReaction, user) => {
if ( result . bot_logs_id ) {
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 ( messageReactionAdd Embed ) . catch ( console . error ) ;
messageReaction . message . guild . channels . cache . get ( botLogsChannel ) . send ( messageReactionRemove Embed ) . catch ( console . error ) ;
}
}
}
}
} ) ;
} ) ;
} ) ;
client . on ( 'messageReactionRemove' , ( messageReaction , user ) => {
const userTag = user . tag ;
const emoji = messageReaction . emoji . name ;
let messageContent = messageReaction . message . content ;
if ( ! messageContent ) {
messageContent = "[NONE]" ;
}
let channelCategory ;
const messageReactionRemoveEmbed = new Discord . MessageEmbed ( )
. setTitle ( "Reaction Removed" )
. setURL ( messageReaction . message . url )
. addField ( "Message" , messageContent )
. addField ( "Reactions" , ` ${ userTag } removed their reaction ${ emoji } in ${ messageReaction . message . channel } . ` )
. setFooter ( "Message ID: " + messageReaction . message . id )
. setTimestamp ( )
. setColor ( 'e7778b' ) ;
collection . findOne ( { guild_id : messageReaction . message . guild . id } , ( error , result ) => {
if ( error ) {
console . error ;
}
if ( result . bot_logs_id ) {
botLogsChannel = result . bot_logs_id ;
if ( messageReaction . message . guild . channels . cache . get ( botLogsChannel ) ) {
messageReaction . message . guild . channels . cache . get ( botLogsChannel ) . send ( messageReactionRemoveEmbed ) . catch ( console . error ) ;
}
}
} ) ;
} ) ;
} ) ;
} ) ;
@ -910,8 +885,8 @@ client.on('roleDelete', role => {
} ) ;
} ) ;
client . on ( 'roleUpdate' , ( oldRole , newRole ) => {
client . on ( 'roleUpdate' , ( oldRole , newRole ) => {
/ * c o n s t r e m o v e d P e r m s = o l d R o l e . p e r m i s s i o n s . f i l t e r ( p e r m = > ! n e w R o l e . h a s P e r m i s s i o n ( p e r m ) ) ;
const removedPerms = oldRole . permissions . toArray ( ) . filter ( perm => ! newRole . permissions . has ( perm ) ) ;
const addedPerms = newRole . permissions . filter ( perm => ! oldRole . hasPermission ( perm ) ) ; * /
const addedPerms = newRole . permissions . toArray ( ) . filter ( perm => ! oldRole . permissions . has ( perm ) ) ;
const roleUpdateEmbed = new Discord . MessageEmbed ( )
const roleUpdateEmbed = new Discord . MessageEmbed ( )
. setTitle ( "Role Updated" )
. setTitle ( "Role Updated" )
. addField ( "Name" , ` ${ oldRole . name } >> ${ newRole . name } ` )
. addField ( "Name" , ` ${ oldRole . name } >> ${ newRole . name } ` )
@ -920,12 +895,12 @@ client.on('roleUpdate', (oldRole, newRole) => {
. setFooter ( "Role ID: " + newRole . id )
. setFooter ( "Role ID: " + newRole . id )
. setTimestamp ( )
. setTimestamp ( )
. setColor ( 'c9ff00' ) ;
. setColor ( 'c9ff00' ) ;
/ * i f ( r e m o v e d P e r m s . a r r a y ( ) . l e n g t h > 0 ) {
if ( removedPerms . length > 0 ) {
roleUpdateEmbed . addField ( "Permissions Removed" , removedPerms . map ( p => ` ${ p } ` ) . join ( ' • ' ) ) ;
roleUpdateEmbed . addField ( "Permissions Removed" , removedPerms . map ( p => ` \` ${ p } \` ` . toLowerCase ( ) ) . join ( ' • ' ) ) ;
}
if ( addedPerms . length > 0 ) {
roleUpdateEmbed . addField ( "Permissions Added" , addedPerms . map ( p => ` \` ${ p } \` ` . toLowerCase ( ) ) . join ( ' • ' ) ) ;
}
}
if ( addedPerms . array ( ) . length > 0 ) {
roleUpdateEmbed . addField ( "Permissions Added" , addedPerms . map ( p => ` ${ p } ` ) . join ( ' • ' ) ) ;
} * /
collection . findOne ( { guild_id : newRole . guild . id } , ( error , result ) => {
collection . findOne ( { guild_id : newRole . guild . id } , ( error , result ) => {
if ( error ) {
if ( error ) {
console . error ;
console . error ;