-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from GravityWolfNotAmused/dev
1.0.9.1 Battle Metrics Update
- Loading branch information
Showing
35 changed files
with
493 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Linq; | ||
|
||
namespace DiscordPlayerCountBot.Attributes | ||
{ | ||
public static class AttributeHelper | ||
{ | ||
public static string GetNameFromAttribute(object obj) | ||
{ | ||
var nameAttribute = obj.GetType().GetCustomAttributes(true).Where(attribute => attribute.GetType() == typeof(NameAttribute)).Cast<NameAttribute>().FirstOrDefault(); | ||
var label = nameAttribute?.Name ?? obj.GetType().Name; | ||
return label; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
DiscordPlayerCountBot/Data/BattleMetrics/ServerListResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace DiscordPlayerCountBot.Data | ||
{ | ||
#nullable enable | ||
public class BattleMetricsServerDetails | ||
{ | ||
public List<string> modIds { get; set; } = new List<string>(); | ||
public List<string> modHashes { get; set; } = new List<string>(); | ||
public string? map { get; set; } | ||
public string? time { get; set; } | ||
public string? time_i { get; set; } | ||
public bool? official { get; set; } | ||
public string? gamemode { get; set; } | ||
public List<string>? modNames { get; set; } | ||
public bool? pve { get; set; } | ||
public bool? modded { get; set; } | ||
public bool? crossplay { get; set; } | ||
public string? session_flags { get; set; } | ||
public string? serverSteamId { get; set; } | ||
} | ||
|
||
public class BattleMetricsServerAttributes | ||
{ | ||
public string? id { get; set; } | ||
public string? name { get; set; } | ||
public string? address { get; set; } | ||
public string? ip { get; set; } | ||
public int? port { get; set; } | ||
public int? players { get; set; } | ||
public int? maxPlayers { get; set; } | ||
public int? rank { get; set; } | ||
public List<double> location { get; set; } = new List<double>(); | ||
public string? status { get; set; } | ||
public BattleMetricsServerDetails? details { get; set; } | ||
public bool? @private { get; set; } | ||
public DateTime? createdAt { get; set; } | ||
public DateTime? updatedAt { get; set; } | ||
public int? portQuery { get; set; } | ||
public string? country { get; set; } | ||
public string? queryStatus { get; set; } | ||
} | ||
|
||
public class BattleMetricsServerData | ||
{ | ||
public string? type { get; set; } | ||
public string? id { get; set; } | ||
public BattleMetricsServerAttributes? attributes { get; set; } | ||
public BattleMetricsServerRelationships? relationships { get; set; } | ||
} | ||
|
||
public class BattleMetricsServerGame | ||
{ | ||
public BattleMetricsServerData? data { get; set; } | ||
} | ||
|
||
public class BattleMetricsServerRelationships | ||
{ | ||
public BattleMetricsServerGame? game { get; set; } | ||
} | ||
|
||
public class Links | ||
{ | ||
public string? prev { get; set; } | ||
public string? next { get; set; } | ||
} | ||
|
||
public class BattleMetricsServerRoot | ||
{ | ||
public List<BattleMetricsServerData>? data { get; set; } | ||
public Links? links { get; set; } | ||
public List<object>? included { get; set; } | ||
} | ||
|
||
#nullable disable | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Discord; | ||
using Discord.WebSocket; | ||
using System.Threading.Tasks; | ||
|
||
namespace DiscordPlayerCountBot | ||
{ | ||
public static class DiscordClient | ||
{ | ||
public static async Task LoginAndStartAsync(this DiscordSocketClient client, string token, string address) | ||
{ | ||
await client.LoginAsync(TokenType.Bot, token); | ||
await client.SetGameAsync($"Starting: {address}"); | ||
await client.StartAsync(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ public enum DataProvider | |
STEAM, | ||
CFX, | ||
SCUM, | ||
MINECRAFT | ||
MINECRAFT, | ||
BATTLEMETRICS | ||
} | ||
} |
Oops, something went wrong.