Initial commit
Added a bunch of stuff
This commit is contained in:
parent
eb0c976133
commit
a5ca9149cd
25 changed files with 788 additions and 0 deletions
208
.gitignore
vendored
Normal file
208
.gitignore
vendored
Normal file
|
@ -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
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[submodule "overrides/Discord.Net.BuildOverrides"]
|
||||
path = overrides/Discord.Net.BuildOverrides
|
||||
url = https://github.com/discord-net/Discord.Net.BuildOverrides
|
73
Discord.Net.sln
Normal file
73
Discord.Net.sln
Normal file
|
@ -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
|
35
Discord.Net.targets
Normal file
35
Discord.Net.targets
Normal file
|
@ -0,0 +1,35 @@
|
|||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>3.14.1</VersionPrefix>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Authors>Discord.Net Contributors</Authors>
|
||||
<PackageTags>discord;discordapp</PackageTags>
|
||||
<PackageProjectUrl>https://github.com/Discord-Net/Discord.Net</PackageProjectUrl>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<PackageIcon>PackageLogo.png</PackageIcon>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>git://github.com/Discord-Net/Discord.Net</RepositoryUrl>
|
||||
<PackageReadmeFile>NUGET_README.md</PackageReadmeFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(IsTagBuild)' == 'true' ">
|
||||
<VersionSuffix></VersionSuffix>
|
||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(BuildNumber)' == '' And $(IsTagBuild) != 'true' ">
|
||||
<VersionSuffix Condition=" '$(VersionSuffix)' != ''">$(VersionSuffix)-dev</VersionSuffix>
|
||||
<VersionSuffix Condition=" '$(VersionSuffix)' == ''">dev</VersionSuffix>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(BuildNumber)' != '' And $(IsTagBuild) != 'true' ">
|
||||
<VersionSuffix Condition=" '$(VersionSuffix)' != '' ">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
|
||||
<VersionSuffix Condition=" '$(VersionSuffix)' == '' ">$(BuildNumber)</VersionSuffix>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<NoWarn>$(NoWarn);CS1573;CS1591</NoWarn>
|
||||
<WarningsAsErrors>true</WarningsAsErrors>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Include="../../docs/marketing/logo/PackageLogo.png" Pack="true" PackagePath=""/>
|
||||
<None Include="../../NUGET_README.md" Pack="true" PackagePath=""/>
|
||||
</ItemGroup>
|
||||
</Project>
|
73
NUGET_README.md
Normal file
73
NUGET_README.md
Normal file
|
@ -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.
|
9
StyleAnalyzer.targets
Normal file
9
StyleAnalyzer.targets
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<!-- <ItemGroup>
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.205" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
|
||||
</PropertyGroup> -->
|
||||
</Project>
|
BIN
docs/marketing/logo/PackageLogo.png
Normal file
BIN
docs/marketing/logo/PackageLogo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 76 KiB |
|
@ -0,0 +1,10 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
2
experiment/Discord.Net.BuildOverrides/Program.cs
Normal file
2
experiment/Discord.Net.BuildOverrides/Program.cs
Normal file
|
@ -0,0 +1,2 @@
|
|||
// See https://aka.ms/new-console-template for more information
|
||||
Console.WriteLine("Hello, World!");
|
1
overrides/Discord.Net.BuildOverrides
Submodule
1
overrides/Discord.Net.BuildOverrides
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 9b2be5597468329090015fa1b2775815b20be440
|
10
src/Discord.Net.Commands/Discord.Net.Commands.csproj
Normal file
10
src/Discord.Net.Commands/Discord.Net.Commands.csproj
Normal file
|
@ -0,0 +1,10 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
2
src/Discord.Net.Commands/Program.cs
Normal file
2
src/Discord.Net.Commands/Program.cs
Normal file
|
@ -0,0 +1,2 @@
|
|||
// See https://aka.ms/new-console-template for more information
|
||||
Console.WriteLine("Hello, World!");
|
23
src/Discord.Net.Core/Discord.Net.Core.csproj
Normal file
23
src/Discord.Net.Core/Discord.Net.Core.csproj
Normal file
|
@ -0,0 +1,23 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="../../Discord.Net.targets" />
|
||||
<Import Project="../../StyleAnalyzer.targets" />
|
||||
<PropertyGroup>
|
||||
<AssemblyName>Discord.Net.Core</AssemblyName>
|
||||
<RootNamespace>Discord</RootNamespace>
|
||||
<Description>The core components for the Discord.Net library.</Description>
|
||||
<TargetFrameworks>net6.0;net5.0;net461;netstandard2.0;netstandard2.1</TargetFrameworks>
|
||||
<WarningLevel>5</WarningLevel>
|
||||
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
|
||||
<IsTrimmable>false</IsTrimmable>
|
||||
<IsAotCompatible>false</IsAotCompatible>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="System.Interactive.Async" Version="6.0.1" />
|
||||
<PackageReference Include="System.Collections.Immutable" Version="6.0.0" />
|
||||
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$(TargetFramework.StartsWith('net4')) AND '$(MSBuildRuntimeType)' == 'Core' AND '$(OS)' != 'Windows_NT'">
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
</Project>
|
260
src/Discord.Net.Core/DiscordConfig.cs
Normal file
260
src/Discord.Net.Core/DiscordConfig.cs
Normal file
|
@ -0,0 +1,260 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines various behaviors of Discord.Net.
|
||||
/// </summary>
|
||||
public class DiscordConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the API version Discord.Net uses.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// An <see cref="int"/> representing the API version that Discord.Net uses to communicate with Discord.
|
||||
/// <para>A list of available API version can be seen on the official
|
||||
/// <see href="https://discord.com/developers/docs/reference#api-versioning">Discord API documentation</see>
|
||||
/// .</para>
|
||||
/// </returns>
|
||||
public const int APIVersion = 10;
|
||||
/// <summary>
|
||||
/// Returns the Voice API version Discord.Net uses.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// An <see cref="int"/> representing the API version that Discord.Net uses to communicate with Discord's
|
||||
/// voice server.
|
||||
/// </returns>
|
||||
public const int VoiceAPIVersion = 3;
|
||||
/// <summary>
|
||||
/// Gets the Discord.Net version, including the build number.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A string containing the detailed version information, including its build number; <c>Unknown</c> when
|
||||
/// the version fails to be fetched.
|
||||
/// </returns>
|
||||
public static string Version { get; } =
|
||||
typeof(DiscordConfig).GetTypeInfo().Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ??
|
||||
typeof(DiscordConfig).GetTypeInfo().Assembly.GetName().Version.ToString(3) ??
|
||||
"Unknown";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the user agent that Discord.Net uses in its clients.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The user agent used in each Discord.Net request.
|
||||
/// </returns>
|
||||
public static string UserAgent { get; } = $"DiscordBot (https://github.com/discord-net/Discord.Net, v{Version})";
|
||||
/// <summary>
|
||||
/// Returns the base Discord API URL.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The Discord API URL using <see cref="APIVersion"/>.
|
||||
/// </returns>
|
||||
public static readonly string APIUrl = $"https://discord.com/api/v{APIVersion}/";
|
||||
/// <summary>
|
||||
/// Returns the base Discord CDN URL.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The base Discord Content Delivery Network (CDN) URL.
|
||||
/// </returns>
|
||||
public const string CDNUrl = "https://cdn.discordapp.com/";
|
||||
/// <summary>
|
||||
/// Returns the base Discord invite URL.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The base Discord invite URL.
|
||||
/// </returns>
|
||||
public const string InviteUrl = "https://discord.gg/";
|
||||
|
||||
/// <summary>
|
||||
/// Returns the default timeout for requests.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The amount of time it takes in milliseconds before a request is timed out.
|
||||
/// </returns>
|
||||
public const int DefaultRequestTimeout = 15000;
|
||||
/// <summary>
|
||||
/// Returns the max length for a Discord message.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The maximum length of a message allowed by Discord.
|
||||
/// </returns>
|
||||
public const int MaxMessageSize = 2000;
|
||||
/// <summary>
|
||||
/// Returns the max messages allowed to be in a request.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The maximum number of messages that can be gotten per-batch.
|
||||
/// </returns>
|
||||
public const int MaxMessagesPerBatch = 100;
|
||||
/// <summary>
|
||||
/// Returns the max users allowed to be in a request.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The maximum number of users that can be gotten per-batch.
|
||||
/// </returns>
|
||||
public const int MaxUsersPerBatch = 1000;
|
||||
/// <summary>
|
||||
/// Returns the max bans allowed to be in a request.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The maximum number of bans that can be gotten per-batch.
|
||||
/// </returns>
|
||||
public const int MaxBansPerBatch = 1000;
|
||||
/// <summary>
|
||||
/// Returns the max users allowed to be in a request for guild event users.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The maximum number of users that can be gotten per-batch.
|
||||
/// </returns>
|
||||
public const int MaxGuildEventUsersPerBatch = 100;
|
||||
/// <summary>
|
||||
/// Returns the max guilds allowed to be in a request.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The maximum number of guilds that can be gotten per-batch.
|
||||
/// </returns>
|
||||
public const int MaxGuildsPerBatch = 100;
|
||||
/// <summary>
|
||||
/// Returns the max user reactions allowed to be in a request.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The maximum number of user reactions that can be gotten per-batch.
|
||||
/// </returns>
|
||||
public const int MaxUserReactionsPerBatch = 100;
|
||||
/// <summary>
|
||||
/// Returns the max audit log entries allowed to be in a request.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The maximum number of audit log entries that can be gotten per-batch.
|
||||
/// </returns>
|
||||
public const int MaxAuditLogEntriesPerBatch = 100;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the max number of stickers that can be sent with a message.
|
||||
/// </summary>
|
||||
public const int MaxStickersPerMessage = 3;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the max number of embeds that can be sent with a message.
|
||||
/// </summary>
|
||||
public const int MaxEmbedsPerMessage = 10;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets how a request should act in the case of an error, by default.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The currently set <see cref="RetryMode"/>.
|
||||
/// </returns>
|
||||
public RetryMode DefaultRetryMode { get; set; } = RetryMode.AlwaysRetry;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the default callback for ratelimits.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This property is mutually exclusive with <see cref="RequestOptions.RatelimitCallback"/>.
|
||||
/// </remarks>
|
||||
public Func<IRateLimitInfo, Task> DefaultRatelimitCallback { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the minimum log level severity that will be sent to the Log event.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The currently set <see cref="LogSeverity"/> for logging level.
|
||||
/// </returns>
|
||||
public LogSeverity LogLevel { get; set; } = LogSeverity.Info;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether the initial log entry should be printed.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If set to <see langword="true" />, the library will attempt to print the current version of the library, as well as
|
||||
/// the API version it uses on startup.
|
||||
/// </remarks>
|
||||
internal bool DisplayInitialLog { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether or not rate-limits should use the system clock.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If set to <see langword="false" />, 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.
|
||||
/// </remarks>
|
||||
public bool UseSystemClock { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If set to <see langword="false"/> then the CreatedAt property in an interaction
|
||||
/// will be set to when it was received instead of the snowflakes date.
|
||||
/// <br/>
|
||||
/// <b>This will still require a stable clock on your system.</b>
|
||||
/// </remarks>
|
||||
public bool UseInteractionSnowflakeDate { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets if the Rest/Socket user <see cref="object.ToString"/> override formats the string in respect to bidirectional unicode.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// By default, the returned value will be "?Discord?#1234", to work with bidirectional usernames.
|
||||
/// <br/>
|
||||
/// If set to <see langword="false"/>, this value will be "Discord#1234".
|
||||
/// </remarks>
|
||||
public bool FormatUsersInBidirectionalUnicode { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the max thread members allowed to be in a request.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The maximum number of thread members that can be gotten per-batch.
|
||||
/// </returns>
|
||||
public const int MaxThreadMembersPerBatch = 100;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the max length of an application tag.
|
||||
/// </summary>
|
||||
public const int MaxApplicationTagLength = 20;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the max length of an application description.
|
||||
/// </summary>
|
||||
public const int MaxApplicationDescriptionLength = 400;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the max amount of tags applied to an application.
|
||||
/// </summary>
|
||||
public const int MaxApplicationTagCount = 5;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the factor to reduce the heartbeat interval.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 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.
|
||||
/// </remarks>
|
||||
internal const double HeartbeatIntervalFactor = 0.9;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the maximum length of a voice channel status.
|
||||
/// </summary>
|
||||
public const int MaxVoiceChannelStatusLength = 500;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the maximum number of entitlements that can be gotten per-batch.
|
||||
/// </summary>
|
||||
public const int MaxEntitlementsPerBatch = 100;
|
||||
}
|
||||
}
|
10
src/Discord.Net.Interactions/Discord.Net.Interactions.csproj
Normal file
10
src/Discord.Net.Interactions/Discord.Net.Interactions.csproj
Normal file
|
@ -0,0 +1,10 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
2
src/Discord.Net.Interactions/Program.cs
Normal file
2
src/Discord.Net.Interactions/Program.cs
Normal file
|
@ -0,0 +1,2 @@
|
|||
// See https://aka.ms/new-console-template for more information
|
||||
Console.WriteLine("Hello, World!");
|
10
src/Discord.Net.Rest/Discord.Net.Rest.csproj
Normal file
10
src/Discord.Net.Rest/Discord.Net.Rest.csproj
Normal file
|
@ -0,0 +1,10 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
2
src/Discord.Net.Rest/Program.cs
Normal file
2
src/Discord.Net.Rest/Program.cs
Normal file
|
@ -0,0 +1,2 @@
|
|||
// See https://aka.ms/new-console-template for more information
|
||||
Console.WriteLine("Hello, World!");
|
10
src/Discord.Net.WebSocket/Discord.Net.WebSocket.csproj
Normal file
10
src/Discord.Net.WebSocket/Discord.Net.WebSocket.csproj
Normal file
|
@ -0,0 +1,10 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
2
src/Discord.Net.WebSocket/Program.cs
Normal file
2
src/Discord.Net.WebSocket/Program.cs
Normal file
|
@ -0,0 +1,2 @@
|
|||
// See https://aka.ms/new-console-template for more information
|
||||
Console.WriteLine("Hello, World!");
|
10
src/Discord.Net.Webhook/Discord.Net.Webhook.csproj
Normal file
10
src/Discord.Net.Webhook/Discord.Net.Webhook.csproj
Normal file
|
@ -0,0 +1,10 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
2
src/Discord.Net.Webhook/Program.cs
Normal file
2
src/Discord.Net.Webhook/Program.cs
Normal file
|
@ -0,0 +1,2 @@
|
|||
// See https://aka.ms/new-console-template for more information
|
||||
Console.WriteLine("Hello, World!");
|
19
stylecop.json
Normal file
19
stylecop.json
Normal file
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
10
test/Discord.Net.Tests.Unit/Discord.Net.Tests.Unit.csproj
Normal file
10
test/Discord.Net.Tests.Unit/Discord.Net.Tests.Unit.csproj
Normal file
|
@ -0,0 +1,10 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
2
test/Discord.Net.Tests.Unit/Program.cs
Normal file
2
test/Discord.Net.Tests.Unit/Program.cs
Normal file
|
@ -0,0 +1,2 @@
|
|||
// See https://aka.ms/new-console-template for more information
|
||||
Console.WriteLine("Hello, World!");
|
Loading…
Reference in a new issue