Skip to content

Commit

Permalink
Merge pull request #64 from GravityWolfNotAmused/revert-63-sunmoon-ta…
Browse files Browse the repository at this point in the history
…gs-and-time-tag-for-steam

Revert "Sunmoon tags and time tag for steam games"
  • Loading branch information
GravityWolfNotAmused committed Jan 13, 2024
2 parents 7ba2f07 + 468c980 commit 0e1a9da
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 41 deletions.
2 changes: 0 additions & 2 deletions DiscordPlayerCountBot/Bot/BotInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ public class BotInformation
public int ProviderType { get; set; } = 0;
public ulong? ChannelID { get; set; }
public string? StatusFormat { get; set; }
public int? SunriseHour { get; set; }
public int? SunsetHour { get; set; }

public Tuple<string, ushort> GetAddressAndPort()
{
Expand Down
17 changes: 2 additions & 15 deletions DiscordPlayerCountBot/Providers/BattleMetricsProvider.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using SteamQueryNet.Enums;

namespace PlayerCountBot.Providers
namespace PlayerCountBot.Providers
{
[Name("BattleMetrics")]
public class BattleMetricsProvider : ServerInformationProvider
Expand All @@ -23,18 +21,7 @@ public BattleMetricsProvider(BotInformation info) : base(info)

HandleLastException(information);

var model = server.GetViewModel();

if (!string.IsNullOrEmpty(model.Time) && TimeOnly.TryParse(model.Time, out var time))
{
if (information.SunriseHour.HasValue && information.SunsetHour.HasValue)
model.SunMoon = time.Hour > information.SunriseHour && time.Hour < information.SunsetHour ? "☀️" : "🌙";

if (!information.SunriseHour.HasValue || !information.SunsetHour.HasValue)
model.SunMoon = time.Hour > 6 && time.Hour < 20 ? "☀️" : "🌙";
}

return model;
return server.GetViewModel();
}
catch (Exception e)
{
Expand Down
22 changes: 1 addition & 21 deletions DiscordPlayerCountBot/Providers/SteamProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public SteamProvider(BotInformation info) : base(info)

HandleLastException(information);

var model = new SteamViewModel()
return new SteamViewModel()
{
Address = addressAndPort.Item1,
Port = addressAndPort.Item2,
Expand All @@ -31,26 +31,6 @@ public SteamProvider(BotInformation info) : base(info)
Gametype = response.gametype,
Map = response.map
};

var serverTime = model.Gametype.Split(",")
.Where(entry => entry.Contains(':') && entry.Length == 5)
.FirstOrDefault();

if (!string.IsNullOrEmpty(serverTime))
{
if (TimeOnly.TryParse(serverTime, out var time))
{
if (information.SunriseHour.HasValue && information.SunsetHour.HasValue)
model.SunMoon = time.Hour > information.SunriseHour && time.Hour < information.SunsetHour ? "☀️" : "🌙";

if (!information.SunriseHour.HasValue || !information.SunsetHour.HasValue)
model.SunMoon = time.Hour > 6 && time.Hour < 20 ? "☀️" : "🌙";

model.Time = serverTime;
}
}

return model;
}
catch (Exception e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ public class BattleMetricsViewModel : BaseViewModel
public string Time { get; set; }
public string GameMode { get; set; }
public int Rank { get; set; }
public string SunMoon { get; set; }
}
}
3 changes: 1 addition & 2 deletions DiscordPlayerCountBot/ViewModels/Steam/SteamViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ public class SteamViewModel : BaseViewModel
{
public string Map { get; set; }
public string Gametype { get; set; }
public string Time { get; set; }
public string SunMoon { get; set; }

}
}

0 comments on commit 0e1a9da

Please sign in to comment.