1
- import { Bot , Command , CommandArgs , CommandMessage } from "@eazyautodelete/core" ;
2
- import { Cipher } from "crypto" ;
3
- import { ApplicationCommandOptionChoiceData , MessageActionRow } from "discord.js" ;
1
+ import { Bot , Command , CommandMessageArgs , CommandMessage } from "@eazyautodelete/core" ;
4
2
5
3
class HelpCommand extends Command {
6
4
constructor ( bot : Bot ) {
@@ -22,30 +20,36 @@ class HelpCommand extends Command {
22
20
] ;
23
21
}
24
22
25
- async run ( message : CommandMessage , args : CommandArgs ) : Promise < void > {
23
+ async run ( message : CommandMessage , args : CommandMessageArgs ) : Promise < void > {
26
24
const commandName = args . consume ( "command" ) ;
27
25
28
26
if ( ! commandName ) {
29
- const helpEmbed = this . embed
30
- . setDescription (
31
- message . translate ( "overview" ) +
27
+ await message . send (
28
+ {
29
+ ...this . embed ,
30
+ description :
31
+ message . translate ( "overview" ) +
32
32
"\n\n" +
33
33
this . bot . commands
34
34
. filter ( ( c : Command ) => c . permissionLevel != "botMod" && c . permissionLevel != "botAdmin" )
35
35
. map ( ( x : Command ) => `**/${ x . name } **:\n\\↪ ${ x . description } ` )
36
- . join ( "\n\n" )
37
- )
38
- . setTitle ( "**EazyAutodelete:** Help" ) ;
39
-
40
- const helpButtons = new MessageActionRow ( ) . addComponents ( [
41
- this . urlButton ( "https://eazyautodelete.xyz/discord" , "Support Server" , "<:discord:985860686963937320>" )
42
- . components [ 0 ] ,
43
- this . urlButton ( "https://eazyautodelete.xyz" , "Website" , "🌐" ) . components [ 0 ] ,
44
- this . urlButton ( "https://status.eazyautodelete.xyz" , "Status Page" , "📣" ) . components [ 0 ] ,
45
- this . urlButton ( "https://docs.eazyautodelete.xyz" , "Documentation" , "📖" ) . components [ 0 ] ,
46
- ] ) ;
47
-
48
- await message . send ( helpEmbed , true , helpButtons ) ;
36
+ . join ( "\n\n" ) ,
37
+ title : "**EazyAutodelete:** Help" ,
38
+ } ,
39
+ true ,
40
+ [
41
+ {
42
+ type : 1 ,
43
+ components : [
44
+ this . urlButton ( "https://eazyautodelete.xyz/discord" , "Support Server" , "<:discord:985860686963937320>" ) [ 0 ]
45
+ . components [ 0 ] ,
46
+ this . urlButton ( "https://eazyautodelete.xyz" , "Website" , "🌐" ) [ 0 ] . components [ 0 ] ,
47
+ this . urlButton ( "https://status.eazyautodelete.xyz" , "Status Page" , "📣" ) [ 0 ] . components [ 0 ] ,
48
+ this . urlButton ( "https://docs.eazyautodelete.xyz" , "Documentation" , "📖" ) [ 0 ] . components [ 0 ] ,
49
+ ] ,
50
+ } ,
51
+ ]
52
+ ) ;
49
53
return ;
50
54
} else if ( commandName ) {
51
55
const command = this . bot . commands . get ( commandName ) ;
@@ -54,29 +58,29 @@ class HelpCommand extends Command {
54
58
return ;
55
59
}
56
60
57
- const cmdHelpEmbed = this . embed
58
- . setTitle ( "Command: **/" + command . name + "**" )
59
- . setDescription ( command . description )
60
- . addFields ( [
61
- {
62
- name : "**" + message . translate ( "usage" ) + "**" ,
63
- value : "```\n/" + command . usage + "```" ,
64
- inline : false ,
65
- } ,
66
- {
67
- name : "**" + message . translate ( "example" ) + "**" ,
68
- value : "```\n" + command . examples . map ( ( x : string ) => `/${ x } ` ) . join ( "\n" ) + "```" ,
69
- inline : false ,
70
- } ,
71
- ] ) ;
61
+ const cmdHelpEmbed = this . embed ;
62
+ cmdHelpEmbed . title = "Command: **/" + command . name + "**" ;
63
+ cmdHelpEmbed . description = command . description ;
64
+ cmdHelpEmbed . fields = [
65
+ {
66
+ name : "**" + message . translate ( "usage" ) + "**" ,
67
+ value : "```\n/" + command . usage + "```" ,
68
+ inline : false ,
69
+ } ,
70
+ {
71
+ name : "**" + message . translate ( "example" ) + "**" ,
72
+ value : "```\n" + command . examples . map ( ( x : string ) => `/${ x } ` ) . join ( "\n" ) + "```" ,
73
+ inline : false ,
74
+ } ,
75
+ ] ;
72
76
73
77
await message . send ( cmdHelpEmbed , true ) ;
74
78
return ;
75
79
}
76
80
}
77
81
78
82
async autocompleteHandler ( query : string ) {
79
- const queries : ApplicationCommandOptionChoiceData [ ] = [ ] ;
83
+ const queries : { name : string ; value : string } [ ] = [ ] ;
80
84
const commands = this . bot . commands ;
81
85
82
86
commands
0 commit comments