diff --git a/DisCatSharp.Docs/vs/analyzer/dcs/0101.md b/DisCatSharp.Docs/vs/analyzer/dcs/0101.md
new file mode 100644
index 000000000..ff4167893
--- /dev/null
+++ b/DisCatSharp.Docs/vs/analyzer/dcs/0101.md
@@ -0,0 +1,12 @@
+---
+uid: vs_analyzer_dcs_0101
+title: Visual Studio Tools
+---
+
+# DisCatSharp Analyzer Rule DCS0101
+
+You try to use an field, function or similar which is in experiment by discord.
+
+Most experiments aren't stable and subject to change at any time.
+
+Use carefully and at your own risk.
diff --git a/DisCatSharp.Docs/vs/analyzer/dcs/0102.md b/DisCatSharp.Docs/vs/analyzer/dcs/0102.md
new file mode 100644
index 000000000..485cd4295
--- /dev/null
+++ b/DisCatSharp.Docs/vs/analyzer/dcs/0102.md
@@ -0,0 +1,10 @@
+---
+uid: vs_analyzer_dcs_0102
+title: Visual Studio Tools
+---
+
+# DisCatSharp Analyzer Rule DCS0102
+
+You try to use an field, function or similar which is deprecated by discord.
+
+Don't use this anymore. It will be removed in the future.
diff --git a/DisCatSharp.Docs/vs/analyzer/dcs/0103.md b/DisCatSharp.Docs/vs/analyzer/dcs/0103.md
new file mode 100644
index 000000000..2c52cade8
--- /dev/null
+++ b/DisCatSharp.Docs/vs/analyzer/dcs/0103.md
@@ -0,0 +1,10 @@
+---
+uid: vs_analyzer_dcs_0103
+title: Visual Studio Tools
+---
+
+# DisCatSharp Analyzer Rule DCS0103
+
+You try to use an field, function or similar which isn't released yet by discord.
+
+Use carefully and at your own risk.
diff --git a/DisCatSharp.Docs/vs/index.md b/DisCatSharp.Docs/vs/index.md
index 15c31ff6e..7bb1926bf 100644
--- a/DisCatSharp.Docs/vs/index.md
+++ b/DisCatSharp.Docs/vs/index.md
@@ -1,24 +1,27 @@
---
uid: vs
title: Visual Studio Tools
---
## Visual Studio Tools
This section contains information on how to use the Visual Studio tools for developing bots with DisCatSharp.
### Analyzers & Code Fixes
DisCatSharp can be extended with a set of analyzers that can help you write better code. These analyzers will warn you about common mistakes and bad practices.
#### DisCatSharp Analyzer
#### Installation
To use the DisCatSharp Analyzer, you need to install the [DisCatSharp.Analyzer.Roselyn](https://www.nuget.org/packages/DisCatSharp.Analyzer.Roselyn) NuGet package.
##### Included Rules
Rule ID | Category | Severity | Notes
--------|----------|----------|-------
[DCS0001](xref:vs_analyzer_dcs_0001) | Information | Warning | Experimental Attribute Analyzer
+[DCS0101](xref:vs_analyzer_dcs_0101) | Information | Warning | DiscordInExperiment Attribute Analyzer
+[DCS0102](xref:vs_analyzer_dcs_0102) | Information | Warning | DiscordDeprecated Attribute Analyzer
+[DCS0103](xref:vs_analyzer_dcs_0103) | Information | Warning | DiscordUnreleased Attribute Analyzer
diff --git a/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer.Package/DisCatSharp.Analyzer.Package.csproj b/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer.Package/DisCatSharp.Analyzer.Package.csproj
index e6f4e5765..571f25c64 100644
--- a/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer.Package/DisCatSharp.Analyzer.Package.csproj
+++ b/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer.Package/DisCatSharp.Analyzer.Package.csproj
@@ -1,91 +1,91 @@
netstandard2.0
false
true
true
DisCatSharp.Analyzer.Roselyn
- 4.8.0
- 4.8.0
+ 5.0.0
+ 5.0.0
AITSYS
false
DisCatSharp Analyzer
Various DisCatSharp Analyzers.
Copyright 2022 AITSYS
Analyzer, analyzers
true
true
$(TargetsForTfmSpecificContentInPackage);AddNuGetDlls;_AddAnalyzersToOutput
false
DisCatSharp Analyzer
logobig.png
README.md
git
https://github.com/Aiko-IT-Systems/DisCatSharp
https://github.com/Aiko-IT-Systems/DisCatSharp
True
\
True
\
true
true
-
+
<_PackagesToPack Remove="@(_PackagesToPack)" Condition="%(NuGetPackageId) == 'NETStandard.Library'" />
<_PackagesToPack Remove="@(_PackagesToPack)" Condition="%(NuGetPackageId) == 'Microsoft.CodeAnalysis.CSharp.Workspaces'" />
diff --git a/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/AnalyzerReleases.Shipped.md b/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/AnalyzerReleases.Shipped.md
index 37bdb3dc0..1818faacc 100644
--- a/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/AnalyzerReleases.Shipped.md
+++ b/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/AnalyzerReleases.Shipped.md
@@ -1,43 +1,54 @@
; Shipped analyzer releases
; https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md
## Release 4.2
### New Rules
Rule ID | Category | Severity | Notes
--------|----------|----------|--------------------
DcsExp | Information | Warning | Informs if a method or attribute or similar is considered experimental
## Release 4.3
### New Rules
Rule ID | Category | Severity | Notes
--------|----------|----------|--------------------
DCS0001 | Information | Warning | Experimental Attribute Analyzer
### Removed Rules
Rule ID | Category | Severity | Notes
--------|----------|----------|--------------------
DcsExp | Information | Warning | Informs if a method or attribute or similar is considered experimental
## Release 4.4
### Changed Rules
Rule ID | Category | Severity | Notes
--------|----------|----------|--------------------
DCS0001 | Information | Warning | Experimental Attribute Analyzer
## Release 4.5
### Changed Rules
Rule ID | Category | Severity | Notes
--------|----------|----------|--------------------
DCS0001 | Information | Warning | Experimental Attribute Analyzer
+
+
+## Release 5.0
+
+### New Rules
+
+Rule ID | Category | Severity | Notes
+--------|----------|----------|--------------------
+DCS0101 | Information | Warning | DiscordInExperiment Attribute Analyzer
+DCS0102 | Information | Warning | DiscordDeprecated Attribute Analyzer
+DCS0103 | Information | Warning | DiscordUnreleased Attribute Analyzer
diff --git a/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/AnalyzerReleases.Unshipped.md b/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/AnalyzerReleases.Unshipped.md
index 7b845f486..f2b7fad65 100644
--- a/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/AnalyzerReleases.Unshipped.md
+++ b/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/AnalyzerReleases.Unshipped.md
@@ -1,7 +1,2 @@
; Unshipped analyzer release
; https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md
-
-### New Rules
-
-Rule ID | Category | Severity | Notes
---------|----------|----------|-------
diff --git a/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/AttributeAnalyzer.cs b/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/AttributeAnalyzer.cs
index ec46ef5fa..754c8889b 100644
--- a/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/AttributeAnalyzer.cs
+++ b/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/AttributeAnalyzer.cs
@@ -1,156 +1,208 @@
// 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 DisCatSharp.Attributes;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
using System;
+using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
namespace DisCatSharp.Analyzer
{
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class AttributeAnalyzer : DiagnosticAnalyzer
{
public const string DiagnosticIdPrefix = "DCS";
+ public const string Category = "Information";
- private static readonly LocalizableString Title = new LocalizableResourceString(nameof(Resources.AnalyzerTitle), Resources.ResourceManager, typeof(Resources));
- private static readonly LocalizableString MessageFormat = new LocalizableResourceString(nameof(Resources.AnalyzerMessageFormat), Resources.ResourceManager, typeof(Resources));
- private static readonly LocalizableString Description = new LocalizableResourceString(nameof(Resources.AnalyzerDescription), Resources.ResourceManager, typeof(Resources));
- private const string Category = "Information";
+ private static readonly LocalizableString TitleExperimental = new LocalizableResourceString(nameof(Resources.AnalyzerTitleExperimental), Resources.ResourceManager, typeof(Resources));
+ private static readonly LocalizableString MessageFormatExperimental = new LocalizableResourceString(nameof(Resources.AnalyzerMessageFormatExperimental), Resources.ResourceManager, typeof(Resources));
+ private static readonly LocalizableString DescriptionExperimental = new LocalizableResourceString(nameof(Resources.AnalyzerDescriptionExperimental), Resources.ResourceManager, typeof(Resources));
+ private static readonly LocalizableString TitleDiscordInExperiment = new LocalizableResourceString(nameof(Resources.AnalyzerTitleExperimental), Resources.ResourceManager, typeof(Resources));
+ private static readonly LocalizableString MessageFormatDiscordInExperiment = new LocalizableResourceString(nameof(Resources.AnalyzerMessageFormatExperimental), Resources.ResourceManager, typeof(Resources));
+ private static readonly LocalizableString DescriptionDiscordInExperiment = new LocalizableResourceString(nameof(Resources.AnalyzerDescriptionExperimental), Resources.ResourceManager, typeof(Resources));
+ private static readonly LocalizableString TitleDiscordDeprecated = new LocalizableResourceString(nameof(Resources.AnalyzerTitleExperimental), Resources.ResourceManager, typeof(Resources));
+ private static readonly LocalizableString MessageFormatDiscordDeprecated = new LocalizableResourceString(nameof(Resources.AnalyzerMessageFormatExperimental), Resources.ResourceManager, typeof(Resources));
+ private static readonly LocalizableString DescriptionDiscordDeprecated = new LocalizableResourceString(nameof(Resources.AnalyzerDescriptionExperimental), Resources.ResourceManager, typeof(Resources));
+ private static readonly LocalizableString TitleDiscordUnreleased = new LocalizableResourceString(nameof(Resources.AnalyzerTitleExperimental), Resources.ResourceManager, typeof(Resources));
+ private static readonly LocalizableString MessageFormatDiscordUnreleased = new LocalizableResourceString(nameof(Resources.AnalyzerMessageFormatExperimental), Resources.ResourceManager, typeof(Resources));
+ private static readonly LocalizableString DescriptionDiscordUnreleased = new LocalizableResourceString(nameof(Resources.AnalyzerDescriptionExperimental), Resources.ResourceManager, typeof(Resources));
- private static readonly DiagnosticDescriptor ExperimentalRule = new DiagnosticDescriptor(DiagnosticIdPrefix + "0001", Title, MessageFormat, Category, DiagnosticSeverity.Warning, true, Description, "https://docs.discatsharp.tech/vs/analyzer/dcs/0001.html");
+ private static readonly DiagnosticDescriptor ExperimentalRule = new DiagnosticDescriptor(DiagnosticIdPrefix + "0001", TitleExperimental, MessageFormatExperimental, Category, DiagnosticSeverity.Warning, true, DescriptionExperimental, "https://docs.discatsharp.tech/vs/analyzer/dcs/0001.html");
+ private static readonly DiagnosticDescriptor DiscordInExperimentRule = new DiagnosticDescriptor(DiagnosticIdPrefix + "0101", TitleDiscordInExperiment, MessageFormatDiscordInExperiment, Category, DiagnosticSeverity.Warning, true, DescriptionDiscordInExperiment, "https://docs.discatsharp.tech/vs/analyzer/dcs/0101.html");
+ private static readonly DiagnosticDescriptor DiscordDeprecatedRule = new DiagnosticDescriptor(DiagnosticIdPrefix + "0102", TitleDiscordDeprecated, MessageFormatDiscordDeprecated, Category, DiagnosticSeverity.Warning, true, DescriptionDiscordDeprecated, "https://docs.discatsharp.tech/vs/analyzer/dcs/0102.html");
+ private static readonly DiagnosticDescriptor DiscordUnreleasedRule = new DiagnosticDescriptor(DiagnosticIdPrefix + "0103", TitleDiscordUnreleased, MessageFormatDiscordUnreleased, Category, DiagnosticSeverity.Warning, true, DescriptionDiscordUnreleased, "https://docs.discatsharp.tech/vs/analyzer/dcs/0103.html");
- public override ImmutableArray SupportedDiagnostics { get { return ImmutableArray.Create(ExperimentalRule); } }
+ public override ImmutableArray SupportedDiagnostics
+ {
+ get
+ {
+ return ImmutableArray.Create(ExperimentalRule, DiscordInExperimentRule, DiscordDeprecatedRule, DiscordUnreleasedRule);
+ }
+ }
public override void Initialize(AnalysisContext context)
{
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
context.EnableConcurrentExecution();
context.RegisterSymbolAction(ExperimentalAnalyzer, SymbolKind.Parameter);
context.RegisterSymbolAction(ExperimentalAnalyzer, SymbolKind.Property);
context.RegisterSymbolAction(ExperimentalAnalyzer, SymbolKind.NamedType);
context.RegisterSymbolAction(ExperimentalAnalyzer, SymbolKind.Method);
context.RegisterSymbolAction(ExperimentalAnalyzer, SymbolKind.Field);
context.RegisterSymbolAction(ExperimentalAnalyzer, SymbolKind.Event);
- context.RegisterSyntaxNodeAction(ExperimentalAnalyzer, SyntaxKind.InvocationExpression);
- context.RegisterSyntaxNodeAction(ExperimentalAnalyzer, SyntaxKind.ObjectCreationExpression);
- context.RegisterSyntaxNodeAction(ExperimentalAnalyzer, SyntaxKind.FieldDeclaration); // Don't work
- context.RegisterSyntaxNodeAction(ExperimentalAnalyzer, SyntaxKind.PropertyDeclaration); // Don't work, one of the not working ones should create a report if a property is used. I.e.:
+ context.RegisterSyntaxNodeAction(StatusAnalyzer, SyntaxKind.InvocationExpression);
+ context.RegisterSyntaxNodeAction(StatusAnalyzer, SyntaxKind.ObjectCreationExpression);
+ context.RegisterSyntaxNodeAction(StatusAnalyzer, SyntaxKind.FieldDeclaration); // Don't work
+ context.RegisterSyntaxNodeAction(StatusAnalyzer, SyntaxKind.PropertyDeclaration); // Don't work, one of the not working ones should create a report if a property is used. I.e.:
/*
var test = new Test("test");
test.Invoke();
var str = test.TestString; <- Fire here for TestString
*/
}
- private static void ExperimentalAnalyzer(SyntaxNodeAnalysisContext context)
+ private static void StatusAnalyzer(SyntaxNodeAnalysisContext context)
{
var invocation = context.Node;
var declaration = context.SemanticModel.GetSymbolInfo(invocation, context.CancellationToken).Symbol;
if (null == declaration)
{
Console.WriteLine("Faulty");
- //context.ReportDiagnostic(Diagnostic.Create(ExperimentalRule, invocation.GetLocation(), "unknown", "unknown", "unknown"));
return;
}
var attributes = declaration.GetAttributes();
- var attributeData = attributes.FirstOrDefault(attr => IsRequiredAttribute(context.SemanticModel, attr, typeof(ExperimentalAttribute)));
- if (null == attributeData)
- {
- Console.WriteLine("Faulty 2");
- return;
- }
+
var name = declaration.Name;
var kind = declaration.Kind.ToString();
if (name == ".ctor")
{
name = declaration.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);
kind = "Constructor";
}
- var message = GetMessage(attributeData);
- var diagnostic = Diagnostic.Create(ExperimentalRule, invocation.GetLocation(), kind, name, message);
- context.ReportDiagnostic(diagnostic);
-
+ var experimentalAttributeData = attributes.FirstOrDefault(attr => IsRequiredAttribute(context.SemanticModel, attr, typeof(ExperimentalAttribute)));
+ var discordInExperimentAttributeData = attributes.FirstOrDefault(attr => IsRequiredAttribute(context.SemanticModel, attr, typeof(DiscordInExperimentAttribute)));
+ var discordDeprecatedAttributeData = attributes.FirstOrDefault(attr => IsRequiredAttribute(context.SemanticModel, attr, typeof(DiscordDeprecatedAttribute)));
+ var discordUnreleasedAttributeData = attributes.FirstOrDefault(attr => IsRequiredAttribute(context.SemanticModel, attr, typeof(DiscordUnreleasedAttribute)));
+
+ if (experimentalAttributeData != null)
+ {
+ var message = GetMessage(experimentalAttributeData);
+ context.ReportDiagnostic(Diagnostic.Create(ExperimentalRule, invocation.GetLocation(), kind, name, message));
+ }
+ if (discordInExperimentAttributeData != null)
+ {
+ var message = GetMessage(discordInExperimentAttributeData);
+ context.ReportDiagnostic(Diagnostic.Create(DiscordInExperimentRule, invocation.GetLocation(), kind, name, message));
+ }
+ if (discordDeprecatedAttributeData != null)
+ {
+ var message = GetMessage(discordDeprecatedAttributeData);
+ context.ReportDiagnostic(Diagnostic.Create(DiscordDeprecatedRule, invocation.GetLocation(), kind, name, message));
+ }
+ if (discordUnreleasedAttributeData != null)
+ {
+ var message = GetMessage(discordUnreleasedAttributeData);
+ context.ReportDiagnostic(Diagnostic.Create(DiscordUnreleasedRule, invocation.GetLocation(), kind, name, message));
+ }
+ return;
}
private static void ExperimentalAnalyzer(SymbolAnalysisContext context)
{
Console.WriteLine("Handling " + context.Symbol.Kind.ToString());
var syntaxTrees = from x in context.Symbol.Locations
where x.IsInSource
select x.SourceTree;
var declaration = context.Symbol;
if (null == declaration)
{
Console.WriteLine("Faulty");
return;
}
var attributes = declaration.GetAttributes();
- var attributeData = attributes.FirstOrDefault(attr => IsRequiredAttribute(context.Compilation.GetSemanticModel(syntaxTrees.First()), attr, typeof(ExperimentalAttribute)));
- if (null == attributeData)
- {
- Console.WriteLine("Faulty 2");
- return;
- }
-
- var message = GetMessage(attributeData);
+
var name = declaration.Name;
var kind = declaration.Kind.ToString();
if (name == ".ctor")
{
name = declaration.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);
kind = "Constructor";
}
else if (kind == "NamedType")
{
kind = "Class";
}
- var diagnostic = Diagnostic.Create(ExperimentalRule, context.Symbol.Locations.First(x => x.IsInSource), kind, name, message);
- context.ReportDiagnostic(diagnostic);
+ var experimentalAttributeData = attributes.FirstOrDefault(attr => IsRequiredAttribute(context.Compilation.GetSemanticModel(syntaxTrees.First()), attr, typeof(ExperimentalAttribute)));
+ var discordInExperimentAttributeData = attributes.FirstOrDefault(attr => IsRequiredAttribute(context.Compilation.GetSemanticModel(syntaxTrees.First()), attr, typeof(DiscordInExperimentAttribute)));
+ var discordDeprecatedAttributeData = attributes.FirstOrDefault(attr => IsRequiredAttribute(context.Compilation.GetSemanticModel(syntaxTrees.First()), attr, typeof(DiscordDeprecatedAttribute)));
+ var discordUnreleasedAttributeData = attributes.FirstOrDefault(attr => IsRequiredAttribute(context.Compilation.GetSemanticModel(syntaxTrees.First()), attr, typeof(DiscordUnreleasedAttribute)));
+
+ if (experimentalAttributeData != null)
+ {
+ var message = GetMessage(experimentalAttributeData);
+ context.ReportDiagnostic(Diagnostic.Create(ExperimentalRule, context.Symbol.Locations.First(x => x.IsInSource), kind, name, message));
+ }
+ if (discordInExperimentAttributeData != null)
+ {
+ var message = GetMessage(discordInExperimentAttributeData);
+ context.ReportDiagnostic(Diagnostic.Create(DiscordInExperimentRule, context.Symbol.Locations.First(x => x.IsInSource), kind, name, message));
+ }
+ if (discordDeprecatedAttributeData != null)
+ {
+ var message = GetMessage(discordDeprecatedAttributeData);
+ context.ReportDiagnostic(Diagnostic.Create(DiscordDeprecatedRule, context.Symbol.Locations.First(x => x.IsInSource), kind, name, message));
+ }
+ if (discordUnreleasedAttributeData != null)
+ {
+ var message = GetMessage(discordUnreleasedAttributeData);
+ context.ReportDiagnostic(Diagnostic.Create(DiscordUnreleasedRule, context.Symbol.Locations.First(x => x.IsInSource), kind, name, message));
+ }
+ return;
}
static bool IsRequiredAttribute(SemanticModel semanticModel, AttributeData attribute, Type desiredAttributeType)
{
var desiredTypeNamedSymbol = semanticModel.Compilation.GetTypeByMetadataName(desiredAttributeType.FullName);
var result = attribute.AttributeClass.Equals(desiredTypeNamedSymbol, SymbolEqualityComparer.Default);
return result;
}
static string GetMessage(AttributeData attribute)
{
if (attribute.ConstructorArguments.Length < 1)
{
return "Do not use in production.";
}
return attribute.ConstructorArguments[0].Value as string;
}
}
}
diff --git a/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/DisCatSharp.Analyzer.csproj b/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/DisCatSharp.Analyzer.csproj
index 43d5c2451..6ce3cf696 100644
--- a/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/DisCatSharp.Analyzer.csproj
+++ b/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/DisCatSharp.Analyzer.csproj
@@ -1,35 +1,35 @@
netstandard2.0
false
*$(MSBuildProjectFile)*
AITSYS
true
true
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/Resources.Designer.cs b/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/Resources.Designer.cs
index b4cfed55c..857171e06 100644
--- a/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/Resources.Designer.cs
+++ b/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/Resources.Designer.cs
@@ -1,90 +1,171 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
namespace DisCatSharp.Analyzer {
using System;
///
/// A strongly-typed resource class, for looking up localized strings, etc.
///
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
///
/// Returns the cached ResourceManager instance used by this class.
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DisCatSharp.Analyzer.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
///
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
///
- /// Looks up a localized string similar to This is considered experimental and shouldn't be used in production..
+ /// Looks up a localized string similar to Discord deprecated this..
///
- internal static string AnalyzerDescription {
+ internal static string AnalyzerDescriptionDiscordDeprecated {
get {
- return ResourceManager.GetString("AnalyzerDescription", resourceCulture);
+ return ResourceManager.GetString("AnalyzerDescriptionDiscordDeprecated", resourceCulture);
}
}
///
- /// Looks up a localized string similar to {0} '{1}' is considered experimental: {2}.
+ /// Looks up a localized string similar to Discord has released it as experiment. Do not use in production..
///
- internal static string AnalyzerMessageFormat {
+ internal static string AnalyzerDescriptionDiscordInExperiment {
get {
- return ResourceManager.GetString("AnalyzerMessageFormat", resourceCulture);
+ return ResourceManager.GetString("AnalyzerDescriptionDiscordInExperiment", resourceCulture);
}
}
///
- /// Looks up a localized string similar to Experimental.
+ /// Looks up a localized string similar to Discord hasn't released this yet. Do not use in production.
///
- internal static string AnalyzerTitle {
+ internal static string AnalyzerDescriptionDiscordUnreleased {
get {
- return ResourceManager.GetString("AnalyzerTitle", resourceCulture);
+ return ResourceManager.GetString("AnalyzerDescriptionDiscordUnreleased", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to DisCatSharp considers this as experimental. Do not use in production..
+ ///
+ internal static string AnalyzerDescriptionExperimental {
+ get {
+ return ResourceManager.GetString("AnalyzerDescriptionExperimental", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to {0} '{1}' is deprecated: {2}.
+ ///
+ internal static string AnalyzerMessageFormatDiscordDeprecated {
+ get {
+ return ResourceManager.GetString("AnalyzerMessageFormatDiscordDeprecated", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to {0} '{1}' is in experiment: {2}.
+ ///
+ internal static string AnalyzerMessageFormatDiscordInExperiment {
+ get {
+ return ResourceManager.GetString("AnalyzerMessageFormatDiscordInExperiment", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to {0} '{1}' isn't released yet: {2}.
+ ///
+ internal static string AnalyzerMessageFormatDiscordUnreleased {
+ get {
+ return ResourceManager.GetString("AnalyzerMessageFormatDiscordUnreleased", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to {0} '{1}' is experimental: {2}.
+ ///
+ internal static string AnalyzerMessageFormatExperimental {
+ get {
+ return ResourceManager.GetString("AnalyzerMessageFormatExperimental", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to [Discord] Deprecated.
+ ///
+ internal static string AnalyzerTitleDiscordDeprecated {
+ get {
+ return ResourceManager.GetString("AnalyzerTitleDiscordDeprecated", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to [Discord] InExperiment.
+ ///
+ internal static string AnalyzerTitleDiscordInExperiment {
+ get {
+ return ResourceManager.GetString("AnalyzerTitleDiscordInExperiment", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to [Discord] Unreleased.
+ ///
+ internal static string AnalyzerTitleDiscordUnreleased {
+ get {
+ return ResourceManager.GetString("AnalyzerTitleDiscordUnreleased", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to [DCS] Experimental.
+ ///
+ internal static string AnalyzerTitleExperimental {
+ get {
+ return ResourceManager.GetString("AnalyzerTitleExperimental", resourceCulture);
}
}
}
}
diff --git a/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/Resources.resx b/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/Resources.resx
index ff7ebd2fa..3c30e82ba 100644
--- a/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/Resources.resx
+++ b/DisCatSharp.Tools/DisCatSharp.Analyzer/DisCatSharp.Analyzer/Resources.resx
@@ -1,132 +1,156 @@
text/microsoft-resx
2.0
System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- This is considered experimental and shouldn't be used in production.
- An optional longer localizable description of the diagnostic.
+
+ Discord deprecated this.
-
- {0} '{1}' is considered experimental: {2}
- The format-able message the diagnostic displays.
+
+ Discord has released it as experiment. Do not use in production.
-
- Experimental
- The title of the diagnostic.
+
+ Discord hasn't released this yet. Do not use in production
+
+
+ DisCatSharp considers this as experimental. Do not use in production.
+
+
+ {0} '{1}' is deprecated: {2}
+
+
+ {0} '{1}' is in experiment: {2}
+
+
+ {0} '{1}' isn't released yet: {2}
+
+
+ {0} '{1}' is experimental: {2}
+
+
+ [Discord] Deprecated
+
+
+ [Discord] InExperiment
+
+
+ [Discord] Unreleased
+
+
+ [DCS] Experimental
\ No newline at end of file
diff --git a/DisCatSharp/Entities/Guild/DiscordGuild.Features.cs b/DisCatSharp/Entities/Guild/DiscordGuild.Features.cs
index 19d7b6183..2432e3602 100644
--- a/DisCatSharp/Entities/Guild/DiscordGuild.Features.cs
+++ b/DisCatSharp/Entities/Guild/DiscordGuild.Features.cs
@@ -1,696 +1,696 @@
// 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 DisCatSharp.Attributes;
using DisCatSharp.Enums;
namespace DisCatSharp.Entities;
///
/// Represents the guild features.
///
public class GuildFeatures
{
///
/// List of all guild features.
///
public List Features { get; }
///
/// Checks the guild features and constructs a new object.
///
/// Guild to check
public GuildFeatures(DiscordGuild guild)
{
this.Features = new List();
if (guild.RawFeatures.Contains("APPLICATION_COMMAND_PERMISSIONS_V2")) this.Features.Add(GuildFeaturesEnum.UsesApplicationCommandsPermissionsV2);
if (guild.RawFeatures.Contains("RAID_ALERTS_ENABLED")) this.Features.Add(GuildFeaturesEnum.RaidAlertsEnabled);
if (guild.RawFeatures.Contains("CREATOR_MONETIZABLE_RESTRICTED")) this.Features.Add(GuildFeaturesEnum.CreatorMonetizableRestricted);
if (guild.RawFeatures.Contains("VOICE_IN_THREADS")) this.Features.Add(GuildFeaturesEnum.VoiceInThreadsEnabled);
if (guild.RawFeatures.Contains("CHANNEL_HIGHLIGHTS_DISABLED")) this.Features.Add(GuildFeaturesEnum.ChannelHighlightsDisabled);
if (guild.RawFeatures.Contains("CHANNEL_HIGHLIGHTS")) this.Features.Add(GuildFeaturesEnum.ChannelHighlights);
if (guild.RawFeatures.Contains("GUILD_ONBOARDING_EVER_ENABLED")) this.Features.Add(GuildFeaturesEnum.HadGuildOnBoardingEverEnabled);
if (guild.RawFeatures.Contains("BURST_REACTIONS")) this.Features.Add(GuildFeaturesEnum.CanUseBurstReactions);
- if (guild.RawFeatures.Contains("CREATOR_STORE_PAGE")) this.Features.Add(GuildFeaturesEnum.CanUseCreaterStorePage);
+ if (guild.RawFeatures.Contains("CREATOR_STORE_PAGE")) this.Features.Add(GuildFeaturesEnum.CanUseCreatorStorePage);
if (guild.RawFeatures.Contains("ANIMATED_ICON")) this.Features.Add(GuildFeaturesEnum.CanSetAnimatedIcon);
if (guild.RawFeatures.Contains("ANIMATED_BANNER")) this.Features.Add(GuildFeaturesEnum.CanSetAnimatedBanner);
if (guild.RawFeatures.Contains("BANNER")) this.Features.Add(GuildFeaturesEnum.CanSetBanner);
if (guild.RawFeatures.Contains("COMMUNITY")) this.Features.Add(GuildFeaturesEnum.HasCommunityEnabled);
if (!guild.RawFeatures.Contains("DISCOVERABLE_DISABLED") && guild.RawFeatures.Contains("DISCOVERABLE")) this.Features.Add(GuildFeaturesEnum.IsDiscoverable);
if (guild.RawFeatures.Contains("FEATUREABLE")) this.Features.Add(GuildFeaturesEnum.IsFeatureable);
if (guild.RawFeatures.Contains("INVITE_SPLASH")) this.Features.Add(GuildFeaturesEnum.CanSetInviteSplash);
if (guild.RawFeatures.Contains("MEMBER_VERIFICATION_GATE_ENABLED")) this.Features.Add(GuildFeaturesEnum.HasMembershipScreeningEnabled);
if (guild.RawFeatures.Contains("NEWS")) this.Features.Add(GuildFeaturesEnum.CanCreateNewsChannels);
if (guild.RawFeatures.Contains("PARTNERED")) this.Features.Add(GuildFeaturesEnum.IsPartnered);
if (guild.RawFeatures.Contains("MORE_EMOJI")) this.Features.Add(GuildFeaturesEnum.CanUploadMoreEmojis);
if (guild.RawFeatures.Contains("PREVIEW_ENABLED")) this.Features.Add(GuildFeaturesEnum.HasPreviewEnabled);
if (guild.RawFeatures.Contains("VANITY_URL")) this.Features.Add(GuildFeaturesEnum.CanSetVanityUrl);
if (guild.RawFeatures.Contains("VERIFIED")) this.Features.Add(GuildFeaturesEnum.IsVerified);
if (guild.RawFeatures.Contains("VIP_REGIONS")) this.Features.Add(GuildFeaturesEnum.CanAccessVipRegions);
if (guild.RawFeatures.Contains("WELCOME_SCREEN_ENABLED")) this.Features.Add(GuildFeaturesEnum.HasWelcomeScreenEnabled);
if (guild.RawFeatures.Contains("TICKETED_EVENTS_ENABLED")) this.Features.Add(GuildFeaturesEnum.HasTicketedEventsEnabled);
if (guild.RawFeatures.Contains("MONETIZATION_ENABLED")) this.Features.Add(GuildFeaturesEnum.HasMonetizationEnabled);
if (guild.RawFeatures.Contains("MORE_STICKERS")) this.Features.Add(GuildFeaturesEnum.CanUploadMoreStickers);
if (guild.RawFeatures.Contains("HUB")) this.Features.Add(GuildFeaturesEnum.IsHub);
if (guild.RawFeatures.Contains("THREADS_ENABLED_TESTING")) this.Features.Add(GuildFeaturesEnum.HasThreadTestingEnabled);
if (guild.RawFeatures.Contains("THREADS_ENABLED")) this.Features.Add(GuildFeaturesEnum.HasThreadsEnabled);
if (guild.RawFeatures.Contains("ROLE_ICONS")) this.Features.Add(GuildFeaturesEnum.CanSetRoleIcons);
if (guild.RawFeatures.Contains("NEW_THREAD_PERMISSIONS")) this.Features.Add(GuildFeaturesEnum.HasNewThreadPermissions);
if (guild.RawFeatures.Contains("ROLE_SUBSCRIPTIONS_ENABLED")) this.Features.Add(GuildFeaturesEnum.HasRoleSubscriptionsEnabled);
if (guild.RawFeatures.Contains("PREMIUM_TIER_3_OVERRIDE")) this.Features.Add(GuildFeaturesEnum.PremiumTierThreeOverride);
if (guild.RawFeatures.Contains("THREAD_DEFAULT_AUTO_ARCHIVE_DURATION")) this.Features.Add(GuildFeaturesEnum.CanSetThreadDefaultAutoArchiveDuration);
if (guild.RawFeatures.Contains("TEXT_IN_VOICE_ENABLED")) this.Features.Add(GuildFeaturesEnum.TextInVoiceEnabled);
if (guild.RawFeatures.Contains("HAS_DIRECTORY_ENTRY")) this.Features.Add(GuildFeaturesEnum.HasDirectoryEntry);
if (guild.RawFeatures.Contains("LINKED_TO_HUB")) this.Features.Add(GuildFeaturesEnum.IsLinkedToHub);
if (guild.RawFeatures.Contains("MEMBER_PROFILES")) this.Features.Add(GuildFeaturesEnum.HasMemberProfiles);
if (guild.RawFeatures.Contains("INTERNAL_EMPLOYEE_ONLY")) this.Features.Add(GuildFeaturesEnum.IsStaffOnly);
if (guild.RawFeatures.Contains("ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE")) this.Features.Add(GuildFeaturesEnum.RoleSubscriptionsIsAvailableForPurchase);
if (guild.RawFeatures.Contains("AUTO_MODERATION")) this.Features.Add(GuildFeaturesEnum.CanSetupAutoModeration);
if (guild.RawFeatures.Contains("GUILD_HOME_TEST")) this.Features.Add(GuildFeaturesEnum.GuildHomeTest);
if (guild.RawFeatures.Contains("INVITES_DISABLED")) this.Features.Add(GuildFeaturesEnum.InvitesDisabled);
if (guild.RawFeatures.Contains("ACTIVITIES_ALPHA")) this.Features.Add(GuildFeaturesEnum.ActivitiesAlpha);
if (guild.RawFeatures.Contains("ACTIVITIES_EMPLOYEE")) this.Features.Add(GuildFeaturesEnum.ActivitiesEmployee);
if (guild.RawFeatures.Contains("ACTIVITIES_INTERNAL_DEV")) this.Features.Add(GuildFeaturesEnum.ActivitiesInternalDev);
if (guild.RawFeatures.Contains("AUTOMOD_TRIGGER_KEYWORD_FILTER")) this.Features.Add(GuildFeaturesEnum.AutomodTriggerKeywordFilter);
if (guild.RawFeatures.Contains("AUTOMOD_TRIGGER_ML_SPAM_FILTER")) this.Features.Add(GuildFeaturesEnum.AutomodTriggerMlSpamFilter);
if (guild.RawFeatures.Contains("AUTOMOD_TRIGGER_SPAM_LINK_FILTERGuild")) this.Features.Add(GuildFeaturesEnum.AutomodTriggerSpamLinkFilterGuild);
if (guild.RawFeatures.Contains("AUTOMOD_DEFAULT_LIST")) this.Features.Add(GuildFeaturesEnum.AutomodDefaultList);
if (guild.RawFeatures.Contains("BFG")) this.Features.Add(GuildFeaturesEnum.Bfg);
if (guild.RawFeatures.Contains("BOOSTING_TIERS_EXPERIMENT_MEDIUM_GUILD")) this.Features.Add(GuildFeaturesEnum.BoostingTiersExperimentMediumGuild);
if (guild.RawFeatures.Contains("BOOSTING_TIERS_EXPERIMENT_SMALL_GUILD")) this.Features.Add(GuildFeaturesEnum.BoostingTiersExperimentSmallGuild);
if (guild.RawFeatures.Contains("BOT_DEVELOPER_EARLY_ACCESS")) this.Features.Add(GuildFeaturesEnum.BotDeveloperEarlyAccess);
if (guild.RawFeatures.Contains("CREATOR_MONETIZABLE")) this.Features.Add(GuildFeaturesEnum.CreatorMonetizable);
if (guild.RawFeatures.Contains("CREATOR_MONETIZABLE_DISABLED")) this.Features.Add(GuildFeaturesEnum.CreatorMonetizableDisabled);
if (guild.RawFeatures.Contains("CREATOR_MONETIZABLE_PROVISIONAL")) this.Features.Add(GuildFeaturesEnum.CreatorMonetizableProvisional);
if (guild.RawFeatures.Contains("CREATOR_MONETIZABLE_WHITEGLOVE")) this.Features.Add(GuildFeaturesEnum.CreatorMonetizableWhiteGlove);
if (guild.RawFeatures.Contains("CREATOR_MONETIZATION_APPLICATION_ALLOWLIST")) this.Features.Add(GuildFeaturesEnum.CreatorMonetizationApplicationAllowlist);
if (guild.RawFeatures.Contains("DEVELOPER_SUPPORT_SERVER")) this.Features.Add(GuildFeaturesEnum.DeveloperSupportServer);
if (guild.RawFeatures.Contains("EXPOSED_TO_ACTIVITIES_WTP_EXPERIMENT")) this.Features.Add(GuildFeaturesEnum.ExposedToActivitiesWtpExperiment);
if (guild.RawFeatures.Contains("GUILD_COMMUNICATION_DISABLED_GUILDS")) this.Features.Add(GuildFeaturesEnum.GuildCommunicationDisabledGuilds);
if (guild.RawFeatures.Contains("DISABLE_GUILD_COMMUNICATION")) this.Features.Add(GuildFeaturesEnum.DisableGuildCommunication);
if (guild.RawFeatures.Contains("GUILD_HOME_OVERRIDE")) this.Features.Add(GuildFeaturesEnum.GuildHomeOverride);
if (guild.RawFeatures.Contains("GUILD_AUTOMOD_DEFAULT_LIST")) this.Features.Add(GuildFeaturesEnum.GuildAutomodDefaultList);
if (guild.RawFeatures.Contains("GUILD_MEMBER_VERIFICATION_EXPERIMENT")) this.Features.Add(GuildFeaturesEnum.GuildMemberVerificationExperiment);
if (guild.RawFeatures.Contains("GUILD_ROLE_SUBSCRIPTION_PURCHASE_FEEDBACK_LOOP")) this.Features.Add(GuildFeaturesEnum.GuildRoleSubscriptionPurchaseFeedbackLoop);
if (guild.RawFeatures.Contains("GUILD_ROLE_SUBSCRIPTION_TRIALS")) this.Features.Add(GuildFeaturesEnum.GuildRoleSubscriptionTrials);
if (guild.RawFeatures.Contains("HAD_EARLY_ACTIVITIES_ACCESS")) this.Features.Add(GuildFeaturesEnum.HadEarlyActivitiesAccess);
if (guild.RawFeatures.Contains("INCREASED_THREAD_LIMIT")) this.Features.Add(GuildFeaturesEnum.IncreasedThreadLimit);
if (guild.RawFeatures.Contains("MOBILE_WEB_ROLE_SUBSCRIPTION_PURCHASE_PAGE")) this.Features.Add(GuildFeaturesEnum.MobileWebRoleSubscriptionPurchasePage);
if (guild.RawFeatures.Contains("RELAY_ENABLED")) this.Features.Add(GuildFeaturesEnum.RelayEnabled);
if (guild.RawFeatures.Contains("RESTRICT_SPAM_RISK_GUILDS")) this.Features.Add(GuildFeaturesEnum.RestrictSpamRiskGuilds);
if (guild.RawFeatures.Contains("ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE")) this.Features.Add(GuildFeaturesEnum.RoleSubscriptionsAvailableForPurchase);
if (guild.RawFeatures.Contains("THREADS_ENABLED_TESTING")) this.Features.Add(GuildFeaturesEnum.ThreadsEnabledTesting);
if (guild.RawFeatures.Contains("VOICE_CHANNEL_EFFECTS")) this.Features.Add(GuildFeaturesEnum.VoiceChannelEffects);
if (guild.RawFeatures.Contains("SOUNDBOARD")) this.Features.Add(GuildFeaturesEnum.Soundboard);
#pragma warning disable CS0612 // Type or member is obsolete
if (guild.RawFeatures.Contains("COMMERCE")) this.Features.Add(GuildFeaturesEnum.Commerce);
#pragma warning restore CS0612 // Type or member is obsolete
#pragma warning disable CS0612 // Type or member is obsolete
if (guild.RawFeatures.Contains("EXPOSED_TO_BOOSTING_TIERS_EXPERIMENT")) this.Features.Add(GuildFeaturesEnum.ExposedToBoostingTiersExperiment);
#pragma warning restore CS0612 // Type or member is obsolete
#pragma warning disable CS0612 // Type or member is obsolete
if (guild.RawFeatures.Contains("PUBLIC_DISABLED")) this.Features.Add(GuildFeaturesEnum.PublicDisabled);
#pragma warning restore CS0612 // Type or member is obsolete
#pragma warning disable CS0612 // Type or member is obsolete
if (guild.RawFeatures.Contains("PUBLIC")) this.Features.Add(GuildFeaturesEnum.Public);
#pragma warning restore CS0612 // Type or member is obsolete
#pragma warning disable CS0612 // Type or member is obsolete
if (guild.RawFeatures.Contains("SEVEN_DAY_THREAD_ARCHIVE")) this.Features.Add(GuildFeaturesEnum.SevenDayThreadArchive);
#pragma warning restore CS0612 // Type or member is obsolete
#pragma warning disable CS0612 // Type or member is obsolete
if (guild.RawFeatures.Contains("THREE_DAY_THREAD_ARCHIVE")) this.Features.Add(GuildFeaturesEnum.ThreeDayThreadArchive);
#pragma warning restore CS0612 // Type or member is obsolete
#pragma warning disable CS0612 // Type or member is obsolete
if (guild.RawFeatures.Contains("FEATURABLE")) this.Features.Add(GuildFeaturesEnum.Featurable);
#pragma warning restore CS0612 // Type or member is obsolete
#pragma warning disable CS0612 // Type or member is obsolete
if (guild.RawFeatures.Contains("FORCE_RELAY")) this.Features.Add(GuildFeaturesEnum.ForceRelay);
#pragma warning restore CS0612 // Type or member is obsolete
#pragma warning disable CS0612 // Type or member is obsolete
if (guild.RawFeatures.Contains("LURKABLE")) this.Features.Add(GuildFeaturesEnum.Lurkable);
#pragma warning restore CS0612 // Type or member is obsolete
#pragma warning disable CS0612 // Type or member is obsolete
if (guild.RawFeatures.Contains("MEMBER_LIST_DISABLED")) this.Features.Add(GuildFeaturesEnum.MemberListDisabled);
#pragma warning restore CS0612 // Type or member is obsolete
#pragma warning disable CS0612 // Type or member is obsolete
if (guild.RawFeatures.Contains("CHANNEL_BANNER")) this.Features.Add(GuildFeaturesEnum.CanSetChannelBanner);
#pragma warning restore CS0612 // Type or member is obsolete
#pragma warning disable CS0612 // Type or member is obsolete
if (guild.RawFeatures.Contains("PRIVATE_THREADS")) this.Features.Add(GuildFeaturesEnum.CanCreatePrivateThreads);
#pragma warning restore CS0612 // Type or member is obsolete
}
///
/// Checks whether the guild has a feature enabled.
///
/// The feature you'd like to check for.
/// Whether the guild has the requested feature.
public bool HasFeature(GuildFeaturesEnum flag)
=> this.Features.Contains(flag);
public string ToString(string separator, bool humanReadable)
{
if (!humanReadable) return string.Join(separator, this.Features);
else
{
var humanReadableFeatures = this.Features.Select(x => AddSpacesToWord(x.ToString()));
return string.Join(separator, humanReadableFeatures);
}
}
///
/// Converts a string of characters (here: enum) into a string of characters separated by spaces after a capital letter.
///
/// String of text to convert
/// String separated by a space after every capital letter.
private static string AddSpacesToWord(string text)
{
if (string.IsNullOrWhiteSpace(text))
return "";
var newText = new StringBuilder(text.Length * 2);
newText.Append(text[0]);
for (int i = 1; i < text.Length; i++)
{
if (char.IsUpper(text[i]) && text[i - 1] != ' ')
newText.Append(' ');
newText.Append(text[i]);
}
return newText.ToString();
}
}
///
/// Represents the guild features.
///
public enum GuildFeaturesEnum
{
///
/// Guild has access to set an animated guild icon.
///
CanSetAnimatedIcon,
///
/// Guild has access to set a guild banner image.
///
CanSetBanner,
///
/// Guild has access to use commerce features (i.e. create store channels)
///
[Obsolete("Store applications are EOL.")]
CanCreateStoreChannels,
///
/// Guild can enable Welcome Screen, Membership Screening, Stage Channels, News Channels and receives community updates.
/// Furthermore the guild can apply as a partner and for the discovery (if the prerequisites are given).
/// and is usable.
///
HasCommunityEnabled,
///
/// Guild is able to be discovered in the discovery.
///
IsDiscoverable,
///
/// Guild is able to be featured in the discovery.
///
IsFeatureable,
///
/// Guild has access to set an invite splash background.
///
CanSetInviteSplash,
///
/// Guild has enabled Membership Screening.
///
HasMembershipScreeningEnabled,
///
/// Guild has access to create news channels.
/// is usable.
///
CanCreateNewsChannels,
///
/// Guild is partnered.
///
IsPartnered,
///
/// Guild has increased custom emoji slots.
///
CanUploadMoreEmojis,
///
/// Guild can be previewed before joining via Membership Screening or the discovery.
///
HasPreviewEnabled,
///
/// Guild has access to set a vanity URL.
///
CanSetVanityUrl,
///
/// Guild is verified.
///
IsVerified,
///
/// Guild has access to set 384kbps bitrate in voice (previously VIP voice servers).
///
CanAccessVipRegions,
///
/// Guild has enabled the welcome screen.
///
HasWelcomeScreenEnabled,
///
/// Guild has enabled ticketed events.
///
HasTicketedEventsEnabled,
///
/// Guild has enabled monetization.
///
HasMonetizationEnabled,
///
/// Guild has increased custom sticker slots.
///
CanUploadMoreStickers,
///
/// Guild has access to the three day archive time for threads.
/// Needs Premium Tier 1 ().
///
[DiscordDeprecated("Auto archive duration isn't locked to boosts anymore."), Obsolete]
CanSetThreadArchiveDurationThreeDays,
///
/// Guild has access to the seven day archive time for threads.
/// Needs Premium Tier 2 ().
///
[DiscordDeprecated("Auto archive duration isn't locked to boosts anymore."), Obsolete]
CanSetThreadArchiveDurationSevenDays,
///
/// Guild has access to create private threads.
/// Needs Premium Tier 2 ().
///
[DiscordDeprecated("Private threads aren't bound to the server boost level anymore and can be used by everyone."), Obsolete]
CanCreatePrivateThreads,
///
/// Guild is a hub.
/// is usable.
///
IsHub,
///
/// Guild is in a hub.
/// https://github.com/discord/discord-api-docs/pull/3757/commits/4932d92c9d0c783861bc715bf7ebbabb15114e34
///
HasDirectoryEntry,
///
/// Guild is linked to a hub.
///
IsLinkedToHub,
///
/// Guild has full access to threads.
/// Old Feature.
///
HasThreadTestingEnabled,
///
/// Guild has access to threads.
///
HasThreadsEnabled,
///
/// Guild can set role icons.
///
CanSetRoleIcons,
///
/// Guild has the new thread permissions.
/// Old Feature.
///
HasNewThreadPermissions,
///
/// Guild can set thread default auto archive duration.
/// Old Feature.
///
CanSetThreadDefaultAutoArchiveDuration,
///
/// Guild has enabled role subscriptions.
///
HasRoleSubscriptionsEnabled,
///
/// Guild role subscriptions as purchaseable.
///
RoleSubscriptionsIsAvailableForPurchase,
///
/// Guild has premium tier 3 override.
///
PremiumTierThreeOverride,
///
/// Guild has access to text in voice.
/// Restricted to .
///
TextInVoiceEnabled,
///
/// Guild can set an animated banner.
/// Needs Premium Tier 3 ().
///
CanSetAnimatedBanner,
///
/// Guild can set an animated banner.
/// Needs Premium Tier 3 ().
///
[DiscordDeprecated("Feature was removed"), Obsolete]
CanSetChannelBanner,
///
/// Allows members to customize their avatar, banner and bio for that server.
///
HasMemberProfiles,
///
/// Guild is restricted to users with the badge.
///
IsStaffOnly,
///
/// Guild can use and setup the experimental auto moderation feature.
///
CanSetupAutoModeration,
///
/// Guild has access to home.
///
GuildHomeTest,
///
/// Guild has disabled invites.
///
InvitesDisabled,
///
/// Currently unknown.
///
ActivitiesAlpha,
///
/// Currently unknown.
///
ActivitiesEmployee,
///
/// Currently unknown.
///
ActivitiesInternalDev,
///
/// Currently unknown.
///
AutomodTriggerKeywordFilter,
///
/// Currently unknown.
///
AutomodTriggerMlSpamFilter,
///
/// Currently unknown.
///
AutomodTriggerSpamLinkFilterGuild,
///
/// Currently unknown.
///
AutomodDefaultList,
///
/// Currently unknown.
///
Bfg,
///
/// Currently unknown.
///
BoostingTiersExperimentMediumGuild,
///
/// Currently unknown.
///
BoostingTiersExperimentSmallGuild,
///
/// Guild has early access features for bot and library developers.
///
BotDeveloperEarlyAccess,
///
/// Currently unknown.
///
CreatorMonetizable,
///
/// Currently unknown.
///
CreatorMonetizableDisabled,
///
/// Currently unknown.
///
CreatorMonetizableProvisional,
///
/// Currently unknown.
///
CreatorMonetizableWhiteGlove,
///
/// Currently unknown.
///
CreatorMonetizationApplicationAllowlist,
///
/// Guild is set as a support server for an app in App Directory.
///
DeveloperSupportServer,
///
/// Guild was previously in the 2021-11_activities_baseline_engagement_bundle experiment.
///
ExposedToActivitiesWtpExperiment,
///
/// Guild had early access to the user timeouts.
///
GuildCommunicationDisabledGuilds,
///
/// Currently unknown.
///
DisableGuildCommunication,
///
/// Guild has access to the Home feature.
///
GuildHomeOverride,
///
/// Guild had early access to the Automod Default List.
///
GuildAutomodDefaultList,
///
/// Guild had early access to approving membership manually.
///
GuildMemberVerificationExperiment,
///
/// Guilds was previously in the 2022-05_mobile_web_role_subscription_purchase_page experiment.
///
GuildRoleSubscriptionPurchaseFeedbackLoop,
///
/// Guild was previously in the 2022-01_guild_role_subscription_trials experiment.
///
GuildRoleSubscriptionTrials,
///
/// Guild previously had access to voice channel activities and can bypass the boost level requirement.
///
HadEarlyActivitiesAccess,
///
/// Allows the guild to have 1,000+ active threads.
///
IncreasedThreadLimit,
///
/// Guild was previously in the 2022-05_mobile_web_role_subscription_purchase_page experiment.
///
MobileWebRoleSubscriptionPurchasePage,
///
/// Shards connections to the guild to different nodes that relay information between each other.
///
RelayEnabled,
///
/// Currently unknown.
///
RestrictSpamRiskGuilds,
///
/// Allows guild's members to purchase role subscriptions.
///
RoleSubscriptionsAvailableForPurchase,
///
/// Used by bot developers to test their bots with threads in guilds with 5 or less members and a bot.
///
ThreadsEnabledTesting,
///
/// Guild had early access to the voice channel effects.
///
VoiceChannelEffects,
///
/// Guild had early access to the soundboard feature.
///
Soundboard,
///
/// Ability to create and use store channels.
///
[DiscordDeprecated("This feature is depcreated"), Obsolete]
Commerce,
///
/// Currently unknown.
///
[DiscordDeprecated("This feature is depcreated"), Obsolete]
ExposedToBoostingTiersExperiment,
///
/// Deprecated in favor of Community.
///
[DiscordDeprecated("This feature is depcreated"), Obsolete]
PublicDisabled,
///
/// Deprecated in favor of Community.
///
[DiscordDeprecated("This feature is depcreated"), Obsolete]
Public,
///
/// The guild can use the seven-day archive time for threads.
///
[DiscordDeprecated("This feature is depcreated"), Obsolete]
SevenDayThreadArchive,
///
/// The guild can use the three-day archive time for threads.
///
[DiscordDeprecated("This feature is depcreated"), Obsolete]
ThreeDayThreadArchive,
///
/// Previously used to control which servers were displayed under the "Featured" category in Discovery.
///
[DiscordDeprecated("This feature is depcreated"), Obsolete]
Featurable,
///
/// Shards connections to the guild to different nodes that relay information between each other.
///
[DiscordDeprecated("This feature is depcreated"), Obsolete]
ForceRelay,
///
/// Currently unknown.
///
[DiscordDeprecated("This feature is depcreated"), Obsolete]
Lurkable,
///
/// Created for the Fortnite server blackout event on Oct 13, 2019, when viewing the member list it would show "There's nothing to see here.".
///
[DiscordDeprecated("This feature is depcreated"), Obsolete]
MemberListDisabled,
[DiscordInExperiment]
- CanUseCreaterStorePage,
+ CanUseCreatorStorePage,
[DiscordInExperiment]
CanUseBurstReactions,
[DiscordInExperiment]
HadGuildOnBoardingEverEnabled,
[DiscordInExperiment]
ChannelHighlightsDisabled,
[DiscordInExperiment]
ChannelHighlights,
[DiscordInExperiment]
CreatorMonetizableRestricted,
[DiscordUnreleased]
VoiceInThreadsEnabled,
[DiscordUnreleased]
RaidAlertsEnabled,
[Experimental("Was recently added to determine whether guilds uses the newer permission system for application commands.")]
UsesApplicationCommandsPermissionsV2,
}
diff --git a/_typos.toml b/_typos.toml
index 02b615937..4d29e3be5 100644
--- a/_typos.toml
+++ b/_typos.toml
@@ -1,28 +1,29 @@
[default.extend-identifiers]
FLAG_BA = "FLAG_BA"
flag_ba = "flag_ba"
FLAG_FO = "FLAG_FO"
flag_fo = "flag_fo"
[default.extend-words]
CLAUS = "CLAUS"
claus = "claus"
WOMENS = "WOMENS"
goes = "goes"
ret = "ret"
axe = "axe"
Behaviour = "Behaviour"
prev = "prev"
desktopbsd = "desktopbsd"
deffered = "deffered"
Rythm = "Rythm"
ist = "ist"
+Monetizable = "Monetizable"
[files]
ignore-vcs = true
ignore-files = true
ignore-dot = true
extend-exclude = ["DisCatSharp.Docs/dcs/src/*","DisCatSharp.Docs/dcs/partials/*","DisCatSharp.Tools/*"]
[default]
locale = "en-us"