Merge pull request #397 from 13xforever/vnext

Small bugfixes
This commit is contained in:
Ilya 2019-08-30 19:28:27 +05:00 committed by GitHub
commit 964e04ef23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 55 additions and 15 deletions

View File

@ -172,6 +172,9 @@ Example usage:
{
var compatChannel = await discordClient.GetChannelAsync(Config.BotChannelId).ConfigureAwait(false);
var botMember = discordClient.GetMember(compatChannel.Guild, discordClient.CurrentUser);
if (botMember == null)
return false;
if (!compatChannel.PermissionsFor(botMember).HasPermission(Permissions.SendMessages))
{
NewBuildsMonitor.Reset();

View File

@ -16,7 +16,6 @@ namespace CompatBot.Database.Providers
{
internal static class ContentFilter
{
private static readonly object SyncObject = new object();
private static Dictionary<FilterContext, AhoCorasickDoubleArrayTrie<Piracystring>> filters = new Dictionary<FilterContext, AhoCorasickDoubleArrayTrie<Piracystring>>();
static ContentFilter()
@ -150,7 +149,7 @@ namespace CompatBot.Database.Providers
var rules = await client.GetChannelAsync(Config.BotRulesChannelId).ConfigureAwait(false);
msgContent = $"{message.Author.Mention} Please follow the {rules.Mention} and do not discuss piracy on this server. Repeated offence may result in a ban.";
}
await message.Channel.SendMessageAsync(msgContent).ConfigureAwait(false);
await message.Channel.SendMessageAsync($"{message.Author.Mention} {msgContent}").ConfigureAwait(false);
completedActions.Add(FilterAction.SendMessage);
}
catch (Exception e)

View File

@ -42,6 +42,17 @@ namespace CompatBot.EventHandlers
try
{
var botMember = client.GetMember(guild, client.CurrentUser);
if (botMember == null)
{
await Task.Delay(TimeSpan.FromSeconds(10)).ConfigureAwait(false);
botMember = client.GetMember(guild, client.CurrentUser);
if (botMember == null)
{
Config.Log.Error("Failed to resolve bot as the guild member for guild " + guild);
return;
}
}
var after = DateTime.UtcNow - Config.ModerationTimeThreshold;
foreach (var channel in guild.Channels.Values.Where(ch => !ch.IsCategory && ch.Type != ChannelType.Voice))
{

View File

@ -150,10 +150,21 @@ namespace CompatBot.EventHandlers
}
try
{
/*
botMsg = await botMsg.UpdateOrCreateMessageAsync(channel,
$"{message.Author.Mention}, please read carefully:",
embed: await result.AsEmbedAsync(client, message, source).ConfigureAwait(false)
).ConfigureAwait(false);
*/
botMsg = await botMsg.UpdateOrCreateMessageAsync(channel,
$"{message.Author.Mention}, please read carefully:\n" +
"🏴‍☠️ **Pirated content detected** 🏴‍☠️\n" +
"__You are being denied further support until you legally dump the game__.\n" +
"Please note that the RPCS3 community and its developers do not support piracy.\n" +
"Most of the issues with pirated dumps occur due to them being modified in some way " +
"that prevent them from working on RPCS3.\n" +
"If you need help obtaining valid working dump of the game you own, please read the quickstart guide at <https://rpcs3.net/quickstart>"
).ConfigureAwait(false);
}
catch (Exception e)
{

View File

@ -54,8 +54,8 @@ namespace CompatBot.Utils.ResultFormatters
links.Append(newLink);
}
result.AddField("System Software License Agreement", "You **must** read and agree with the terms described [here](https://doc.dl.playstation.net/doc/ps3-eula/) before downloading the update");
result.AddField("Download links", links.ToString().TrimEnd());
result.AddField("System Software License Agreement", "You **must** read and agree with the terms described [here](https://doc.dl.playstation.net/doc/ps3-eula/) before downloading");
result.AddField("Download Links", links.ToString().TrimEnd());
return result.WithFooter("Every region has identical firmware content");
}
}

View File

@ -78,6 +78,7 @@ namespace CompatBot.Utils.ResultFormatters
CheckGoWSettings(serial, items, notes);
CheckDesSettings(serial, items, notes, ppuPatches);
CheckTlouSettings(serial, items, notes);
CheckMgs4Settings(serial, items, notes);
}
else if (items["game_title"] == "vsh.self")
CheckVshSettings(items, notes);
@ -195,10 +196,9 @@ namespace CompatBot.Utils.ResultFormatters
}
if (items["lib_loader"] is string libLoader
&& libLoader.Contains("Auto", StringComparison.InvariantCultureIgnoreCase)
&& (libLoader == "Auto"
|| (libLoader.Contains("manual", StringComparison.InvariantCultureIgnoreCase) &&
string.IsNullOrEmpty(items["library_list"]))))
(string.IsNullOrEmpty(items["library_list"]) || items["library_list"] == "None"))))
{
if (items["game_title"] != "vsh.self")
notes.Add("⚠ Please use `Load liblv2.sprx only` as a `Library loader`");
@ -298,16 +298,16 @@ namespace CompatBot.Utils.ResultFormatters
private static void CheckJojoSettings(string serial, NameValueCollection items, List<string> notes)
{
if (AllStarBattleIds.Contains(serial) || serial == "BLJS10318" || serial == "NPJB00753")
{
if (items["audio_buffering"] == EnabledMark && items["audio_buffer_duration"] != "20")
{
if (items["audio_buffering"] == EnabledMark && items["audio_buffer_duration"] != "20")
{
notes.Add(" If you experience audio issues, set `Audio Buffer Duration` to `20ms`");
}
else if (items["audio_buffering"] == DisabledMark)
{
notes.Add(" If you experience audio issues, check `Enable Buffering` and set `Audio Buffer Duration` to `20ms`");
}
}
}
else if (items["audio_buffering"] == DisabledMark)
{
notes.Add(" If you experience audio issues, check `Enable Buffering` and set `Audio Buffer Duration` to `20ms`");
}
}
}
private static void CheckSimpsonsSettings(string serial, List<string> notes)
@ -492,6 +492,21 @@ namespace CompatBot.Utils.ResultFormatters
notes.Add("⚠ Please set `Resolution Scale` to 100%");
}
private static readonly HashSet<string> Mgs4Ids = new HashSet<string>
{
"BLAS55005", "BLES00246", "BLJM57001", "BLJM67001", "BLKS25001", "BLUS30109", "BLUS30148",
"NPEB00027", "NPEB02182", "NPEB90116", "NPJB00698", "NPJB90149", "NPUB31633",
"NPHB00065", "NPHB00067",
};
private static void CheckMgs4Settings(string serial, NameValueCollection items, List<string> notes)
{
if (!Mgs4Ids.Contains(serial))
return;
notes.Add(" Metal Gear Solid 4 just got ingame, and is still very unstable");
notes.Add(" There is no universal set of settings and game updates that works for everyone");
}
private static void CheckVshSettings(NameValueCollection items, List<string> notes)
{

View File

@ -158,7 +158,7 @@ namespace CompatBot.Utils.ResultFormatters
"and therefore act unpredictably on RPCS3.\n" +
"If you need help obtaining legal dumps, please read [the quickstart guide](https://rpcs3.net/quickstart).";
builder.WithColor(Config.Colors.LogAlert)
.WithTitle("Pirated release detected")
.WithTitle("Pirated content detected")
.WithDescription(msg);
}
else

View File

@ -9,6 +9,7 @@ namespace Tests
{
[TestCase("2019-8-19 6:00 PT", "2019-08-19T13:00Z")]
[TestCase("2019-8-19 17:00 bst", "2019-08-19T16:00Z")]
[TestCase("2019-9-1 22:00 jst", "2019-09-01T13:00Z")]
public void TimeZoneConverterTest(string input, string utcInput)
{
var utc = DateTime.Parse(utcInput).Normalize();