Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
1Mack committed Nov 27, 2023
1 parent 5f13d3b commit 9752111
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 8 deletions.
8 changes: 7 additions & 1 deletion CallAdmin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public partial class CallAdmin : BasePlugin, IPluginConfig<CallAdminConfig>
public override string ModuleDescription => "Report System with database support";
public override string ModuleAuthor => "1MaaaaaacK";
public override string ModuleVersion => "1.0";
public static int ConfigVersion => 1;

private string DatabaseConnectionString = string.Empty;

private DateTime[] commandCooldown = new DateTime[Server.MaxPlayers];
Expand All @@ -56,7 +58,11 @@ public async Task<string> SendMessageToDiscord(dynamic json, string? messageId =

var result = string.IsNullOrEmpty(messageId) ? httpClient.PostAsync($"{Config.WebHookUrl}?wait=true", content).Result : httpClient.PatchAsync($"{Config.WebHookUrl}/messages/{messageId}", content).Result;

if (!result.IsSuccessStatusCode) return "There was an error sending the webhook";
if (!result.IsSuccessStatusCode)
{
Console.WriteLine(result);
return "There was an error sending the webhook";
}

var toJson = JsonSerializer.Deserialize<IWebHookSuccess>(await result.Content.ReadAsStringAsync());
return string.IsNullOrEmpty(toJson?.id) ? "Não foi possível pegar o ID da mensagem" : toJson.id;
Expand Down
10 changes: 5 additions & 5 deletions Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public string Payload(string clientName, string clientSteamId, string targetName
},
new
{
name = "Suspeito",
name = "Suspect",
value =
$"**Name:** {targetName}\n**SteamID:** [{new SteamID(ulong.Parse(targetSteamId)).SteamId2}](https://steamcommunity.com/profiles/{targetSteamId}/)",
inline = true
Expand All @@ -217,14 +217,14 @@ public string Payload(string clientName, string clientSteamId, string targetName
},
new
{
name = "IP",
value = hostIp == "Empty" ? "Empty" : $"[{hostIp}](steam://connect/{hostIp})",
name = "Reason",
value = msg,
inline = true
},
new
{
name = "\u200B",
value = "\u200B",
name = "IP",
value = hostIp,
inline = true
},
new
Expand Down
4 changes: 2 additions & 2 deletions Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public partial class CallAdmin

public void OnConfigParsed(CallAdminConfig config)
{
if (config.Version != 4) throw new Exception($"You have a wrong config version. Delete it and restart the server to get the right version (4)!");
if (config.Version != ConfigVersion) throw new Exception($"You have a wrong config version. Delete it and restart the server to get the right version ({ConfigVersion})!");

if (string.IsNullOrEmpty(config.Database.Host) || string.IsNullOrEmpty(config.Database.Name) || string.IsNullOrEmpty(config.Database.User))
{
Expand All @@ -32,7 +32,7 @@ public void OnConfigParsed(CallAdminConfig config)
}
public class CallAdminConfig : BasePluginConfig
{
public override int Version { get; set; } = 4;
public override int Version { get; set; } = 1;

[JsonPropertyName("Prefix")]
public string Prefix { get; set; } = "[CallAdmin]";
Expand Down
Binary file modified bin/Debug/net7.0/CallAdmin.dll
Binary file not shown.
Binary file modified bin/Debug/net7.0/CallAdmin.pdb
Binary file not shown.
Binary file modified obj/Debug/net7.0/CallAdmin.dll
Binary file not shown.
Binary file modified obj/Debug/net7.0/CallAdmin.pdb
Binary file not shown.
Binary file modified obj/Debug/net7.0/ref/CallAdmin.dll
Binary file not shown.
Binary file modified obj/Debug/net7.0/refint/CallAdmin.dll
Binary file not shown.

0 comments on commit 9752111

Please sign in to comment.