1+ module . exports = {
2+ name : "serverinfo" ,
3+ description : "Extra! Extra! Info on the server!" ,
4+ guildOnly : true ,
5+ authorizedGuilds : [ ] ,
6+ hidden : false ,
7+ permissions : [ "DEFAULT" ] ,
8+ cooldown : 5 ,
9+ aliases : [ ] ,
10+ syntax : [ ] ,
11+ execute : async ( app , message , args ) => {
12+ try {
13+ var guild = message . guild ,
14+ splashData = null ;
15+
16+ guild . acronym = guild . name . match ( / \b ( \w ) / g) . join ( "" ) ; // Cool thing
17+ console . log ( guild ) ;
18+
19+ var members = {
20+ "total" : guild . members . cache . size
21+ } ;
22+ members [ "users" ] = guild . members . cache . filter ( member => ! member . user . bot ) . size ;
23+ members [ "bots" ] = members . total - members . users ;
24+
25+
26+ var embed = {
27+ title : `${ app . config . system . emotes . information } **${ guild . name } **` ,
28+ color : app . config . system . embedColors . blue ,
29+ fields : [
30+ { name : "ID" , value : guild . id , inline : true } ,
31+ { name : "Acronym" , value : guild . acronym , inline : true } ,
32+ { name : "Boosts" , value : guild [ "premiumSubscriptionCount" ] . toString ( ) , inline : true } ,
33+ { name : "Preferred Locale" , value : guild . preferredLocale , inline : true } ,
34+ { name : "Owner" , value : `<@${ guild . ownerId } > (${ guild . ownerId } )` , inline : true } ,
35+ { name : "Features" , value : ( ( guild . features . length > 0 ) ? "`" + guild . features . join ( "`, `" ) + "`" : "No special features :(" ) } ,
36+
37+ { name : "Channels" , value : guild . channels . cache . size . toString ( ) , inline : true } ,
38+ { name : "Roles" , value : guild . roles . cache . size . toString ( ) , inline : true } ,
39+ { name : "Bans" , value : guild . bans . cache . size . toString ( ) , inline : true } ,
40+ { name : "Invites" , value : guild . invites . cache . size . toString ( ) , inline : true } ,
41+ { name : "Emojis" , value : guild . emojis . cache . size . toString ( ) , inline : true } ,
42+ { name : "Stickers" , value : guild . stickers . cache . size . toString ( ) , inline : true } ,
43+
44+ { name : "Total Members" , value : members . total . toString ( ) , inline : true } ,
45+ { name : "Users" , value : members . users . toString ( ) , inline : true } ,
46+ { name : "Bots" , value : members . bots . toString ( ) , inline : true }
47+
48+ ]
49+ } ;
50+
51+ if ( guild . description != null ) embed . description = guild . description ;
52+ if ( guild [ "vanityURLCode" ] ) embed . fields . push ( { name : "Vanity URL" , value : "https://discord.gg/" + guild [ "vanityURLCode" ] , inline : true } , { name : "Vanity URL Uses" , value : guild [ "vanityURLUses" ] . toString ( ) , inline : true } ) ;
53+
54+ embed . fields . push ( { "name" : "Server Created" , "value" : new Date ( guild . createdTimestamp ) . toString ( ) } , { "name" : app . name + " Joined" , "value" : new Date ( guild . joinedTimestamp ) . toString ( ) } ) ;
55+
56+ if ( guild . icon != null )
57+ embed . thumbnail = { url : `https://cdn.discordapp.com/icons/${ guild . id } /${ guild . icon } .${ app . functions . isAnimated ( guild . icon ) ? "gif" : "png" } ?size=1024` } ;
58+ if ( guild . splash != null )
59+ splashData = `https://cdn.discordapp.com/splashes/${ guild . id } /${ guild . splash } .${ app . functions . isAnimated ( guild . splash ) ? "gif" : "png" } ?size=600` ;
60+ if ( guild . banner != null )
61+ embed [ "image" ] = { url : `https://cdn.discordapp.com/banners/${ guild . id } /${ guild . banner } .${ app . functions . isAnimated ( guild . banner ) ? "gif" : "png" } ?size=512` } ;
62+
63+ var options = { embeds : [ embed ] } ;
64+ if ( splashData != null ) {
65+ const { MessageAttachment } = app . modules [ "discord.js" ] ;
66+ options . files = [ new MessageAttachment ( splashData ) ] ;
67+ } ;
68+
69+ app . functions . msgHandler ( message , options ) ;
70+
71+ } catch ( Ex ) {
72+ return app . functions . msgHandler ( message , {
73+ embeds : [ {
74+ description : `${ app . config . system . emotes . error } **${ Ex . message } **` ,
75+ color : app . config . system . embedColors . red ,
76+ } ]
77+ } ) ;
78+ } ;
79+ }
80+ } ;
0 commit comments