@@ -2751,23 +2751,49 @@ class RustPlus extends RustPlusLib {
2751
2751
async getCommandTracker ( commandString ) {
2752
2752
const args = commandString . split ( ' ' ) ;
2753
2753
const subCommand = args [ 1 ] ?. toLowerCase ( ) ;
2754
- const playerId = args [ 2 ] ;
2755
- const trackerId = args [ 3 ] ?? null ;
2756
-
2757
- if ( playerId === null || playerId === undefined ) {
2758
- return ;
2754
+
2755
+ if ( subCommand === 'create' ) {
2756
+ const trackerIdParts = args . slice ( 2 ) ;
2757
+ const customTrackerId = trackerIdParts . length > 0 ? trackerIdParts . join ( ' ' ) : null ;
2758
+ return await this . createTracker ( customTrackerId ) ;
2759
2759
}
2760
2760
2761
2761
if ( subCommand === 'add' ) {
2762
+ const playerId = args [ 2 ] ;
2763
+ const trackerId = args . slice ( 3 ) . join ( ' ' ) . trim ( ) || null ;
2764
+ if ( ! playerId ) return ;
2762
2765
return await this . addPlayerToTracker ( trackerId , playerId ) ;
2763
2766
}
2764
2767
2765
2768
if ( subCommand === 'remove' ) {
2769
+ const playerId = args [ 2 ] ;
2770
+ const trackerId = args . slice ( 3 ) . join ( ' ' ) . trim ( ) || null ;
2771
+ if ( ! playerId ) return ;
2766
2772
return await this . removePlayerFromTracker ( trackerId , playerId ) ;
2767
2773
}
2774
+
2775
+ if ( ! args [ 2 ] ) return ;
2768
2776
}
2769
2777
2770
2778
2779
+ async createTracker ( inputTrackerId = null ) {
2780
+ const instance = Client . client . getInstance ( this . guildId ) ;
2781
+ const serverId = instance ?. activeServer ;
2782
+ if ( ! serverId ) {
2783
+ return Client . client . intlGet ( this . guildId , 'activeRustServerNotFound' ) ;
2784
+ }
2785
+
2786
+ const trackerId = await Client . client . createTrackerInstance ( this . guildId , serverId , inputTrackerId ) ;
2787
+
2788
+ if ( ! trackerId ) {
2789
+ return Client . client . intlGet ( this . guildId , 'trackerIdAlreadyExists' , { trackerId : inputTrackerId } ) ;
2790
+ }
2791
+
2792
+ await DiscordMessages . sendTrackerMessage ( this . guildId , trackerId ) ;
2793
+
2794
+ return Client . client . intlGet ( this . guildId , 'trackerCreated' , { trackerId } ) ;
2795
+ }
2796
+
2771
2797
async addPlayerToTracker ( trackerId , id ) {
2772
2798
const instance = Client . client . getInstance ( this . guildId ) ;
2773
2799
if ( ! instance ) {
0 commit comments