diff --git a/DisCatSharp.Experimental/DisCatSharp.Experimental.csproj b/DisCatSharp.Experimental/DisCatSharp.Experimental.csproj index 9d8b3bd17..ef76b00bf 100644 --- a/DisCatSharp.Experimental/DisCatSharp.Experimental.csproj +++ b/DisCatSharp.Experimental/DisCatSharp.Experimental.csproj @@ -1,38 +1,39 @@ - + DisCatSharp.Experimental DisCatSharp.Experimental ..\DisCatSharp.Tools\DisCatSharp.ruleset DisCatSharp.Experimental DisCatSharp.Experimental Experimental changes for DisCatSharp. DisCatSharp,Experimental,Discord API Wrapper,Discord,Bots,Discord Bots,AITSYS,Net6 - Exe - net6 + + diff --git a/DisCatSharp.Experimental/DisCatSharp.cs b/DisCatSharp.Experimental/DisCatSharp.cs new file mode 100644 index 000000000..a22b03a61 --- /dev/null +++ b/DisCatSharp.Experimental/DisCatSharp.cs @@ -0,0 +1,48 @@ +// 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; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using DisCatSharp; +using DisCatSharp.Entities; +using DisCatSharp.Enums; +using DisCatSharp.EventArgs; +using DisCatSharp.Exceptions; + +namespace DisCatSharp.Experimental +{ + public static class DisCatSharp + { + internal static DiscordApiClientHook Hook { get; set; } + + public static async Task<(string FullyQualifiedUsername, DiscordUser User)> GetUserV2Async(this DiscordClient client, ulong id) + { + Hook = new(client.ApiClient); + var user = await Hook.ApiClient.GetUserAsync(id); + return (user.UsernameWithDiscriminator, user); + } + } +} diff --git a/DisCatSharp.Experimental/DiscordApiClientHook.cs b/DisCatSharp.Experimental/DiscordApiClientHook.cs new file mode 100644 index 000000000..4a5f3ab87 --- /dev/null +++ b/DisCatSharp.Experimental/DiscordApiClientHook.cs @@ -0,0 +1,42 @@ +// 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; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using DisCatSharp.Net; + +namespace DisCatSharp.Experimental +{ + internal class DiscordApiClientHook + { + internal DiscordApiClient ApiClient { get; set; } + + public DiscordApiClientHook(DiscordApiClient apiClient) + { + this.ApiClient = apiClient; + } + } +} diff --git a/DisCatSharp.Experimental/Program.cs b/DisCatSharp.Experimental/Program.cs index d157e092d..a0114c871 100644 --- a/DisCatSharp.Experimental/Program.cs +++ b/DisCatSharp.Experimental/Program.cs @@ -1,36 +1,36 @@ using System; using DisCatSharp.Attributes; namespace DisCatSharp.Experimental; -public class Program +internal class Program { - public static void Main(string[] args = null) + internal static void Main(string[] args = null) { var test = new Test("test"); test.Invoke(); var str = test.TestString; } } [Experimental("class")] -public class Test +internal class Test { [Experimental("property")] - public string TestString { get; set; } + internal string TestString { get; set; } [Experimental("construct")] - public Test([Experimental("test arg")] string test = null) + internal Test([Experimental("test arg")] string test = null) { this.TestString = test; } [Experimental("construct 2")] - public Test() + internal Test() { } [Experimental("method")] - public void Invoke() + internal void Invoke() => Console.WriteLine(this.TestString); }