diff --git a/DisCatSharp/Net/Abstractions/ClientProperties.cs b/DisCatSharp/Net/Abstractions/ClientProperties.cs index c4a014c59..04a2d67b4 100644 --- a/DisCatSharp/Net/Abstractions/ClientProperties.cs +++ b/DisCatSharp/Net/Abstractions/ClientProperties.cs @@ -1,113 +1,113 @@ // This file is part of the DisCatSharp project, based off DSharpPlus. // // Copyright (c) 2021-2022 AITSYS // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. using System.Reflection; using System.Runtime.InteropServices; using Newtonsoft.Json; namespace DisCatSharp.Net.Abstractions; /// /// Represents data for identify payload's client properties. /// internal sealed class ClientProperties { /// /// Gets or sets the discord client. /// [JsonIgnore] public BaseDiscordClient Discord { get; set; } /// /// Gets the client's operating system. /// [JsonProperty("os")] public string OperatingSystem { get { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) return "windows"; else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) return "linux"; else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) return "osx"; var plat = RuntimeInformation.OSDescription.ToLowerInvariant(); if (plat.Contains("freebsd")) return "freebsd"; else if (plat.Contains("openbsd")) return "openbsd"; else if (plat.Contains("netbsd")) return "netbsd"; else if (plat.Contains("dragonfly")) return "dragonflybsd"; else if (plat.Contains("miros bsd") || plat.Contains("mirbsd")) return "miros bsd"; else if (plat.Contains("desktopbsd")) return "desktopbsd"; else return plat.Contains("darwin") ? "osx" : plat.Contains("unix") ? "unix" : "toaster (unknown)"; } } /// /// Gets the client's browser. /// [JsonProperty("browser")] public string Browser { get { if (this.Discord.Configuration.MobileStatus) return "Discord Android"; else { var a = typeof(DiscordClient).GetTypeInfo().Assembly; var an = a.GetName(); return $"DisCatSharp {an.Version.ToString(4)}"; } } } /// /// Gets the client's device. /// [JsonProperty("device")] public string Device => this.Browser; /// /// Gets the client's referrer. /// - [JsonProperty("$referrer")] + [JsonProperty("referrer")] public string Referrer => ""; /// /// Gets the client's referring domain. /// - [JsonProperty("$referring_domain")] + [JsonProperty("referring_domain")] public string ReferringDomain => ""; }