11require ( 'dotenv' ) . config ( )
22const Discord = require ( 'discord.js' ) ;
33const usedCommand = new Set ( ) ;
4- const config = process . env ;
4+ const { prefix , ownerID } = process . env ;
55
6- module . exports . run = async ( bot , message , args ) => {
7- if ( usedCommand . has ( message . author . id ) ) {
8- message . reply ( "You cannot use " + config . prefix + "emmessage command beacuse of the cooldown." )
9- } else {
10- if ( message . content . toLowerCase ( ) . startsWith ( config . prefix + "emmessage" ) ) {
6+ exports . run = ( bot , message ) => {
117
12- if ( message . author . id !== config . ownerid ) {
13- return message . reply ( "You're not my developer to do that!" ) ;
14- }
8+ const { content, attachments } = message ;
159
16- const contentmsga = message . content . substr ( config . prefix . length ) ;
17- const contentmsg = contentmsga . substr ( 9 ) ;
18- var Attachment = ( message . attachments ) ;
10+ if ( usedCommand . has ( message . author . id ) ) {
11+ return message . reply ( `You cannot use ${ prefix } emmessage command beacuse of the cooldown.` )
12+ }
13+
14+ if ( message . author . id !== ownerID ) {
15+ return message . reply ( "You're not my developer to do that!" ) ;
16+ }
1917
20- if ( message . attachments . size > 0 ) {
21- const MEAEmbed = new Discord . MessageEmbed ( )
22- . setColor ( '#b491c8' )
23- . setTitle ( 'Prune Bot | Announcement' )
24- . setAuthor ( 'Join our Discord Server' , 'https://i.imgur.com/hKeHeEy.gif' , 'https://discord.io/LIMYAW' )
25- . setDescription ( contentmsg )
26- . setThumbnail ( 'https://i.imgur.com/ypxq7B9.png' )
27- . addFields (
28- { name : 'Github (Source Code)' , value : 'https://github.com/mashwishi/PruneBot' } ,
29- { name : 'Support the Developer:' , value : 'https://ko-fi.com/mashwishi' }
30- )
31- . setImage ( Attachment . array ( ) [ 0 ] . url )
32- . setTimestamp ( )
33- . setFooter ( 'PruneBot is created by Mashwishi' , 'https://i.imgur.com/DxWDaGv.png' ) ;
34-
35- return bot . guilds . cache . array ( ) . forEach ( guild => guild . owner . send ( MEAEmbed ) ) ;
36- }
37-
38- const MEEmbed = new Discord . MessageEmbed ( )
39- . setColor ( '#b491c8' )
40- . setTitle ( 'Prune Bot | Announcement' )
41- . setAuthor ( 'Join our Discord Server' , 'https://i.imgur.com/hKeHeEy.gif' , 'https://discord.io/LIMYAW' )
42- . setDescription ( contentmsg )
43- . setThumbnail ( 'https://i.imgur.com/ypxq7B9.png' )
44- . addFields (
45- { name : 'Github (Source Code)' , value : 'https://github.com/mashwishi/PruneBot' } ,
46- { name : 'Support the Developer:' , value : 'https://ko-fi.com/mashwishi' }
47- )
48- . setTimestamp ( )
49- . setFooter ( 'PruneBot is created by Mashwishi' , 'https://i.imgur.com/DxWDaGv.png' ) ;
50- bot . guilds . cache . array ( ) . forEach ( guild => guild . owner . send ( MEEmbed ) ) ;
18+ const description = content . substr ( prefix . length ) . substr ( 9 ) ;
19+ const embed = new Discord . MessageEmbed ( )
20+ . setColor ( '#b491c8' )
21+ . setTitle ( 'Prune Bot | Announcement' )
22+ . setAuthor (
23+ 'Join our Discord Server' ,
24+ 'https://i.imgur.com/hKeHeEy.gif' ,
25+ 'https://discord.io/LIMYAW' ,
26+ )
27+ . setDescription ( description )
28+ . setThumbnail ( 'https://i.imgur.com/ypxq7B9.png' )
29+ . addFields ( [
30+ { name : 'Github (Source Code)' , value : 'https://github.com/mashwishi/PruneBot' } ,
31+ { name : 'Support the Developer:' , value : 'https://ko-fi.com/mashwishi' }
32+ ] )
33+ . setFooter ( 'PruneBot is created by Mashwishi' , 'https://i.imgur.com/DxWDaGv.png' )
34+ . setTimestamp ( ) ;
5135
52- }
53- usedCommand . add ( message . author . id ) ;
54- setTimeout ( ( ) => {
55- usedCommand . delete ( message . author . id ) ;
56- } , 5000 ) ;
36+ if ( attachments . size > 0 ) {
37+ embed . setImage ( attachments . first ( ) . url )
5738 }
39+
40+ bot . guilds . cache . array ( ) . forEach ( guild => guild . owner . send ( embed ) ) ;
41+
42+ usedCommand . add ( message . author . id ) ;
43+ setTimeout ( ( ) => usedCommand . delete ( message . author . id ) , 5000 ) ;
5844}
5945
60- module . exports . config = {
46+ exports . config = {
6147 name : "emmessage" ,
6248 description : "" ,
6349 usage : "?emmessage" ,
6450 accessableby : "Admins" ,
6551 aliases : [ ]
66- }
52+ }
0 commit comments