Player Report Webhook IssueSolved

The issue im having is its adding [spam] to the Report Subject


Here Is The Code:

private void OnPlayerReported(BasePlayer reporter, string targetName, string targetId, string subject, string message, string type)
        {
            var data = SzData(reporter);
            if (data != null)
            {
                data.hhh++;
                data.jb.Add(
                    new JuBaodata.GjDataB
                    {
                        time = FormatTime(),
                        aaa = reporter.displayName,
                        bbb = reporter.UserIDString,
                        ccc = targetName,
                        ddd = targetId,
                        eee = subject,
                        fff = message,
                        ggg = type
                    }
                );
                SaveData();
            }

            // Fetch reporter's avatar
            webrequest.Enqueue($"https://steamcommunity.com/profiles/{reporter.UserIDString}?xml=1", string.Empty, (reporterCode, reporterResult) =>
            {
                if (reporterCode >= 200 && reporterCode <= 204)
                {
                    string reporterAvatarUrl = new Regex(@"(?<=<avatarMedium>[\w\W]+)https://.+\.jpg(?=[\w\W]+<\/avatarMedium>)", RegexOptions.Compiled).Match(reporterResult).Value;

                    // Fetch reported player's avatar
                    webrequest.Enqueue($"https://steamcommunity.com/profiles/{targetId}?xml=1", string.Empty, (targetCode, targetResult) =>
                    {
                        if (targetCode >= 200 && targetCode <= 204)
                        {
                            string reportedAvatarUrl = new Regex(@"(?<=<avatarMedium>[\w\W]+)https://.+\.jpg(?=[\w\W]+<\/avatarMedium>)", RegexOptions.Compiled).Match(targetResult).Value;

                            // Prepare the embed content with updated color, improved readability, and timestamp
                            var embed = new FancyEmbed()
                            {
                                Title = "Player Reported",
                                Description = $@"
        **Reporter:**  
        **{reporter.displayName}** ({reporter.UserIDString})

        **Reported Player:**  
        **{targetName}** ({targetId})

        **Report Subject:**  
        {subject}

        **Report Message:**  
        {message}

        **Server:**  
        {ConVar.Server.hostname}
        ",
                                Author = new EmbedAuthor
                                {
                                    Name = reporter.displayName,
                                    IconUrl = reporterAvatarUrl
                                },
                                Thumbnail = new EmbedThumbnail
                                {
                                    Url = reportedAvatarUrl
                                },
                                Footer = new EmbedFooter
                                {
                                    Text = "Report System",
                                    IconUrl = "https://yourserver.url/icon.png" // Use a relevant icon
                                },
                                Color = 0xFFD6A5, // Updated color to FFD6A5
                                Timestamp = DateTime.UtcNow.ToString("o") // Setting the timestamp
                            };

                            // Send the embed to the Discord webhook, tagging the role
                            var messageObj = new FancyMessage()
                                .AsTTS(false)
                                .WithRoleMention(roleId) // Mentioning the role in the message
                                .WithEmbed(embed);

                            webrequest.Enqueue(webHook, messageObj.ToJson(), (sendCode, sendResponse) =>
                            {
                                if (sendCode != 200 && sendCode != 204)
                                {
                                    PrintWarning($"Discord didn't respond (down?) Code: {sendCode}, Response: {sendResponse}");
                                }
                                else
                                {
                                    Puts("Report sent successfully to Discord.");
                                }
                            }, this, RequestMethod.POST, new Dictionary<string, string>
                            {
                                ["Content-Type"] = "application/json"
                            });
                        }
                        else
                        {
                            PrintWarning("Failed to fetch reported player's avatar.");
                        }
                    }, this);
                }
                else
                {
                    PrintWarning("Failed to fetch reporter's avatar.");
                }
            }, this);
        }​

Issue Resolved

Locked automatically