File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ const { SlashCommandBuilder } = require ( 'discord.js' ) ;
2+
3+ module . exports = {
4+ category : 'utility' ,
5+ data : new SlashCommandBuilder ( )
6+ . setName ( 'info' )
7+ . setDescription ( 'Get info about a user or a server!' )
8+ . addSubcommand ( subcommand =>
9+ subcommand
10+ . setName ( 'user' )
11+ . setDescription ( 'Info about a user' )
12+ // User object is a mention
13+ . addUserOption ( option => option . setName ( 'target' ) . setDescription ( 'The user' ) ) )
14+ . addSubcommand ( subcommand =>
15+ subcommand
16+ . setName ( 'server' )
17+ . setDescription ( 'Info about the server' ) ) ,
18+
19+
20+ async execute ( interaction ) {
21+ const subcommand = interaction . options . getSubcommand ( ) ;
22+ if ( subcommand === 'user' ) {
23+ const user = interaction . options . getUser ( 'target' ) ;
24+ if ( user ) {
25+ await interaction . reply ( `Username: ${ user . username } \nID: ${ user . id } ` ) ;
26+ } else {
27+ await interaction . reply ( 'User not found!' ) ;
28+ }
29+ } else if ( subcommand === 'server' ) {
30+ await interaction . reply ( `Server name: ${ interaction . guild . name } \nTotal members: ${ interaction . guild . memberCount } ` ) ;
31+ }
32+ } ,
33+ } ;
You can’t perform that action at this time.
0 commit comments