Skip to content

Commit 4c583c4

Browse files
committed
NeedSystem v1.1.1
- Added an option to set up a thumbnail
1 parent 32b2108 commit 4c583c4

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

NeedSystem.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Text.Json.Serialization;
66
using Microsoft.Extensions.Localization;
77
using CounterStrikeSharp.API.Modules.Commands;
8+
using CounterStrikeSharp.API.Modules.Cvars;
89

910
namespace NeedSystem;
1011

@@ -64,6 +65,12 @@ public class BaseConfigs : BasePluginConfig
6465
[JsonPropertyName("EmbedAuthorImage")]
6566
public string EmbedAuthorImage { get; set; } = "https://avatars.githubusercontent.com/u/61034981?v=4";
6667

68+
[JsonPropertyName("EmbedThumbnail")]
69+
public bool EmbedThumbnail { get; set; } = true;
70+
71+
[JsonPropertyName("EmbedThumbnailImage")]
72+
public string EmbedThumbnailImage { get; set; } = "https://avatars.githubusercontent.com/u/61034981?v=4";
73+
6774
}
6875

6976
public class NeedSystemBase : BasePlugin, IPluginConfig<BaseConfigs>
@@ -73,7 +80,7 @@ public class NeedSystemBase : BasePlugin, IPluginConfig<BaseConfigs>
7380
private Translator _translator;
7481

7582
public override string ModuleName => "NeedSystem";
76-
public override string ModuleVersion => "1.1.0";
83+
public override string ModuleVersion => "1.1.1";
7784
public override string ModuleAuthor => "luca.uy";
7885
public override string ModuleDescription => "Allows players to send a message to discord requesting players.";
7986

@@ -301,6 +308,10 @@ public void NeedCommand(CCSPlayerController? caller, string clientName)
301308
name = _translator["EmbedAuthorName"],
302309
url = Config.EmbedAuthorURL,
303310
icon_url = Config.EmbedAuthorImage
311+
} : null,
312+
thumbnail = Config.EmbedThumbnail ? new
313+
{
314+
url = Config.EmbedThumbnailImage,
304315
} : null
305316
};
306317

@@ -349,6 +360,16 @@ private async Task SendEmbedToDiscord(object embed)
349360
}
350361
}
351362

363+
private string GetHostname()
364+
{
365+
string hostname = ConVar.Find("hostname")?.StringValue ?? _translator["NeedInServerMessage"];
366+
if(string.IsNullOrEmpty(hostname) || hostname.Length <= 3)
367+
{
368+
hostname = _translator["NeedInServerMessage"];
369+
}
370+
return hostname;
371+
}
372+
352373
private string GetWebhook()
353374
{
354375
return Config.WebhookUrl;

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ https://github.com/user-attachments/assets/fca8fed1-c07c-4546-9972-dc1cd49ab769
3535
| `EmbedAuthor` | You can use this option to disable or enable the embed author. | **YES** |
3636
| `EmbedAuthorURL` | This will be the url that will be redirected to when a user clicks on the embed author. | **YES** |
3737
| `EmbedAuthorImage` | It will be the image (logo) that will appear as the author of the embed. | **YES** |
38+
| `EmbedThumbnail` | You can use this option to disable or enable the embed thumbnail. | **YES** |
39+
| `EmbedThumbnailImage` | It will be the image (logo) that will appear as the author of the embed. | **YES** |
3840

3941
## Configuration example
4042
```
@@ -43,6 +45,7 @@ https://github.com/user-attachments/assets/fca8fed1-c07c-4546-9972-dc1cd49ab769
4345
"IPandPORT": "45.235.99.18:27025",
4446
"CustomDomain": "https://crisisgamer.com/redirect/connect.php",
4547
"MentionRoleID": "1111767358881681519",
48+
"MentionMessage": true,
4649
"MaxServerPlayers": 12,
4750
"MinPlayers": 10,
4851
"CommandCooldownSeconds": 120,
@@ -55,7 +58,9 @@ https://github.com/user-attachments/assets/fca8fed1-c07c-4546-9972-dc1cd49ab769
5558
"EmbedFooterImage": "https://avatars.githubusercontent.com/u/61034981?v=4",
5659
"EmbedAuthor": false,
5760
"EmbedAuthorURL": "https://lucauy.dev",
58-
"EmbedAuthorImage": "https://avatars.githubusercontent.com/u/61034981?v=4"
61+
"EmbedAuthorImage": "https://avatars.githubusercontent.com/u/61034981?v=4",
62+
"EmbedThumbnail": true,
63+
"EmbedThumbnailImage": "https://avatars.githubusercontent.com/u/61034981?v=4",
5964
}
6065
```
6166

0 commit comments

Comments
 (0)