profanity determent actually reads the configuration enable setting :P

removed unneeded semi colon in template
fixed accidentally truncating last character of message in activity
This commit is contained in:
RaidMax 2018-03-29 23:13:40 -05:00
parent 25cefb8b6a
commit 1bdf4e63fc
6 changed files with 37 additions and 20 deletions

View File

@ -23,6 +23,9 @@ namespace ProfanityDeterment
public async Task OnEventAsync(Event E, Server S)
{
if (!Settings.Configuration().EnableProfanityDeterment)
return;
if (E.Type == Event.GType.Connect)
{
if (!ProfanityCounts.TryAdd(E.Origin.ClientId, new Tracking(E.Origin)))

View File

@ -11,6 +11,8 @@ namespace SharedLibrary.Configuration
public bool EnableSteppedHierarchy { get; set; }
public bool EnableClientVPNs { get; set; }
public bool EnableDiscordLink { get; set; }
public bool EnableCustomSayName { get; set; }
public string CustomSayName { get; set; }
public string DiscordInviteCode { get; set; }
public string IPHubAPIKey { get; set; }
public List<ServerConfiguration> Servers { get; set; }
@ -21,29 +23,22 @@ namespace SharedLibrary.Configuration
public IBaseConfiguration Generate()
{
Console.Write("Enable multiple owners? [y/n]: ");
EnableMultipleOwners = (Console.ReadLine().ToLower().FirstOrDefault() as char?) == 'y';
EnableMultipleOwners = Utilities.PromptBool("Enable multiple owners");
EnableSteppedHierarchy = Utilities.PromptBool("Enable stepped privilege hierarchy");
EnableCustomSayName = Utilities.PromptBool("Enable custom say name");
Console.Write("Enable stepped privilege hierarchy? [y/n]: ");
EnableSteppedHierarchy = (Console.ReadLine().ToLower().FirstOrDefault() as char?) == 'y';
if (EnableCustomSayName)
CustomSayName = Utilities.PromptString("Enter custom say name");
Console.Write("Enable client VPNs [y/n]: ");
EnableClientVPNs = (Console.ReadLine().ToLower().FirstOrDefault() as char?) == 'y';
EnableClientVPNs = Utilities.PromptBool("Enable client VPNS");
if (!EnableClientVPNs)
{
Console.Write("Enter iphub.info api key: ");
IPHubAPIKey = Console.ReadLine();
}
IPHubAPIKey = Utilities.PromptString("Enter iphub.info api key");
Console.Write("Display discord link on webfront [y/n]: ");
EnableDiscordLink = (Console.ReadLine().ToLower().FirstOrDefault() as char?) == 'y';
EnableDiscordLink = Utilities.PromptBool("Display discord link on webfront");
if (EnableDiscordLink)
{
Console.Write("Enter discord invite link: ");
DiscordInviteCode = Console.ReadLine();
}
DiscordInviteCode = Utilities.PromptString("Enter discord invite link");
return this;
}

View File

@ -42,6 +42,8 @@ namespace SharedLibrary
PlayerHistory = new Queue<PlayerHistory>();
ChatHistory = new List<ChatInfo>();
NextMessage = 0;
CustomSayEnabled = Manager.GetApplicationSettings().Configuration().EnableCustomSayName;
CustomSayName = Manager.GetApplicationSettings().Configuration().CustomSayName;
InitializeTokens();
InitializeAutoMessages();
}
@ -136,7 +138,7 @@ namespace SharedLibrary
string sayCommand = (GameName == Game.IW4) ? "sayraw" : "say";
#if !DEBUG
await this.ExecuteCommandAsync($"{sayCommand} {Message}");
await this.ExecuteCommandAsync($"{sayCommand} {(CustomSayEnabled ? CustomSayName : "")} {Message}");
#else
Logger.WriteVerbose(Message.StripColors());
#endif
@ -153,7 +155,7 @@ namespace SharedLibrary
#if !DEBUG
if (Target.ClientNumber > -1 && Message.Length > 0 && Target.Level != Player.Permission.Console)
await this.ExecuteCommandAsync($"{tellCommand} {Target.ClientNumber} {Message}^7");
await this.ExecuteCommandAsync($"{tellCommand} {Target.ClientNumber} {(CustomSayEnabled ? CustomSayName : "")} {Message}^7");
#else
Logger.WriteVerbose($"{Target.ClientNumber}->{Message.StripColors()}");
#endif
@ -322,6 +324,10 @@ namespace SharedLibrary
protected IFile LogFile;
protected DateTime LastPoll;
// only here for performance
private bool CustomSayEnabled;
private string CustomSayName;
//Remote
public IList<CommandResponseInfo> CommandResult = new List<CommandResponseInfo>();
}

View File

@ -396,5 +396,18 @@ namespace SharedLibrary
Console.Write($"{question}? [y/n]: ");
return (Console.ReadLine().ToLower().FirstOrDefault() as char?) == 'y';
}
public static string PromptString(string question)
{
Console.Write($"{question}: ");
string response;
do
{
response = Console.ReadLine();
} while (string.IsNullOrWhiteSpace(response));
return response;
}
}
}

View File

@ -20,7 +20,7 @@
}
if (Model.ChatHistory[i].Message != "CONNECTED" && Model.ChatHistory[i].Message != "DISCONNECTED")
{
<span class="text-light">@Model.ChatHistory[i].Name</span><span> &mdash; @message.Substring(0, Math.Min(50, message.Length - 1)) </span><br />
<span class="text-light">@Model.ChatHistory[i].Name</span><span> &mdash; @message.Substring(0, Math.Min(50, message.Length)) </span><br />
}
}
}

View File

@ -83,7 +83,7 @@
</div>
</div>
<div id="target_id">
@RenderSection("targetid", required: false);
@RenderSection("targetid", required: false)
</div>
<!-- End Action Modal -->