@@ -19,7 +19,7 @@ public static async Task DebugCachedMessageChannelCommandAsync(SlashCommandConte
1919
2020 var success = Setup . State . Caches . MessageCache . TryGetMessageByChannel ( channelId , out var message ) ;
2121 if ( success )
22- await ctx . RespondAsync ( await message . ToFancyStringAsync ( ) ) ;
22+ await ctx . RespondAsync ( await message . GetInformationAsync ( ) ) ;
2323 else
2424 await ctx . FollowupAsync ( new DiscordFollowupMessageBuilder ( )
2525 . WithContent ( "No message cached for that channel" )
@@ -35,7 +35,7 @@ public static async Task DebugCachedMessageMessageCommandAsync(SlashCommandConte
3535
3636 var success = Setup . State . Caches . MessageCache . TryGetMessage ( messageId , out var message ) ;
3737 if ( success )
38- await ctx . RespondAsync ( await message . ToFancyStringAsync ( ) ) ;
38+ await ctx . RespondAsync ( await message . GetInformationAsync ( ) ) ;
3939 else
4040 await ctx . FollowupAsync ( new DiscordFollowupMessageBuilder ( )
4141 . WithContent ( "No message cached with that ID" )
@@ -51,7 +51,7 @@ public static async Task DebugCachedMessageAuthorCommandAsync(SlashCommandContex
5151
5252 var success = Setup . State . Caches . MessageCache . TryGetMessageByAuthor ( authorId , out var message ) ;
5353 if ( success )
54- await ctx . RespondAsync ( await message . ToFancyStringAsync ( ) ) ;
54+ await ctx . RespondAsync ( await message . GetInformationAsync ( ) ) ;
5555 else
5656 await ctx . FollowupAsync ( new DiscordFollowupMessageBuilder ( )
5757 . WithContent ( "No message cached by that author" )
@@ -67,15 +67,33 @@ public static async Task DebugCachedMessageStatsCommandAsync(SlashCommandContext
6767 var cachedMessagesCount = Setup . State . Caches . MessageCache . Count ( ) ;
6868 var uniqueChannelsCount = Setup . State . Caches . MessageCache . GetUniqueChannelCount ( ) ;
6969 var uniqueAuthorsCount = Setup . State . Caches . MessageCache . GetUniqueAuthorCount ( ) ;
70- var newestCachedMessage = Setup . State . Caches . MessageCache . GetNewestMessage ( ) ;
71- var oldestCachedMessage = Setup . State . Caches . MessageCache . GetOldestMessage ( ) ;
7270
7371 await ctx . FollowupAsync ( new DiscordFollowupMessageBuilder ( )
74- . WithContent ( $ "{ cachedMessagesCount } messages in cache, from { uniqueAuthorsCount } author{ ( uniqueAuthorsCount == 1 ? "" : "s" ) } across { uniqueChannelsCount } channels."
75- + $ "\n Newest message: { await newestCachedMessage . ToFancyStringAsync ( ) } "
76- + $ "\n Oldest message: { await oldestCachedMessage . ToFancyStringAsync ( ) } ")
72+ . WithContent ( $ "{ cachedMessagesCount } messages in cache, from { uniqueAuthorsCount } author{ ( uniqueAuthorsCount == 1 ? "" : "s" ) } across { uniqueChannelsCount } channels.")
7773 . AsEphemeral ( ephemeral : ctx . Interaction . ShouldUseEphemeralResponse ( false ) ) ) ;
7874 }
75+
76+ [ Command ( "newest" ) ]
77+ [ Description ( "Get the newest message from the message cache." ) ]
78+ public static async Task DebugCachedMessageNewestCommandAsync ( SlashCommandContext ctx ,
79+ [ Parameter ( "skip" ) , Description ( "The number of messages to skip over." ) ] int skip = 0 )
80+ {
81+ await ctx . DeferResponseAsync ( ephemeral : ctx . Interaction . ShouldUseEphemeralResponse ( false ) ) ;
82+
83+ await ctx . FollowupAsync ( new DiscordFollowupMessageBuilder ( )
84+ . WithContent ( await ( Setup . State . Caches . MessageCache . GetNewestMessage ( skip ) ) . GetInformationAsync ( ) ) ) ;
85+ }
86+
87+ [ Command ( "oldest" ) ]
88+ [ Description ( "Get the oldest message from the message cache." ) ]
89+ public static async Task DebugCachedMessageOldestCommandAsync ( SlashCommandContext ctx ,
90+ [ Parameter ( "skip" ) , Description ( "The number of messages to skip over." ) ] int skip = 0 )
91+ {
92+ await ctx . DeferResponseAsync ( ephemeral : ctx . Interaction . ShouldUseEphemeralResponse ( false ) ) ;
93+
94+ await ctx . FollowupAsync ( new DiscordFollowupMessageBuilder ( )
95+ . WithContent ( await ( Setup . State . Caches . MessageCache . GetOldestMessage ( skip ) ) . GetInformationAsync ( ) ) ) ;
96+ }
7997 }
8098
8199 [ Command ( "uptime" ) ]
0 commit comments