@@ -615,83 +615,6 @@ public async Task SearchMembersCmd(CommandContext ctx, string regex)
615615 await ctx . Channel . SendMessageAsync ( await StringHelpers . CodeOrHasteBinAsync ( JsonConvert . SerializeObject ( memberIdsTonames , Formatting . Indented ) , "json" ) ) ;
616616 }
617617
618- [ Command ( "rawmessage" ) ]
619- [ Description ( "Dumps the raw data for a message." ) ]
620- [ Aliases ( "rawmsg" ) ]
621- [ IsBotOwner ]
622- public async Task DumpRawMessage ( CommandContext ctx , [ Description ( "The message whose raw data to get." ) ] string msgLinkOrId )
623- {
624- DiscordMessage message ;
625- if ( Constants . RegexConstants . discord_link_rx . IsMatch ( msgLinkOrId ) )
626- {
627- // Assume the user provided a message link. Extract channel and message IDs to get message content.
628-
629- // Pattern to extract channel and message IDs from URL
630- var idPattern = new Regex ( @"(?:.*\/)([0-9]+)\/([0-9]+)$" ) ;
631-
632- // Get channel ID
633- var targetChannelId = Convert . ToUInt64 ( idPattern . Match ( msgLinkOrId ) . Groups [ 1 ] . ToString ( ) . Replace ( "/" , "" ) ) ;
634-
635- // Try to fetch channel
636- DiscordChannel channel ;
637- try
638- {
639- channel = await ctx . Client . GetChannelAsync ( targetChannelId ) ;
640- }
641- catch
642- {
643- await ctx . RespondAsync ( $ "{ Program . cfgjson . Emoji . Error } I couldn't fetch the channel from your message link! Please try again.") ;
644- return ;
645- }
646-
647- // Get message ID
648- var targetMessage = Convert . ToUInt64 ( idPattern . Match ( msgLinkOrId ) . Groups [ 2 ] . ToString ( ) . Replace ( "/" , "" ) ) ;
649-
650- // Try to fetch message
651- try
652- {
653- message = await channel . GetMessageAsync ( targetMessage ) ;
654- }
655- catch
656- {
657- await ctx . RespondAsync ( $ "{ Program . cfgjson . Emoji . Error } I couldn't fetch the message from your message link! Please try again.") ;
658- return ;
659- }
660- }
661- else
662- {
663- if ( msgLinkOrId . Length < 17 )
664- {
665- await ctx . RespondAsync ( $ "{ Program . cfgjson . Emoji . Error } That doesn't look right. Try again.") ;
666- return ;
667- }
668-
669- ulong messageId ;
670- try
671- {
672- messageId = Convert . ToUInt64 ( msgLinkOrId ) ;
673- }
674- catch
675- {
676- await ctx . RespondAsync ( $ "{ Program . cfgjson . Emoji . Error } That doesn't look like a valid message ID. Try again.") ;
677- return ;
678- }
679-
680- try
681- {
682- message = await ctx . Channel . GetMessageAsync ( messageId ) ;
683- }
684- catch
685- {
686- await ctx . RespondAsync ( $ "{ Program . cfgjson . Emoji . Error } I wasn't able to read that message! Please try again.") ;
687- return ;
688- }
689- }
690-
691- var rawMsgData = JsonConvert . SerializeObject ( message , Formatting . Indented ) ;
692- await ctx . RespondAsync ( await StringHelpers . CodeOrHasteBinAsync ( rawMsgData , "json" ) ) ;
693- }
694-
695618 private static async Task < ( bool success , ulong failedOverwrite ) > ImportOverridesFromChannelAsync ( DiscordChannel channel )
696619 {
697620 // Imports overrides from the specified channel to the database. See 'debug overrides import' and 'debug overrides importall'
0 commit comments