mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Add an IP lookup to the WebSocketBot
This commit is contained in:
parent
eb8ccc43d7
commit
0a149647b6
1 changed files with 11 additions and 2 deletions
|
|
@ -291,7 +291,17 @@ public class WebSocketBot : ChatBot
|
||||||
|
|
||||||
public WebSocketBot()
|
public WebSocketBot()
|
||||||
{
|
{
|
||||||
var match = Regex.Match(Config.Ip!, @"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}");
|
// Lookup the given address
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_ip = Dns.GetHostAddresses(Config.Ip!).First().ToString();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
// Set Ip to a non-acceptable value to fail the Ip check
|
||||||
|
_ip = "not found";
|
||||||
|
}
|
||||||
|
var match = Regex.Match(_ip, @"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}");
|
||||||
|
|
||||||
if (!match.Success)
|
if (!match.Success)
|
||||||
{
|
{
|
||||||
|
|
@ -305,7 +315,6 @@ public class WebSocketBot : ChatBot
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_ip = Config.Ip;
|
|
||||||
_port = Config.Port;
|
_port = Config.Port;
|
||||||
_password = Config.Password;
|
_password = Config.Password;
|
||||||
_authenticatedSessions = new();
|
_authenticatedSessions = new();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue