diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6543708 --- /dev/null +++ b/.gitignore @@ -0,0 +1,208 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +build/ +bld/ +[Bb]in/ +[Oo]bj/ + +# Visual Studo 2015 cache/options directory +.vs/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding addin-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config + +# Windows Azure Build Output +csx/ +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +*.[Cc]ache +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +#Custom +project.lock.json +/test/Discord.Net.Tests/config.json +/test/Discord.Net.Tests/cache.db* +/docs/_build +*.pyc +/.editorconfig +.vscode/ +docs/api/\.manifest + +\.idea/ + +# Codealike UID +codealike.json diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..71d50ed --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "overrides/Discord.Net.BuildOverrides"] + path = overrides/Discord.Net.BuildOverrides + url = https://github.com/discord-net/Discord.Net.BuildOverrides diff --git a/Discord.Net.sln b/Discord.Net.sln new file mode 100644 index 0000000..76d8b5d --- /dev/null +++ b/Discord.Net.sln @@ -0,0 +1,73 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.10.35004.147 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Discord.Net.Core", "src\Discord.Net.Core\Discord.Net.Core.csproj", "{1CB29704-CA89-49EC-BB37-360E0C9D1529}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Discord.Net.Rest", "src\Discord.Net.Rest\Discord.Net.Rest.csproj", "{42743A50-6205-4A48-BCA2-9D9D2D9ABAE0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Discord.Net.Commands", "src\Discord.Net.Commands\Discord.Net.Commands.csproj", "{88F2227A-2352-4940-8C40-64D64E3B6A8A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Discord.Net.WebSocket", "src\Discord.Net.WebSocket\Discord.Net.WebSocket.csproj", "{219F64CC-E78F-414B-95A1-29F34D82B194}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Discord.Net.Webhook", "src\Discord.Net.Webhook\Discord.Net.Webhook.csproj", "{12191647-68D7-4A1D-8AFF-A8A5D7D27E20}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Discord.Net.Interactions", "src\Discord.Net.Interactions\Discord.Net.Interactions.csproj", "{17CC660C-A428-4DFA-8B48-5162FECD898C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Discord.Net.Tests.Unit", "test\Discord.Net.Tests.Unit\Discord.Net.Tests.Unit.csproj", "{22443C30-C6C6-4BD4-8641-B37BD9420BD8}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{FBBBBED0-EAE3-4574-9AF9-FB4368439DDC}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Impls", "Impls", "{4E5B48BC-834D-43AF-B349-BDCDB534FE2B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extensions", "Extensions", "{A9FEAF51-A85E-487C-8C4B-4F1FF8A07DB7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Discord.Net.BuildOverrides", "experiment\Discord.Net.BuildOverrides\Discord.Net.BuildOverrides.csproj", "{D0584B63-7440-47DE-A88A-9792DBB1D6B2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1CB29704-CA89-49EC-BB37-360E0C9D1529}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1CB29704-CA89-49EC-BB37-360E0C9D1529}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1CB29704-CA89-49EC-BB37-360E0C9D1529}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1CB29704-CA89-49EC-BB37-360E0C9D1529}.Release|Any CPU.Build.0 = Release|Any CPU + {42743A50-6205-4A48-BCA2-9D9D2D9ABAE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {42743A50-6205-4A48-BCA2-9D9D2D9ABAE0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {42743A50-6205-4A48-BCA2-9D9D2D9ABAE0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {42743A50-6205-4A48-BCA2-9D9D2D9ABAE0}.Release|Any CPU.Build.0 = Release|Any CPU + {88F2227A-2352-4940-8C40-64D64E3B6A8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {88F2227A-2352-4940-8C40-64D64E3B6A8A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {88F2227A-2352-4940-8C40-64D64E3B6A8A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {88F2227A-2352-4940-8C40-64D64E3B6A8A}.Release|Any CPU.Build.0 = Release|Any CPU + {219F64CC-E78F-414B-95A1-29F34D82B194}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {219F64CC-E78F-414B-95A1-29F34D82B194}.Debug|Any CPU.Build.0 = Debug|Any CPU + {219F64CC-E78F-414B-95A1-29F34D82B194}.Release|Any CPU.ActiveCfg = Release|Any CPU + {219F64CC-E78F-414B-95A1-29F34D82B194}.Release|Any CPU.Build.0 = Release|Any CPU + {12191647-68D7-4A1D-8AFF-A8A5D7D27E20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {12191647-68D7-4A1D-8AFF-A8A5D7D27E20}.Debug|Any CPU.Build.0 = Debug|Any CPU + {12191647-68D7-4A1D-8AFF-A8A5D7D27E20}.Release|Any CPU.ActiveCfg = Release|Any CPU + {12191647-68D7-4A1D-8AFF-A8A5D7D27E20}.Release|Any CPU.Build.0 = Release|Any CPU + {17CC660C-A428-4DFA-8B48-5162FECD898C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {17CC660C-A428-4DFA-8B48-5162FECD898C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {17CC660C-A428-4DFA-8B48-5162FECD898C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {17CC660C-A428-4DFA-8B48-5162FECD898C}.Release|Any CPU.Build.0 = Release|Any CPU + {22443C30-C6C6-4BD4-8641-B37BD9420BD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {22443C30-C6C6-4BD4-8641-B37BD9420BD8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {22443C30-C6C6-4BD4-8641-B37BD9420BD8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {22443C30-C6C6-4BD4-8641-B37BD9420BD8}.Release|Any CPU.Build.0 = Release|Any CPU + {D0584B63-7440-47DE-A88A-9792DBB1D6B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D0584B63-7440-47DE-A88A-9792DBB1D6B2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D0584B63-7440-47DE-A88A-9792DBB1D6B2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D0584B63-7440-47DE-A88A-9792DBB1D6B2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {87BB5809-DE77-4E8C-8C5E-11D8B4E0884C} + EndGlobalSection +EndGlobal diff --git a/Discord.Net.targets b/Discord.Net.targets new file mode 100644 index 0000000..4a9e7a8 --- /dev/null +++ b/Discord.Net.targets @@ -0,0 +1,35 @@ + + + 3.14.1 + latest + Discord.Net Contributors + discord;discordapp + https://github.com/Discord-Net/Discord.Net + MIT + PackageLogo.png + git + git://github.com/Discord-Net/Discord.Net + NUGET_README.md + + + + false + + + $(VersionSuffix)-dev + dev + + + $(VersionSuffix)-$(BuildNumber) + $(BuildNumber) + + + $(NoWarn);CS1573;CS1591 + true + true + + + + + + diff --git a/NUGET_README.md b/NUGET_README.md new file mode 100644 index 0000000..c67f487 --- /dev/null +++ b/NUGET_README.md @@ -0,0 +1,73 @@ +# Discord.Net + +**Discord.Net** is an unofficial .NET API Wrapper for the Discord API (https://discord.com/developers/docs/intro). + +## 📄 Documentation + +- https://discordnet.dev +- [Sample Projects](https://github.com/discord-net/Discord.Net/tree/dev/samples) in our repository + +## Feedback + +You report issues with the library by opening an issue in our [GitHub Repository](https://github.com/discord-net/Discord.Net) + +If you need help with using Discord.Net check out the following: +- ask on our [Discord Support Server](https://discord.gg/dnet) +- start a thread in [GitHub Discussions](https://github.com/discord-net/Discord.Net/discussions) + +## 📥 Installation + +### Stable (NuGet) + +Our stable builds available from NuGet through the Discord.Net metapackage: + +- [Discord.Net](https://www.nuget.org/packages/Discord.Net/) + +The individual components may also be installed from NuGet: + +- _Webhooks_ + - [Discord.Net.Webhook](https://www.nuget.org/packages/Discord.Net.Webhook/) + +- _Text-Command & Interaction services._ + - [Discord.Net.Commands](https://www.nuget.org/packages/Discord.Net.Commands/) + - [Discord.Net.Interactions](https://www.nuget.org/packages/Discord.Net.Interactions/) + +- _Complete API coverage._ + - [Discord.Net.WebSocket](https://www.nuget.org/packages/Discord.Net.WebSocket/) + - [Discord.Net.Rest](https://www.nuget.org/packages/Discord.Net.Rest/) + +- _The API core. Implements only entities and barebones functionality._ + - [Discord.Net.Core](https://www.nuget.org/packages/Discord.Net.Core/) + +### Unstable + +Nightly builds are available through our MyGet feed (`https://www.myget.org/F/discord-net/api/v3/index.json`). +These builds target the dev branch. + +## 🩷 Supporting Discord.Net + +Discord.Net is an MIT-licensed open source project with its development made possible entirely by volunteers. +If you'd like to support our efforts financially, please consider: + +- [Contributing on Open Collective](https://opencollective.com/discordnet). + +## 🛑 Known Issues + +### WebSockets (Win7 and earlier) + +.NET Core 1.1 does not support WebSockets on Win7 and earlier. +This issue has been fixed since the release of .NET Core 2.1. +It is recommended to target .NET Core 2.1 or above for your project if you wish to run your bot on legacy platforms; +alternatively, you may choose to install the +[Discord.Net.Providers.WS4Net](https://www.nuget.org/packages/Discord.Net.Providers.WS4Net/) package. + +### TLS on .NET Framework. + +Discord supports only TLS1.2+ on all their websites including the API since 07/19/2022. +.NET Framework does not support this protocol by default. +If you depend on .NET Framework, it is suggested to upgrade your project to `net6-windows`. +This framework supports most of the windows-only features introduced by fx, and resolves startup errors from the TLS protocol mismatch. + +## 🗃️ Versioning Guarantees + +This library generally abides by [Semantic Versioning](https://semver.org). Packages are published in `MAJOR.MINOR.PATCH` version format. diff --git a/StyleAnalyzer.targets b/StyleAnalyzer.targets new file mode 100644 index 0000000..0794cfa --- /dev/null +++ b/StyleAnalyzer.targets @@ -0,0 +1,9 @@ + + + + diff --git a/docs/marketing/logo/PackageLogo.png b/docs/marketing/logo/PackageLogo.png new file mode 100644 index 0000000..6311e6e Binary files /dev/null and b/docs/marketing/logo/PackageLogo.png differ diff --git a/experiment/Discord.Net.BuildOverrides/Discord.Net.BuildOverrides.csproj b/experiment/Discord.Net.BuildOverrides/Discord.Net.BuildOverrides.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/experiment/Discord.Net.BuildOverrides/Discord.Net.BuildOverrides.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/experiment/Discord.Net.BuildOverrides/Program.cs b/experiment/Discord.Net.BuildOverrides/Program.cs new file mode 100644 index 0000000..3751555 --- /dev/null +++ b/experiment/Discord.Net.BuildOverrides/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/overrides/Discord.Net.BuildOverrides b/overrides/Discord.Net.BuildOverrides new file mode 160000 index 0000000..9b2be55 --- /dev/null +++ b/overrides/Discord.Net.BuildOverrides @@ -0,0 +1 @@ +Subproject commit 9b2be5597468329090015fa1b2775815b20be440 diff --git a/src/Discord.Net.Commands/Discord.Net.Commands.csproj b/src/Discord.Net.Commands/Discord.Net.Commands.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/src/Discord.Net.Commands/Discord.Net.Commands.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/src/Discord.Net.Commands/Program.cs b/src/Discord.Net.Commands/Program.cs new file mode 100644 index 0000000..3751555 --- /dev/null +++ b/src/Discord.Net.Commands/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/src/Discord.Net.Core/Discord.Net.Core.csproj b/src/Discord.Net.Core/Discord.Net.Core.csproj new file mode 100644 index 0000000..5ab8a91 --- /dev/null +++ b/src/Discord.Net.Core/Discord.Net.Core.csproj @@ -0,0 +1,23 @@ + + + + + Discord.Net.Core + Discord + The core components for the Discord.Net library. + net6.0;net5.0;net461;netstandard2.0;netstandard2.1 + 5 + True + false + false + + + + + + + + + + + diff --git a/src/Discord.Net.Core/DiscordConfig.cs b/src/Discord.Net.Core/DiscordConfig.cs new file mode 100644 index 0000000..5d4857d --- /dev/null +++ b/src/Discord.Net.Core/DiscordConfig.cs @@ -0,0 +1,260 @@ +using System; +using System.Reflection; +using System.Threading.Tasks; + +namespace Discord +{ + /// + /// Defines various behaviors of Discord.Net. + /// + public class DiscordConfig + { + /// + /// Returns the API version Discord.Net uses. + /// + /// + /// An representing the API version that Discord.Net uses to communicate with Discord. + /// A list of available API version can be seen on the official + /// Discord API documentation + /// . + /// + public const int APIVersion = 10; + /// + /// Returns the Voice API version Discord.Net uses. + /// + /// + /// An representing the API version that Discord.Net uses to communicate with Discord's + /// voice server. + /// + public const int VoiceAPIVersion = 3; + /// + /// Gets the Discord.Net version, including the build number. + /// + /// + /// A string containing the detailed version information, including its build number; Unknown when + /// the version fails to be fetched. + /// + public static string Version { get; } = + typeof(DiscordConfig).GetTypeInfo().Assembly.GetCustomAttribute()?.InformationalVersion ?? + typeof(DiscordConfig).GetTypeInfo().Assembly.GetName().Version.ToString(3) ?? + "Unknown"; + + /// + /// Gets the user agent that Discord.Net uses in its clients. + /// + /// + /// The user agent used in each Discord.Net request. + /// + public static string UserAgent { get; } = $"DiscordBot (https://github.com/discord-net/Discord.Net, v{Version})"; + /// + /// Returns the base Discord API URL. + /// + /// + /// The Discord API URL using . + /// + public static readonly string APIUrl = $"https://discord.com/api/v{APIVersion}/"; + /// + /// Returns the base Discord CDN URL. + /// + /// + /// The base Discord Content Delivery Network (CDN) URL. + /// + public const string CDNUrl = "https://cdn.discordapp.com/"; + /// + /// Returns the base Discord invite URL. + /// + /// + /// The base Discord invite URL. + /// + public const string InviteUrl = "https://discord.gg/"; + + /// + /// Returns the default timeout for requests. + /// + /// + /// The amount of time it takes in milliseconds before a request is timed out. + /// + public const int DefaultRequestTimeout = 15000; + /// + /// Returns the max length for a Discord message. + /// + /// + /// The maximum length of a message allowed by Discord. + /// + public const int MaxMessageSize = 2000; + /// + /// Returns the max messages allowed to be in a request. + /// + /// + /// The maximum number of messages that can be gotten per-batch. + /// + public const int MaxMessagesPerBatch = 100; + /// + /// Returns the max users allowed to be in a request. + /// + /// + /// The maximum number of users that can be gotten per-batch. + /// + public const int MaxUsersPerBatch = 1000; + /// + /// Returns the max bans allowed to be in a request. + /// + /// + /// The maximum number of bans that can be gotten per-batch. + /// + public const int MaxBansPerBatch = 1000; + /// + /// Returns the max users allowed to be in a request for guild event users. + /// + /// + /// The maximum number of users that can be gotten per-batch. + /// + public const int MaxGuildEventUsersPerBatch = 100; + /// + /// Returns the max guilds allowed to be in a request. + /// + /// + /// The maximum number of guilds that can be gotten per-batch. + /// + public const int MaxGuildsPerBatch = 100; + /// + /// Returns the max user reactions allowed to be in a request. + /// + /// + /// The maximum number of user reactions that can be gotten per-batch. + /// + public const int MaxUserReactionsPerBatch = 100; + /// + /// Returns the max audit log entries allowed to be in a request. + /// + /// + /// The maximum number of audit log entries that can be gotten per-batch. + /// + public const int MaxAuditLogEntriesPerBatch = 100; + + /// + /// Returns the max number of stickers that can be sent with a message. + /// + public const int MaxStickersPerMessage = 3; + + /// + /// Returns the max number of embeds that can be sent with a message. + /// + public const int MaxEmbedsPerMessage = 10; + + /// + /// Gets or sets how a request should act in the case of an error, by default. + /// + /// + /// The currently set . + /// + public RetryMode DefaultRetryMode { get; set; } = RetryMode.AlwaysRetry; + + /// + /// Gets or sets the default callback for ratelimits. + /// + /// + /// This property is mutually exclusive with . + /// + public Func DefaultRatelimitCallback { get; set; } + + /// + /// Gets or sets the minimum log level severity that will be sent to the Log event. + /// + /// + /// The currently set for logging level. + /// + public LogSeverity LogLevel { get; set; } = LogSeverity.Info; + + /// + /// Gets or sets whether the initial log entry should be printed. + /// + /// + /// If set to , the library will attempt to print the current version of the library, as well as + /// the API version it uses on startup. + /// + internal bool DisplayInitialLog { get; set; } = true; + + /// + /// Gets or sets whether or not rate-limits should use the system clock. + /// + /// + /// If set to , we will use the X-RateLimit-Reset-After header + /// to determine when a rate-limit expires, rather than comparing the + /// X-RateLimit-Reset timestamp to the system time. + /// + /// This should only be changed to false if the system is known to have + /// a clock that is out of sync. Relying on the Reset-After header will + /// incur network lag. + /// + /// Regardless of this property, we still rely on the system's wall-clock + /// to determine if a bucket is rate-limited; we do not use any monotonic + /// clock. Your system will still need a stable clock. + /// + public bool UseSystemClock { get; set; } = true; + + /// + /// Gets or sets whether or not the internal expiration check uses the system date + /// + snowflake date to check if an interaction can be responded to. + /// + /// + /// If set to then the CreatedAt property in an interaction + /// will be set to when it was received instead of the snowflakes date. + ///
+ /// This will still require a stable clock on your system. + ///
+ public bool UseInteractionSnowflakeDate { get; set; } = true; + + /// + /// Gets or sets if the Rest/Socket user override formats the string in respect to bidirectional unicode. + /// + /// + /// By default, the returned value will be "?Discord?#1234", to work with bidirectional usernames. + ///
+ /// If set to , this value will be "Discord#1234". + ///
+ public bool FormatUsersInBidirectionalUnicode { get; set; } = true; + + /// + /// Returns the max thread members allowed to be in a request. + /// + /// + /// The maximum number of thread members that can be gotten per-batch. + /// + public const int MaxThreadMembersPerBatch = 100; + + /// + /// Returns the max length of an application tag. + /// + public const int MaxApplicationTagLength = 20; + + /// + /// Returns the max length of an application description. + /// + public const int MaxApplicationDescriptionLength = 400; + + /// + /// Returns the max amount of tags applied to an application. + /// + public const int MaxApplicationTagCount = 5; + + /// + /// Returns the factor to reduce the heartbeat interval. + /// + /// + /// If a heartbeat takes longer than the interval estimated by Discord, the connection will be closed. + /// This factor is used to reduce the interval and ensure that Discord will get the heartbeat within the estimated interval. + /// + internal const double HeartbeatIntervalFactor = 0.9; + + /// + /// Returns the maximum length of a voice channel status. + /// + public const int MaxVoiceChannelStatusLength = 500; + + /// + /// Returns the maximum number of entitlements that can be gotten per-batch. + /// + public const int MaxEntitlementsPerBatch = 100; + } +} \ No newline at end of file diff --git a/src/Discord.Net.Interactions/Discord.Net.Interactions.csproj b/src/Discord.Net.Interactions/Discord.Net.Interactions.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/src/Discord.Net.Interactions/Discord.Net.Interactions.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/src/Discord.Net.Interactions/Program.cs b/src/Discord.Net.Interactions/Program.cs new file mode 100644 index 0000000..3751555 --- /dev/null +++ b/src/Discord.Net.Interactions/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/src/Discord.Net.Rest/Discord.Net.Rest.csproj b/src/Discord.Net.Rest/Discord.Net.Rest.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/src/Discord.Net.Rest/Discord.Net.Rest.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/src/Discord.Net.Rest/Program.cs b/src/Discord.Net.Rest/Program.cs new file mode 100644 index 0000000..3751555 --- /dev/null +++ b/src/Discord.Net.Rest/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/src/Discord.Net.WebSocket/Discord.Net.WebSocket.csproj b/src/Discord.Net.WebSocket/Discord.Net.WebSocket.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/src/Discord.Net.WebSocket/Discord.Net.WebSocket.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/src/Discord.Net.WebSocket/Program.cs b/src/Discord.Net.WebSocket/Program.cs new file mode 100644 index 0000000..3751555 --- /dev/null +++ b/src/Discord.Net.WebSocket/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/src/Discord.Net.Webhook/Discord.Net.Webhook.csproj b/src/Discord.Net.Webhook/Discord.Net.Webhook.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/src/Discord.Net.Webhook/Discord.Net.Webhook.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/src/Discord.Net.Webhook/Program.cs b/src/Discord.Net.Webhook/Program.cs new file mode 100644 index 0000000..3751555 --- /dev/null +++ b/src/Discord.Net.Webhook/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/stylecop.json b/stylecop.json new file mode 100644 index 0000000..bb90569 --- /dev/null +++ b/stylecop.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", + "settings": { + "indentation": { + "indentationSize": 4, + "tabSize": 4, + "useTabs": false + }, + "documentationRules": { + "documentExposedElements": true, + "documentInternalElements": false, + "documentPrivateElements": false, + "documentInterfaces": true, + "documentPrivateFields": true, + "xmlHeader": false, + "documentationCulture": "en-US" + } + } +} diff --git a/test/Discord.Net.Tests.Unit/Discord.Net.Tests.Unit.csproj b/test/Discord.Net.Tests.Unit/Discord.Net.Tests.Unit.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/test/Discord.Net.Tests.Unit/Discord.Net.Tests.Unit.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/test/Discord.Net.Tests.Unit/Program.cs b/test/Discord.Net.Tests.Unit/Program.cs new file mode 100644 index 0000000..3751555 --- /dev/null +++ b/test/Discord.Net.Tests.Unit/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!");