Update the !evergiven command to directly reflect what istheshipstillstuck.com says
This commit is contained in:
parent
41e0a9f8d7
commit
9ad39058ac
5 changed files with 21 additions and 144 deletions
|
@ -88,10 +88,6 @@
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
<LastGenOutput>Corona.Designer.cs</LastGenOutput>
|
<LastGenOutput>Corona.Designer.cs</LastGenOutput>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Update="Localization\Evergiven.resx">
|
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
|
||||||
<LastGenOutput>Evergiven.Designer.cs</LastGenOutput>
|
|
||||||
</EmbeddedResource>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Update="Localization\Ship.Designer.cs">
|
<Compile Update="Localization\Ship.Designer.cs">
|
||||||
|
@ -157,10 +153,5 @@
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DependentUpon>Corona.resx</DependentUpon>
|
<DependentUpon>Corona.resx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Update="Localization\Evergiven.Designer.cs">
|
|
||||||
<DesignTime>True</DesignTime>
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>Evergiven.resx</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Web;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Geekbot.Bot.Utils;
|
|
||||||
using Geekbot.Core;
|
using Geekbot.Core;
|
||||||
using Geekbot.Core.ErrorHandling;
|
using Geekbot.Core.ErrorHandling;
|
||||||
using Geekbot.Core.GuildSettingsManager;
|
using Geekbot.Core.GuildSettingsManager;
|
||||||
|
@ -29,17 +30,30 @@ namespace Geekbot.Bot.Commands.Utils
|
||||||
|
|
||||||
var doc = new HtmlDocument();
|
var doc = new HtmlDocument();
|
||||||
doc.LoadHtml(stringResponse);
|
doc.LoadHtml(stringResponse);
|
||||||
var yesOrNoNode = doc.DocumentNode.SelectNodes("//a").FirstOrDefault();
|
var statusNode = doc.DocumentNode.SelectNodes("//a").FirstOrDefault();
|
||||||
|
|
||||||
if (yesOrNoNode?.InnerHtml == "Yes.")
|
if (statusNode == null)
|
||||||
{
|
{
|
||||||
var stuckSince = DateTime.Now - new DateTime(2021, 03, 23, 10, 39, 0);
|
await ReplyAsync("Maybe, check <https://istheshipstillstuck.com/>");
|
||||||
var formatted = DateLocalization.FormatDateTimeAsRemaining(stuckSince);
|
|
||||||
await ReplyAsync(string.Format(Localization.Evergiven.StillStuck, formatted));// $"Ever Given is **still stuck** in the suez canal! It has been stuck for {formatted}");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await ReplyAsync(Localization.Evergiven.NotStuckAnymore);
|
var sb = new StringBuilder();
|
||||||
|
|
||||||
|
sb.Append($"Is that ship still stuck? {statusNode.InnerHtml}");
|
||||||
|
if (statusNode.Attributes.Contains("href"))
|
||||||
|
{
|
||||||
|
sb.Append($" {statusNode.Attributes["href"].Value}");
|
||||||
|
}
|
||||||
|
|
||||||
|
var stuckTimer = doc.DocumentNode.SelectNodes("//p")?.First(node => node.Attributes.First(attr => attr.Name == "style")?.Value == "text-align:center");
|
||||||
|
if (stuckTimer != null)
|
||||||
|
{
|
||||||
|
sb.AppendLine();
|
||||||
|
sb.AppendLine(HttpUtility.HtmlDecode(stuckTimer.InnerText));
|
||||||
|
}
|
||||||
|
|
||||||
|
await ReplyAsync(sb.ToString());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
81
src/Bot/Localization/Evergiven.Designer.cs
generated
81
src/Bot/Localization/Evergiven.Designer.cs
generated
|
@ -1,81 +0,0 @@
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// This code was generated by a tool.
|
|
||||||
// Runtime Version:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace Geekbot.Bot.Localization {
|
|
||||||
using System;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
|
||||||
/// </summary>
|
|
||||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
|
||||||
// class via a tool like ResGen or Visual Studio.
|
|
||||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
|
||||||
// with the /str option, or rebuild your VS project.
|
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
|
||||||
internal class Evergiven {
|
|
||||||
|
|
||||||
private static global::System.Resources.ResourceManager resourceMan;
|
|
||||||
|
|
||||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
|
||||||
|
|
||||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
|
||||||
internal Evergiven() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the cached ResourceManager instance used by this class.
|
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
|
||||||
get {
|
|
||||||
if (object.ReferenceEquals(resourceMan, null)) {
|
|
||||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Geekbot.Bot.Localization.Evergiven", typeof(Evergiven).Assembly);
|
|
||||||
resourceMan = temp;
|
|
||||||
}
|
|
||||||
return resourceMan;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Overrides the current thread's CurrentUICulture property for all
|
|
||||||
/// resource lookups using this strongly typed resource class.
|
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
internal static global::System.Globalization.CultureInfo Culture {
|
|
||||||
get {
|
|
||||||
return resourceCulture;
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
resourceCulture = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Seems like Ever Given has moved on, check https://istheshipstillstuck.com/.
|
|
||||||
/// </summary>
|
|
||||||
internal static string NotStuckAnymore {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("NotStuckAnymore", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Looks up a localized string similar to Ever Given is **still stuck** in the suez canal! It has been stuck for {0}.
|
|
||||||
/// </summary>
|
|
||||||
internal static string StillStuck {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("StillStuck", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
<root>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>1.3</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<data name="StillStuck" xml:space="preserve">
|
|
||||||
<value>Ever Given **steckt immer no fescht** im Suez Kanal! Es isch derte siit {0}</value>
|
|
||||||
</data>
|
|
||||||
<data name="NotStuckAnymore" xml:space="preserve">
|
|
||||||
<value>Es gseht danach us das Ever Given wiiter gange isch, gsehne https://istheshipstillstuck.com/</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
|
|
@ -1,27 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
|
|
||||||
<root>
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>1.3</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<data name="NotStuckAnymore" xml:space="preserve">
|
|
||||||
<value>Seems like Ever Given has moved on, check https://istheshipstillstuck.com/</value>
|
|
||||||
</data>
|
|
||||||
<data name="StillStuck" xml:space="preserve">
|
|
||||||
<value>Ever Given is **still stuck** in the suez canal! It has been stuck for {0}</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
|
Loading…
Reference in a new issue