Make ban command properly give a ban message instead of a placeholder (#5087)

This commit is contained in:
Saphire Lattice
2021-10-30 01:54:14 +07:00
committed by GitHub
parent 1ee833be6e
commit 1d136bf18b
3 changed files with 17 additions and 13 deletions

View File

@@ -52,5 +52,19 @@ namespace Content.Server.Database
BanningAdmin = banningAdmin;
Unban = unban;
}
public string DisconnectMessage
{
get {
var expires = "This is a permanent ban.";
if (this.ExpirationTime is { } expireTime)
{
var duration = expireTime - this.BanTime;
var utc = expireTime.ToUniversalTime();
expires = $"This ban is for {duration.TotalMinutes:N0} minutes and will expire at {utc:f} UTC.";
}
return $"You, or another user of this computer or connection, are banned from playing here.\nThe ban reason is: \"{this.Reason}\"\n{expires}";
}
}
}
}