├── .editorconfig ├── .gitattributes ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ └── enhancement.yml └── workflows │ ├── build-and-publish.yml │ ├── build.yml │ ├── cleanup-documentation-preview.yml │ └── documentation-preview.yml ├── .gitignore ├── Directory.Build.props ├── Directory.Build.targets ├── Documentation ├── .editorconfig ├── .eslintrc.cjs ├── .gitignore ├── .stylelintrc.json ├── Directory.Build.props ├── Directory.Build.targets ├── README.md ├── build-templates.js ├── build.js ├── docfx.json ├── docs │ ├── .gitignore │ └── index.md ├── favicon.ico ├── guides │ ├── basic-concepts │ │ ├── HttpInteractions │ │ │ ├── HttpInteractionHandler.cs │ │ │ ├── HttpInteractions.csproj │ │ │ ├── Program.cs │ │ │ ├── Properties │ │ │ │ └── launchSettings.json │ │ │ └── appsettings.json │ │ ├── RespondingToInteractions │ │ │ ├── Program.cs │ │ │ └── RespondingToInteractions.csproj │ │ ├── SendingMessages │ │ │ ├── Program.cs │ │ │ └── SendingMessages.csproj │ │ ├── Sharding │ │ │ ├── Program.cs │ │ │ ├── RegisteringHandlers.cs │ │ │ └── Sharding.csproj │ │ ├── ShardingHosting │ │ │ ├── MessageUpdateHandler.cs │ │ │ ├── Program.cs │ │ │ ├── RegisteringHandlers.cs │ │ │ └── ShardingHosting.csproj │ │ ├── Voice │ │ │ ├── Program.cs │ │ │ ├── Voice.csproj │ │ │ └── VoiceModule.cs │ │ ├── http-interactions.md │ │ ├── installing-native-dependencies.md │ │ ├── responding-to-interactions.md │ │ ├── sending-messages.md │ │ ├── sharding.md │ │ └── voice.md │ ├── events │ │ ├── FirstEvents │ │ │ ├── FirstEvents.csproj │ │ │ └── Program.cs │ │ ├── FirstEventsHosting │ │ │ ├── FirstEventsHosting.csproj │ │ │ ├── MessageCreateHandler.cs │ │ │ ├── MessageReactionAddHandler.cs │ │ │ └── Program.cs │ │ ├── Intents │ │ │ ├── Intents.csproj │ │ │ └── Program.cs │ │ ├── IntentsHosting │ │ │ ├── IntentsHosting.csproj │ │ │ └── Program.cs │ │ ├── first-events.md │ │ └── intents.md │ ├── getting-started │ │ ├── Coding │ │ │ ├── Coding.csproj │ │ │ └── Program.cs │ │ ├── CodingHosting │ │ │ ├── CodingHosting.csproj │ │ │ ├── Program.cs │ │ │ └── appsettings.json │ │ ├── installation.md │ │ └── making-a-bot.md │ ├── services │ │ ├── CustomModuleBasesAndContexts │ │ │ ├── CustomContexts │ │ │ │ ├── CustomCommandContext.cs │ │ │ │ ├── CustomContexts.csproj │ │ │ │ └── ExampleModule.cs │ │ │ └── CustomModuleBases │ │ │ │ ├── CustomCommandModule.cs │ │ │ │ ├── CustomModuleBases.csproj │ │ │ │ └── ExampleModule.cs │ │ ├── DependencyInjection │ │ │ ├── DataAutocompleteProvider.cs │ │ │ ├── DataModule.cs │ │ │ ├── DependencyInjection.csproj │ │ │ ├── ISomeService.cs │ │ │ └── Program.cs │ │ ├── Preconditions │ │ │ ├── ParameterPreconditions │ │ │ │ ├── HelloModule.cs │ │ │ │ ├── MustContainAttribute.cs │ │ │ │ ├── ParameterPreconditions.csproj │ │ │ │ └── Program.cs │ │ │ └── Preconditions │ │ │ │ ├── AvatarModule.cs │ │ │ │ ├── ButtonModule.cs │ │ │ │ ├── Preconditions.csproj │ │ │ │ ├── Program.cs │ │ │ │ └── RequireAnimatedAvatarAttribute.cs │ │ ├── application-commands │ │ │ ├── Introduction │ │ │ │ ├── ExampleModule.cs │ │ │ │ ├── Introduction.csproj │ │ │ │ └── Program.cs │ │ │ ├── IntroductionHosting │ │ │ │ ├── IntroductionHosting.csproj │ │ │ │ └── Program.cs │ │ │ ├── Localizations │ │ │ │ ├── AnimalModule.cs │ │ │ │ ├── Localizations.csproj │ │ │ │ ├── Localizations │ │ │ │ │ └── pl.json │ │ │ │ ├── PermissionsModule.cs │ │ │ │ └── Program.cs │ │ │ ├── LocalizationsHosting │ │ │ │ ├── LocalizationsHosting.csproj │ │ │ │ └── Program.cs │ │ │ ├── MultipleServices │ │ │ │ ├── MultipleServices.csproj │ │ │ │ └── Program.cs │ │ │ ├── Parameters │ │ │ │ ├── Animal.cs │ │ │ │ ├── ExampleModule.cs │ │ │ │ ├── Parameters.csproj │ │ │ │ └── Program.cs │ │ │ ├── Permissions │ │ │ │ ├── ExampleModule.cs │ │ │ │ ├── Permissions.csproj │ │ │ │ └── Program.cs │ │ │ ├── Subcommands │ │ │ │ ├── GuildCommandsModule.cs │ │ │ │ ├── Program.cs │ │ │ │ └── Subcommands.csproj │ │ │ ├── introduction.md │ │ │ ├── localizations.md │ │ │ ├── multiple-services.md │ │ │ ├── parameters.md │ │ │ ├── permissions.md │ │ │ └── subcommands.md │ │ ├── component-interactions │ │ │ ├── Introduction │ │ │ │ ├── ButtonModule.cs │ │ │ │ ├── ChannelMenuModule.cs │ │ │ │ ├── Introduction.csproj │ │ │ │ ├── MentionableMenuModule.cs │ │ │ │ ├── ModalModule.cs │ │ │ │ ├── Program.cs │ │ │ │ ├── RoleMenuModule.cs │ │ │ │ ├── StringMenuModule.cs │ │ │ │ └── UserMenuModule.cs │ │ │ ├── IntroductionHosting │ │ │ │ ├── IntroductionHosting.csproj │ │ │ │ └── Program.cs │ │ │ ├── Parameters │ │ │ │ ├── ExampleModule.cs │ │ │ │ └── Parameters.csproj │ │ │ ├── introduction.md │ │ │ └── parameters.md │ │ ├── custom-module-bases-and-contexts.md │ │ ├── dependency-injection.md │ │ ├── introduction.md │ │ ├── preconditions.md │ │ ├── text-commands │ │ │ ├── Aliases │ │ │ │ ├── Aliases.csproj │ │ │ │ ├── ExampleModule.cs │ │ │ │ └── Program.cs │ │ │ ├── Introduction │ │ │ │ ├── ExampleModule.cs │ │ │ │ ├── Introduction.csproj │ │ │ │ └── Program.cs │ │ │ ├── IntroductionHosting │ │ │ │ ├── IntroductionHosting.csproj │ │ │ │ ├── Program.cs │ │ │ │ └── appsettings.json │ │ │ ├── Parameters │ │ │ │ ├── ExampleModule.cs │ │ │ │ ├── Parameters.csproj │ │ │ │ └── Program.cs │ │ │ ├── aliases.md │ │ │ ├── introduction.md │ │ │ └── parameters.md │ │ └── type-readers.md │ └── toc.yml ├── image_sources │ ├── http-interactions_FindingPublicKeyAndSpecifyingInteractionEndpointUrl.pdn │ ├── installation_JetBrainsRider_1.pdn │ ├── installation_JetBrainsRider_2.pdn │ ├── installation_VisualStudio_1.pdn │ ├── installation_VisualStudio_2.pdn │ ├── intents_Privileged.pdn │ ├── making-a-bot_AddBotToServer_1.pdn │ ├── making-a-bot_AddBotToServer_2.pdn │ ├── making-a-bot_BotOnline.pdn │ ├── making-a-bot_CreateApplication_1.pdn │ ├── making-a-bot_CreateApplication_2.pdn │ ├── making-a-bot_Token_1.pdn │ └── making-a-bot_Token_2.pdn ├── images │ ├── BigOutline.png │ ├── BigOutline.webp │ ├── SmallSquare.png │ ├── SmallSquare.webp │ ├── http-interactions_FindingPublicKeyAndSpecifyingInteractionEndpointUrl.webp │ ├── installation_JetBrainsRider_1.webp │ ├── installation_JetBrainsRider_2.webp │ ├── installation_VisualStudio_1.webp │ ├── installation_VisualStudio_2.webp │ ├── intents_Privileged.webp │ ├── logo.png │ ├── logo.webp │ ├── making-a-bot_AddBotToServer_1.webp │ ├── making-a-bot_AddBotToServer_2.webp │ ├── making-a-bot_BotOnline.webp │ ├── making-a-bot_CreateApplication_1.webp │ ├── making-a-bot_CreateApplication_2.webp │ ├── making-a-bot_Token_1.webp │ └── making-a-bot_Token_2.webp ├── index.md ├── logo.svg ├── package-lock.json ├── package.json ├── robots.txt ├── templates-src │ ├── .editorconfig │ ├── .gitignore │ └── NetCord │ │ ├── ApiPage.html.primary.js │ │ ├── ApiPage.html.primary.tmpl │ │ ├── fonts │ │ ├── cascadia-code.woff2 │ │ └── franklin-gothic-heavy.woff2 │ │ ├── layout │ │ └── _master.tmpl │ │ ├── partials │ │ ├── class.header.tmpl.partial │ │ ├── class.memberpage.tmpl.partial │ │ ├── class.tmpl.partial │ │ ├── collection.tmpl.partial │ │ ├── customMREFContent.tmpl.partial │ │ ├── enum.tmpl.partial │ │ ├── example.tmpl.partial │ │ ├── item.tmpl.partial │ │ ├── namespace.tmpl.partial │ │ └── root.tmpl.partial │ │ └── src │ │ ├── docfx.scss │ │ ├── docfx.ts │ │ ├── dotnet.scss │ │ ├── helper.test.ts │ │ ├── helper.ts │ │ ├── highlight.scss │ │ ├── highlight.ts │ │ ├── layout.scss │ │ ├── main.css │ │ ├── main.js │ │ ├── markdown.scss │ │ ├── markdown.ts │ │ ├── mixins.scss │ │ ├── nav.scss │ │ ├── nav.ts │ │ ├── options.d.ts │ │ ├── search-worker.ts │ │ ├── search.scss │ │ ├── search.ts │ │ ├── theme.ts │ │ ├── toc.scss │ │ └── toc.ts ├── toc.yml └── tsconfig.json ├── Hosting ├── NetCord.Hosting.AspNetCore │ ├── EndpointRouteBuilderExtensions.cs │ ├── NetCord.Hosting.AspNetCore.csproj │ └── RoutePatternHelper.cs ├── NetCord.Hosting.Services │ ├── ApplicationCommands │ │ ├── ApplicationCommandInteractionHandler.cs │ │ ├── ApplicationCommandResultHandler.cs │ │ ├── ApplicationCommandServiceHostBuilderExtensions.cs │ │ ├── ApplicationCommandServiceHostExtensions.cs │ │ ├── ApplicationCommandServiceHostedService.cs │ │ ├── ApplicationCommandServiceOptions.cs │ │ ├── ApplicationCommandServiceServiceCollectionExtensions.cs │ │ ├── AutocompleteInteractionHandler.cs │ │ ├── AutocompleteInteractionResultHandler.cs │ │ ├── IApplicationCommandResultHandler.cs │ │ └── IAutocompleteInteractionResultHandler.cs │ ├── Commands │ │ ├── CommandHandler.cs │ │ ├── CommandResultHandler.cs │ │ ├── CommandServiceHostBuilderExtensions.cs │ │ ├── CommandServiceHostExtensions.cs │ │ ├── CommandServiceOptions.cs │ │ ├── CommandServiceServiceCollectionExtensions.cs │ │ └── ICommandResultHandler.cs │ ├── ComponentInteractions │ │ ├── ComponentInteractionHandler.cs │ │ ├── ComponentInteractionResultHandler.cs │ │ ├── ComponentInteractionServiceHostBuilderExtensions.cs │ │ ├── ComponentInteractionServiceHostExtensions.cs │ │ ├── ComponentInteractionServiceOptions.cs │ │ ├── ComponentInteractionServiceServiceCollectionExtensions.cs │ │ └── IComponentInteractionResultHandler.cs │ ├── ContextHelper.cs │ ├── KeyedServiceResolverProvider.cs │ ├── NetCord.Hosting.Services.csproj │ ├── ServiceProviderServiceHelper.cs │ └── ServicesHostExtensions.cs └── NetCord.Hosting │ ├── ConfigurationHelper.cs │ ├── DelegateHandlerHelper.cs │ ├── Gateway │ ├── GatewayClientHostBuilderExtensions.cs │ ├── GatewayClientHostedService.cs │ ├── GatewayClientOptions.cs │ ├── GatewayClientServiceCollectionExtensions.cs │ ├── GatewayEventAttribute.cs │ ├── GatewayEventHandlerHostExtensions.cs │ ├── GatewayEventHandlerServiceCollectionExtensions.cs │ ├── GatewayEventHandlers.cs │ ├── GatewayMicrosoftExtensionsLogger.cs │ ├── ShardedGatewayClientHostBuilderExtensions.cs │ ├── ShardedGatewayClientHostedService.cs │ ├── ShardedGatewayClientOptions.cs │ ├── ShardedGatewayClientServiceCollectionExtensions.cs │ └── ShardedGatewayMicrosoftExtensionsLogger.cs │ ├── GlobalUsings.cs │ ├── HttpInteractionHandlerServiceCollectionExtensions.cs │ ├── HttpInteractionHandlers.cs │ ├── IDiscordOptions.cs │ ├── ITokenFactory.cs │ ├── NetCord.Hosting.csproj │ └── Rest │ ├── RestClientHostBuilderExtensions.cs │ ├── RestClientOptions.cs │ ├── RestClientServiceCollectionExtensions.cs │ └── RestMicrosoftExtensionsLogger.cs ├── LICENSE.md ├── NetCord.Services ├── ApplicationCommands │ ├── ApplicationCommandAttribute.cs │ ├── ApplicationCommandContexts.cs │ ├── ApplicationCommandInfo.cs │ ├── ApplicationCommandModule.cs │ ├── ApplicationCommandResultResolverProvider.cs │ ├── ApplicationCommandService.cs │ ├── ApplicationCommandServiceConfiguration.cs │ ├── ApplicationCommandServiceManager.cs │ ├── AutoTranscodingStream.cs │ ├── AutocompleteInteractionContexts.cs │ ├── BaseApplicationCommandModule.cs │ ├── GuildCommands.cs │ ├── IApplicationCommandContext.cs │ ├── IApplicationCommandInfo.cs │ ├── IApplicationCommandService.cs │ ├── IAutocompleteInfo.cs │ ├── IAutocompleteInteractionContext.cs │ ├── IAutocompleteProvider.cs │ ├── IChoicesProvider.cs │ ├── ILocalizationsProvider.cs │ ├── ISlashCommandParameterNameProcessor.cs │ ├── ISubSlashCommandInfo.cs │ ├── JsonLocalizationsProvider.cs │ ├── LocalizationPathSegment.cs │ ├── MessageCommandAttribute.cs │ ├── MessageCommandInfo.cs │ ├── SlashCommandAttribute.cs │ ├── SlashCommandBuilder.cs │ ├── SlashCommandChoiceAttribute.cs │ ├── SlashCommandGroupInfo.cs │ ├── SlashCommandInfo.cs │ ├── SlashCommandParameter.cs │ ├── SlashCommandParameterAttribute.cs │ ├── SlashCommandParametersHelper.cs │ ├── SlashCommandTypeReader.cs │ ├── SubSlashCommandAttribute.cs │ ├── SubSlashCommandGroupInfo.cs │ ├── SubSlashCommandInfo.cs │ ├── TypeReaders │ │ ├── AttachmentTypeReader.cs │ │ ├── BooleanTypeReader.cs │ │ ├── ByteTypeReader.cs │ │ ├── Channels │ │ │ ├── CategoryGuildChannelTypeReader.cs │ │ │ ├── ChannelTypeReader.cs │ │ │ ├── IGuildChannelTypeReader.cs │ │ │ ├── INamedChannelTypeReader.cs │ │ │ ├── TextChannels │ │ │ │ ├── DMChannelTypeReader.cs │ │ │ │ ├── GroupDMChannelTypeReader.cs │ │ │ │ ├── Guild │ │ │ │ │ ├── AnnouncementGuildChannelTypeReader.cs │ │ │ │ │ ├── DirectoryGuildChannelTypeReader.cs │ │ │ │ │ ├── ForumGuildChannelTypeReader.cs │ │ │ │ │ ├── MediaForumGuildChannelTypeReader.cs │ │ │ │ │ ├── TextGuildChannelTypeReader.cs │ │ │ │ │ └── Threads │ │ │ │ │ │ ├── AnnouncementGuildThreadTypeReader.cs │ │ │ │ │ │ ├── GuildThreadTypeReader.cs │ │ │ │ │ │ ├── PrivateGuildThreadTypeReader.cs │ │ │ │ │ │ └── PublicGuildThreadTypeReader.cs │ │ │ │ └── TextChannelTypeReader.cs │ │ │ └── VoiceChannels │ │ │ │ └── Guild │ │ │ │ ├── IVoiceGuildChannelTypeReader.cs │ │ │ │ ├── StageGuildChannelTypeReader.cs │ │ │ │ └── VoiceGuildChannelTypeReader.cs │ │ ├── DecimalTypeReader.cs │ │ ├── DoubleTypeReader.cs │ │ ├── EnumTypeReader.cs │ │ ├── GuildUserTypeReader.cs │ │ ├── HalfTypeReader.cs │ │ ├── Int128TypeReader.cs │ │ ├── Int16TypeReader.cs │ │ ├── Int32TypeReader.cs │ │ ├── Int64TypeReader.cs │ │ ├── IntPtrTypeReader.cs │ │ ├── MentionableTypeReader.cs │ │ ├── RoleTypeReader.cs │ │ ├── SByteTypeReader.cs │ │ ├── SingleTypeReader.cs │ │ ├── StringTypeReader.cs │ │ ├── UInt128TypeReader.cs │ │ ├── UInt16TypeReader.cs │ │ ├── UInt32TypeReader.cs │ │ ├── UInt64TypeReader.cs │ │ ├── UIntPtrTypeReader.cs │ │ └── UserTypeReader.cs │ ├── UserCommandAttribute.cs │ └── UserCommandInfo.cs ├── AssemblyInfo.cs ├── Commands │ ├── AllowByValueAttribute.cs │ ├── BaseCommandModule.cs │ ├── CommandAttribute.cs │ ├── CommandContexts.cs │ ├── CommandInfo.cs │ ├── CommandModule.cs │ ├── CommandParameter.cs │ ├── CommandParameterAttribute.cs │ ├── CommandResultResolverProvider.cs │ ├── CommandService.cs │ ├── CommandServiceConfiguration.cs │ ├── CommandTypeReader.cs │ ├── ICommandContext.cs │ ├── ICommandService.cs │ ├── SortedList.cs │ └── TypeReaders │ │ ├── BigIntegerTypeReader.cs │ │ ├── BooleanTypeReader.cs │ │ ├── ByteTypeReader.cs │ │ ├── Channels │ │ ├── CategoryGuildChannelTypeReader.cs │ │ ├── ChannelTypeReader.cs │ │ ├── IGuildChannelTypeReader.cs │ │ ├── INamedChannelTypeReader.cs │ │ ├── TextChannels │ │ │ ├── DMChannelTypeReader.cs │ │ │ ├── GroupDMChannelTypeReader.cs │ │ │ ├── Guild │ │ │ │ ├── AnnouncementGuildChannelTypeReader.cs │ │ │ │ ├── DirectoryGuildChannelTypeReader.cs │ │ │ │ ├── ForumGuildChannelTypeReader.cs │ │ │ │ ├── MediaForumGuildChannelTypeReader.cs │ │ │ │ ├── TextGuildChannelTypeReader.cs │ │ │ │ └── Threads │ │ │ │ │ ├── AnnouncementGuildThreadTypeReader.cs │ │ │ │ │ ├── GuildThreadTypeReader.cs │ │ │ │ │ ├── PrivateGuildThreadTypeReader.cs │ │ │ │ │ └── PublicGuildThreadTypeReader.cs │ │ │ └── TextChannelTypeReader.cs │ │ └── VoiceChannels │ │ │ └── Guild │ │ │ ├── IVoiceGuildChannelTypeReader.cs │ │ │ ├── StageGuildChannelTypeReader.cs │ │ │ └── VoiceGuildChannelTypeReader.cs │ │ ├── CharTypeReader.cs │ │ ├── CodeBlockTypeReader.cs │ │ ├── DateOnlyTypeReader.cs │ │ ├── DateTimeOffsetTypeReader.cs │ │ ├── DateTimeTypeReader.cs │ │ ├── DecimalTypeReader.cs │ │ ├── DoubleTypeReader.cs │ │ ├── EnumTypeReader.cs │ │ ├── GuildUserTypeReader.cs │ │ ├── HalfTypeReader.cs │ │ ├── Int128TypeReader.cs │ │ ├── Int16TypeReader.cs │ │ ├── Int32TypeReader.cs │ │ ├── Int64TypeReader.cs │ │ ├── IntPtrTypeReader.cs │ │ ├── ReadOnlyMemoryOfCharTypeReader.cs │ │ ├── SByteTypeReader.cs │ │ ├── SingleTypeReader.cs │ │ ├── StringTypeReader.cs │ │ ├── TimeOnlyTypeReader.cs │ │ ├── TimeSpanTypeReader.cs │ │ ├── TimestampTypeReader.cs │ │ ├── UInt128TypeReader.cs │ │ ├── UInt16TypeReader.cs │ │ ├── UInt32TypeReader.cs │ │ ├── UInt64TypeReader.cs │ │ ├── UIntPtrTypeReader.cs │ │ ├── UriTypeReader.cs │ │ ├── UserIdTypeReader.cs │ │ └── UserTypeReader.cs ├── ComponentInteractions │ ├── BaseComponentInteractionModule.cs │ ├── ComponentInteractionAttribute.cs │ ├── ComponentInteractionContexts.cs │ ├── ComponentInteractionInfo.cs │ ├── ComponentInteractionModule.cs │ ├── ComponentInteractionParameter.cs │ ├── ComponentInteractionParameterAttribute.cs │ ├── ComponentInteractionResultResolverProvider.cs │ ├── ComponentInteractionService.cs │ ├── ComponentInteractionServiceConfiguration.cs │ ├── ComponentInteractionTypeReader.cs │ ├── IComponentInteractionContext.cs │ ├── IComponentInteractionService.cs │ └── TypeReaders │ │ ├── BigIntegerTypeReader.cs │ │ ├── BooleanTypeReader.cs │ │ ├── ByteTypeReader.cs │ │ ├── CharTypeReader.cs │ │ ├── CodeBlockTypeReader.cs │ │ ├── DateOnlyTypeReader.cs │ │ ├── DateTimeOffsetTypeReader.cs │ │ ├── DateTimeTypeReader.cs │ │ ├── DecimalTypeReader.cs │ │ ├── DoubleTypeReader.cs │ │ ├── EnumTypeReader.cs │ │ ├── GuildUserTypeReader.cs │ │ ├── HalfTypeReader.cs │ │ ├── Int128TypeReader.cs │ │ ├── Int16TypeReader.cs │ │ ├── Int32TypeReader.cs │ │ ├── Int64TypeReader.cs │ │ ├── IntPtrTypeReader.cs │ │ ├── ReadOnlyMemoryOfCharTypeReader.cs │ │ ├── SByteTypeReader.cs │ │ ├── SingleTypeReader.cs │ │ ├── StringTypeReader.cs │ │ ├── TimeOnlyTypeReader.cs │ │ ├── TimeSpanTypeReader.cs │ │ ├── TimestampTypeReader.cs │ │ ├── UInt128TypeReader.cs │ │ ├── UInt16TypeReader.cs │ │ ├── UInt32TypeReader.cs │ │ ├── UInt64TypeReader.cs │ │ ├── UIntPtrTypeReader.cs │ │ ├── UriTypeReader.cs │ │ └── UserIdTypeReader.cs ├── Contexts │ ├── IChannelContext.cs │ ├── IContext.cs │ ├── IGatewayClientContext.cs │ ├── IGuildContext.cs │ ├── IInteractionContext.cs │ ├── IRestClientContext.cs │ ├── IRestMessageContext.cs │ └── IUserContext.cs ├── EnumTypeReaders │ ├── EnumHelper.cs │ ├── EnumNameOrValueTypeReader.cs │ ├── EnumNameTypeReader.cs │ ├── EnumTypeReaderManager.cs │ ├── EnumValueTypeReader.cs │ ├── IEnumTypeReader.cs │ ├── SlashCommandEnumTypeReader.cs │ └── TryParseDelegate.cs ├── ExecutionExceptionResult.cs ├── Helpers │ ├── InvocationHelper.cs │ ├── MethodHelper.cs │ ├── ParameterHelper.cs │ ├── ParametersHelper.cs │ ├── PreconditionsHelper.cs │ ├── ServiceHelpers.cs │ ├── ServiceProviderHelper.cs │ ├── TimeSpanTypeReaderHelper.cs │ └── TypeHelper.cs ├── IBaseModule.cs ├── IExecutionResult.cs ├── IResultResolverProvider.cs ├── IService.cs ├── IServiceResolverProvider.cs ├── InvalidDefinitionException.cs ├── Mentionable.cs ├── NetCord.Services.csproj ├── NotFoundResult.cs ├── ParameterCountMismatchResult.cs ├── ParameterCountMismatchType.cs ├── ParameterPreconditionAttributes │ └── ParameterPreconditionAttribute.cs ├── PreconditionAttributes │ ├── MissingPermissionsResult.cs │ ├── PermissionsType.cs │ ├── PreconditionAttribute.cs │ ├── PreconditionResult.cs │ ├── RequireBotPermissionsAttribute.cs │ ├── RequireContextAttribute.cs │ ├── RequireNsfwAttribute.cs │ └── RequireUserPermissionsAttribute.cs ├── ReadOnlyMemoryCharComparer.cs ├── ServiceResolverProvider.cs ├── SuccessResult.cs ├── TypeReaderNotFoundException.cs ├── TypeReaderResult.cs ├── UserId.cs └── Utils │ └── CollectionsUtils.cs ├── NetCord.slnx ├── NetCord ├── Account.cs ├── ApiVersion.cs ├── Application.cs ├── ApplicationCommandInteraction.cs ├── ApplicationCommandInteractionData.cs ├── ApplicationCommandInteractionDataOption.cs ├── ApplicationCommandOptionType.cs ├── ApplicationCommandPermission.cs ├── ApplicationCommandPermissionType.cs ├── ApplicationCommandType.cs ├── ApplicationEmoji.cs ├── ApplicationFlags.cs ├── ApplicationInstallParams.cs ├── ApplicationIntegrationType.cs ├── ApplicationIntegrationTypeConfiguration.cs ├── Attachment.cs ├── AttachmentExpirationInfo.cs ├── AttachmentFlags.cs ├── AuditLogChange.cs ├── AuditLogEntryInfo.cs ├── AuditLogEvent.cs ├── AutoModerationAction.cs ├── AutoModerationActionMetadata.cs ├── AutoModerationActionMetadataProperties.cs ├── AutoModerationActionProperties.cs ├── AutoModerationActionType.cs ├── AutoModerationRule.cs ├── AutoModerationRuleEventType.cs ├── AutoModerationRuleKeywordPresetType.cs ├── AutoModerationRuleOptions.cs ├── AutoModerationRuleProperties.cs ├── AutoModerationRuleTriggerMetadata.cs ├── AutoModerationRuleTriggerMetadataProperties.cs ├── AutoModerationRuleTriggerType.cs ├── AutocompleteInteraction.cs ├── AutocompleteInteractionData.cs ├── AvatarDecorationData.cs ├── ButtonInteraction.cs ├── ButtonInteractionData.cs ├── ButtonStyle.cs ├── ChannelFlags.cs ├── ChannelMenuInteraction.cs ├── ChannelType.cs ├── Channels │ ├── CategoryGuildChannel.cs │ ├── Channel.cs │ ├── IGuildChannel.cs │ ├── IInteractionChannel.cs │ ├── INamedChannel.cs │ ├── IUnknownChannel.cs │ ├── IUnknownGuildChannel.cs │ ├── TextChannels │ │ ├── DMChannel.cs │ │ ├── GroupDMChannel.cs │ │ ├── Guild │ │ │ ├── AnnouncementGuildChannel.cs │ │ │ ├── DirectoryGuildChannel.cs │ │ │ ├── ForumGuildChannel.cs │ │ │ ├── MediaForumGuildChannel.cs │ │ │ ├── TextGuildChannel.cs │ │ │ └── Threads │ │ │ │ ├── AnnouncementGuildThread.cs │ │ │ │ ├── ForumGuildThread.cs │ │ │ │ ├── GuildThread.cs │ │ │ │ ├── GuildThreadMetadata.cs │ │ │ │ ├── IUnknownGuildThread.cs │ │ │ │ ├── PrivateGuildThread.cs │ │ │ │ ├── PublicGuildThread.cs │ │ │ │ └── UnknownGuildThread.cs │ │ ├── IUnknownDMChannel.cs │ │ ├── IUnknownTextChannel.cs │ │ ├── TextChannel.cs │ │ ├── UnknownDMChannel.cs │ │ └── UnknownTextChannel.cs │ ├── UnknownChannel.cs │ ├── UnknownGuildChannel.cs │ └── VoiceChannels │ │ └── Guild │ │ ├── IVoiceGuildChannel.cs │ │ ├── StageGuildChannel.cs │ │ └── VoiceGuildChannel.cs ├── ClientEntity.cs ├── CodeBlock.cs ├── Color.cs ├── ComponentInteraction.cs ├── ComponentInteractionData.cs ├── Components │ ├── ActionRow.cs │ ├── Button.cs │ ├── ChannelMenu.cs │ ├── ComponentContainer.cs │ ├── ComponentMedia.cs │ ├── ComponentMediaLoadingState.cs │ ├── ComponentSection.cs │ ├── ComponentSectionThumbnail.cs │ ├── ComponentSeparator.cs │ ├── ComponentSeparatorSpacingSize.cs │ ├── ComponentType.cs │ ├── EntityMenu.cs │ ├── FileDisplay.cs │ ├── IButton.cs │ ├── IComponent.cs │ ├── IComponentSectionAccessory.cs │ ├── ICustomizableButton.cs │ ├── IUnknownComponent.cs │ ├── LinkButton.cs │ ├── MediaGallery.cs │ ├── MentionableMenu.cs │ ├── MentionableMenuDefaultValue.cs │ ├── MentionableMenuDefaultValueType.cs │ ├── Menu.cs │ ├── PremiumButton.cs │ ├── RoleMenu.cs │ ├── StringMenu.cs │ ├── StringMenuSelectOption.cs │ ├── TextDisplay.cs │ ├── TextInput.cs │ └── UserMenu.cs ├── ContentFilter.cs ├── CurrentApplication.cs ├── CurrentUser.cs ├── CustomEmoji.cs ├── DefaultMessageNotificationLevel.cs ├── Discord.cs ├── Embed.cs ├── EmbedAuthor.cs ├── EmbedField.cs ├── EmbedFooter.cs ├── EmbedImage.cs ├── EmbedProvider.cs ├── EmbedThumbnail.cs ├── EmbedType.cs ├── EmbedVideo.cs ├── Emoji.cs ├── EmojiProperties.cs ├── EmojiReference.cs ├── Entitlement.cs ├── EntitlementType.cs ├── Entity.cs ├── EntityMenuInteraction.cs ├── EntityMenuInteractionData.cs ├── EntityNotFoundException.cs ├── Format.cs ├── ForumGuildChannelDefaultReaction.cs ├── ForumLayoutType.cs ├── ForumTag.cs ├── Gateway │ ├── AddedThreadUser.cs │ ├── AuditLogEntry.cs │ ├── CancellationTokenProvider.cs │ ├── Compression │ │ ├── IGatewayCompression.cs │ │ ├── UncompressedGatewayCompression.cs │ │ ├── ZLibGatewayCompression.cs │ │ ├── Zstandard.cs │ │ ├── ZstandardException.cs │ │ └── ZstandardGatewayCompression.cs │ ├── ConnectionPropertiesProperties.cs │ ├── EventArgs │ │ ├── AutoModerationActionExecutionEventArgs.cs │ │ ├── ChannelPinsUpdateEventArgs.cs │ │ ├── DisconnectEventArgs.cs │ │ ├── GuildBanEventArgs.cs │ │ ├── GuildCreateEventArgs.cs │ │ ├── GuildDeleteEventArgs.cs │ │ ├── GuildEmojisUpdateEventArgs.cs │ │ ├── GuildIntegrationDeleteEventArgs.cs │ │ ├── GuildIntegrationEventArgs.cs │ │ ├── GuildIntegrationsUpdateEventArgs.cs │ │ ├── GuildJoinRequestDeleteEventArgs.cs │ │ ├── GuildJoinRequestUpdateEventArgs.cs │ │ ├── GuildScheduledEventUserEventArgs.cs │ │ ├── GuildStickersUpdateEventArgs.cs │ │ ├── GuildThreadCreateEventArgs.cs │ │ ├── GuildThreadDeleteEventArgs.cs │ │ ├── GuildThreadListSyncEventArgs.cs │ │ ├── GuildThreadUserUpdateEventArgs.cs │ │ ├── GuildThreadUsersUpdateEventArgs.cs │ │ ├── GuildUserChunkEventArgs.cs │ │ ├── GuildUserRemoveEventArgs.cs │ │ ├── InviteDeleteEventArgs.cs │ │ ├── MessageDeleteBulkEventArgs.cs │ │ ├── MessageDeleteEventArgs.cs │ │ ├── MessagePollVoteEventArgs.cs │ │ ├── MessageReactionAddEventArgs.cs │ │ ├── MessageReactionRemoveAllEventArgs.cs │ │ ├── MessageReactionRemoveEmojiEventArgs.cs │ │ ├── MessageReactionRemoveEventArgs.cs │ │ ├── ReadyEventArgs.cs │ │ ├── RoleDeleteEventArgs.cs │ │ ├── TypingStartEventArgs.cs │ │ ├── UnknownEventEventArgs.cs │ │ ├── VoiceChannelEffectSendEventArgs.cs │ │ ├── VoiceServerUpdateEventArgs.cs │ │ └── WebhooksUpdateEventArgs.cs │ ├── GatewayClient.cs │ ├── GatewayClientCache.cs │ ├── GatewayClientConfiguration.cs │ ├── GatewayClientConfigurationFactory.cs │ ├── GatewayIdentifyProperties.cs │ ├── GatewayIntents.cs │ ├── GatewayOpcode.cs │ ├── GatewayPayloadProperties.cs │ ├── GatewayRateLimiterProvider.cs │ ├── GatewayResumeProperties.cs │ ├── Guild.cs │ ├── GuildJoinRequest.cs │ ├── GuildJoinRequestFormResponse.cs │ ├── GuildJoinRequestFormResponseFieldType.cs │ ├── GuildJoinRequestStatus.cs │ ├── GuildUsersRequestProperties.cs │ ├── IGatewayClientCache.cs │ ├── IRateLimiter.cs │ ├── IRateLimiterProvider.cs │ ├── IRestClientOwnerConfiguration.cs │ ├── IWebSocketClientConfiguration.cs │ ├── Invite.cs │ ├── JsonModels │ │ ├── EventArgs │ │ │ ├── JsonAutoModerationActionExecutionEventArgs.cs │ │ │ ├── JsonChannelPinsUpdateEventArgs.cs │ │ │ ├── JsonGuildBanEventArgs.cs │ │ │ ├── JsonGuildEmojisUpdateEventArgs.cs │ │ │ ├── JsonGuildIntegrationDeleteEventArgs.cs │ │ │ ├── JsonGuildIntegrationsUpdateEventArgs.cs │ │ │ ├── JsonGuildJoinRequestDeleteEventArgs.cs │ │ │ ├── JsonGuildJoinRequestUpdateEventArgs.cs │ │ │ ├── JsonGuildScheduledEventUserEventArgs.cs │ │ │ ├── JsonGuildStickersUpdateEventArgs.cs │ │ │ ├── JsonGuildThreadListSyncEventArgs.cs │ │ │ ├── JsonGuildThreadUsersUpdateEventArgs.cs │ │ │ ├── JsonGuildUserChunkEventArgs.cs │ │ │ ├── JsonGuildUserRemoveEventArgs.cs │ │ │ ├── JsonInviteDeleteEventArgs.cs │ │ │ ├── JsonMessageDeleteBulkEventArgs.cs │ │ │ ├── JsonMessageDeleteEventArgs.cs │ │ │ ├── JsonMessagePollVoteEventArgs.cs │ │ │ ├── JsonMessageReactionAddEventArgs.cs │ │ │ ├── JsonMessageReactionRemoveAllEventArgs.cs │ │ │ ├── JsonMessageReactionRemoveEmojiEventArgs.cs │ │ │ ├── JsonMessageReactionRemoveEventArgs.cs │ │ │ ├── JsonReadyEventArgs.cs │ │ │ ├── JsonRoleDeleteEventArgs.cs │ │ │ ├── JsonRoleEventArgs.cs │ │ │ ├── JsonTypingStartEventArgs.cs │ │ │ ├── JsonVoiceChannelEffectSendEventArgs.cs │ │ │ ├── JsonVoiceServerUpdateEventArgs.cs │ │ │ └── JsonWebhooksUpdateEventArgs.cs │ │ ├── JsonGatewayClientCache.cs │ │ ├── JsonGatewayPayload.cs │ │ ├── JsonGuildJoinRequest.cs │ │ ├── JsonGuildJoinRequestFormResponse.cs │ │ ├── JsonHello.cs │ │ ├── JsonInvite.cs │ │ ├── JsonParty.cs │ │ ├── JsonPresence.cs │ │ ├── JsonUserActivity.cs │ │ ├── JsonUserActivityAssets.cs │ │ ├── JsonUserActivitySecrets.cs │ │ ├── JsonUserActivityTimestamps.cs │ │ └── JsonVoiceState.cs │ ├── LatencyTimers │ │ ├── ILatencyTimer.cs │ │ └── LatencyTimer.cs │ ├── Message.cs │ ├── NullRateLimiterProvider.cs │ ├── Party.cs │ ├── PartyProperties.cs │ ├── PartySizeProperties.cs │ ├── Platform.cs │ ├── Presence.cs │ ├── PresenceProperties.cs │ ├── RateLimitAcquisitionResult.cs │ ├── ReconnectStrategies │ │ ├── IReconnectStrategy.cs │ │ └── ReconnectStrategy.cs │ ├── RentedArrayBufferWriter.cs │ ├── Shard.cs │ ├── ShardedGatewayClient.cs │ ├── ShardedGatewayClientConfiguration.cs │ ├── ShardedGatewayClientConfigurationFactory.cs │ ├── ShardedGatewayClientEventManager.cs │ ├── UserActivity.cs │ ├── UserActivityAssets.cs │ ├── UserActivityAssetsProperties.cs │ ├── UserActivityButton.cs │ ├── UserActivityButtonProperties.cs │ ├── UserActivityFlags.cs │ ├── UserActivityProperties.cs │ ├── UserActivitySecrets.cs │ ├── UserActivitySecretsProperties.cs │ ├── UserActivityTimestamps.cs │ ├── UserActivityTimestampsProperties.cs │ ├── UserActivityType.cs │ ├── Voice │ │ ├── Channels.cs │ │ ├── Encryption │ │ │ ├── Aes256GcmEncryption.cs │ │ │ ├── Aes256GcmRtpSizeEncryption.cs │ │ │ ├── IVoiceEncryption.cs │ │ │ ├── Libsodium.cs │ │ │ ├── LibsodiumException.cs │ │ │ ├── XChaCha20Poly1305RtpSizeEncryption.cs │ │ │ ├── XSalsa20Poly1305Encryption.cs │ │ │ ├── XSalsa20Poly1305LiteEncryption.cs │ │ │ ├── XSalsa20Poly1305LiteRtpSizeEncryption.cs │ │ │ └── XSalsa20Poly1305SuffixEncryption.cs │ │ ├── EventArgs │ │ │ ├── SpeakingEventArgs.cs │ │ │ ├── UserConnectEventArgs.cs │ │ │ ├── UserDisconnectEventArgs.cs │ │ │ ├── VoicePacketHandlingResult.cs │ │ │ └── VoiceReceiveEventArgs.cs │ │ ├── GatewayClientExtensions.cs │ │ ├── IVoiceClientCache.cs │ │ ├── IVoiceEncryptionProvider.cs │ │ ├── IVoiceReceiveHandler.cs │ │ ├── JsonModels │ │ │ ├── JsonClientConnect.cs │ │ │ ├── JsonClientDisconnect.cs │ │ │ ├── JsonReady.cs │ │ │ ├── JsonSessionDescription.cs │ │ │ ├── JsonSpeaking.cs │ │ │ ├── JsonVoiceClientCache.cs │ │ │ └── JsonVoicePayload.cs │ │ ├── NullVoiceReceiveHandler.cs │ │ ├── Opus.cs │ │ ├── OpusApplication.cs │ │ ├── OpusDecoder.cs │ │ ├── OpusDecoderHandle.cs │ │ ├── OpusEncoder.cs │ │ ├── OpusEncoderHandle.cs │ │ ├── OpusError.cs │ │ ├── OpusException.cs │ │ ├── PcmFormat.cs │ │ ├── ProtocolDataProperties.cs │ │ ├── ProtocolProperties.cs │ │ ├── ResumeProperties.cs │ │ ├── RtpPacket.cs │ │ ├── RtpPacketStorage.cs │ │ ├── RtpPacketWriter.cs │ │ ├── SpeakingFlags.cs │ │ ├── SpeakingProperties.cs │ │ ├── Streams │ │ │ ├── OpusDecodeStream.cs │ │ │ ├── OpusEncodeStream.cs │ │ │ ├── RewritingStream.cs │ │ │ ├── SpeedNormalizingStream.cs │ │ │ └── VoiceOutStream.cs │ │ ├── UdpSockets │ │ │ ├── IUdpConnection.cs │ │ │ ├── IUdpConnectionProvider.cs │ │ │ ├── UdpConnection.cs │ │ │ └── UdpConnectionProvider.cs │ │ ├── VoiceApiVersion.cs │ │ ├── VoiceClient.cs │ │ ├── VoiceClientCache.cs │ │ ├── VoiceClientConfiguration.cs │ │ ├── VoiceEncryptionProvider.cs │ │ ├── VoiceHeartbeatProperties.cs │ │ ├── VoiceIdentifyProperties.cs │ │ ├── VoiceOpcode.cs │ │ ├── VoicePayloadProperties.cs │ │ └── VoiceReceiveHandler.cs │ ├── VoiceState.cs │ ├── VoiceStateProperties.cs │ ├── WebSocketClient.cs │ ├── WebSocketPayloadProperties.cs │ ├── WebSocketRateLimitedException.cs │ ├── WebSocketRetryHandling.cs │ └── WebSockets │ │ ├── IWebSocketConnection.cs │ │ ├── IWebSocketConnectionProvider.cs │ │ ├── WebSocketConnection.cs │ │ ├── WebSocketConnectionProvider.cs │ │ ├── WebSocketConnectionReceiveResult.cs │ │ ├── WebSocketMessageFlags.cs │ │ └── WebSocketMessageType.cs ├── GuildChannelMention.cs ├── GuildEmoji.cs ├── GuildFromGuildTemplateProperties.cs ├── GuildInteractionUser.cs ├── GuildNavigation.cs ├── GuildNavigationType.cs ├── GuildScheduledEvent.cs ├── GuildScheduledEventEntityType.cs ├── GuildScheduledEventPrivacyLevel.cs ├── GuildScheduledEventRecurrenceRule.cs ├── GuildScheduledEventRecurrenceRuleFrequency.cs ├── GuildScheduledEventRecurrenceRuleMonth.cs ├── GuildScheduledEventRecurrenceRuleNWeekday.cs ├── GuildScheduledEventRecurrenceRuleWeekday.cs ├── GuildScheduledEventStatus.cs ├── GuildSticker.cs ├── GuildUser.cs ├── GuildUserFlags.cs ├── GuildWelcomeScreen.cs ├── GuildWelcomeScreenChannel.cs ├── GuildWidgetStyle.cs ├── IEntity.cs ├── IHttpSerializable.cs ├── IInteraction.cs ├── IInvite.cs ├── IJsonModel.cs ├── IToken.cs ├── ImageAttachment.cs ├── ImageFormat.cs ├── ImageUrl.cs ├── Integration.cs ├── IntegrationApplication.cs ├── IntegrationExpireBehavior.cs ├── IntegrationType.cs ├── Interaction.cs ├── InteractionContextType.cs ├── InteractionData.cs ├── InteractionGuildReference.cs ├── InteractionResolvedData.cs ├── InteractionType.cs ├── InviteTargetType.cs ├── InviteType.cs ├── JsonConverters │ ├── AnyValueToStringConverter.cs │ ├── ArrayToImmutableDictionaryConverters.cs │ ├── AttachmentPropertiesIEnumerableConverter.cs │ ├── MenuPropertiesDefaultValuesConverter.cs │ ├── NullConverter.cs │ ├── NullableDateTimeOffsetConverter.cs │ ├── NullableInt64Converter.cs │ ├── PermissionsConverter.cs │ ├── SafeStringEnumConverter.cs │ ├── UInt64Converter.cs │ └── UnixDateTimeOffsetConverters.cs ├── JsonModels │ ├── JsonAccount.cs │ ├── JsonApplication.cs │ ├── JsonApplicationCommandGuildPermission.cs │ ├── JsonApplicationCommandInteractionDataOption.cs │ ├── JsonApplicationInstallParams.cs │ ├── JsonApplicationIntegrationTypeConfiguration.cs │ ├── JsonAttachment.cs │ ├── JsonAuditLogChange.cs │ ├── JsonAuditLogEntry.cs │ ├── JsonAuditLogEntryInfo.cs │ ├── JsonAutoModerationAction.cs │ ├── JsonAutoModerationActionMetadata.cs │ ├── JsonAutoModerationRule.cs │ ├── JsonAutoModerationRuleTriggerMetadata.cs │ ├── JsonAvatarDecorationData.cs │ ├── JsonChannel.cs │ ├── JsonComponent.cs │ ├── JsonComponentMedia.cs │ ├── JsonEmbed.cs │ ├── JsonEmbedAuthor.cs │ ├── JsonEmbedField.cs │ ├── JsonEmbedFooter.cs │ ├── JsonEmbedImage.cs │ ├── JsonEmbedProvider.cs │ ├── JsonEmbedThumbnail.cs │ ├── JsonEmbedVideo.cs │ ├── JsonEmoji.cs │ ├── JsonEntitlement.cs │ ├── JsonEntity.cs │ ├── JsonForumGuildChannelDefaultReaction.cs │ ├── JsonForumTag.cs │ ├── JsonGuild.cs │ ├── JsonGuildChannelMention.cs │ ├── JsonGuildScheduledEvent.cs │ ├── JsonGuildScheduledEventMetadata.cs │ ├── JsonGuildScheduledEventRecurrenceRule.cs │ ├── JsonGuildScheduledEventRecurrenceRuleNWeekday.cs │ ├── JsonGuildThreadMetadata.cs │ ├── JsonGuildUser.cs │ ├── JsonIntegration.cs │ ├── JsonIntegrationApplication.cs │ ├── JsonInteraction.cs │ ├── JsonInteractionData.cs │ ├── JsonInteractionGuildReference.cs │ ├── JsonInteractionResolvedData.cs │ ├── JsonMenuSelectOption.cs │ ├── JsonMessage.cs │ ├── JsonMessageActivity.cs │ ├── JsonMessageCall.cs │ ├── JsonMessageInteraction.cs │ ├── JsonMessageInteractionMetadata.cs │ ├── JsonMessagePoll.cs │ ├── JsonMessagePollAnswer.cs │ ├── JsonMessagePollAnswerCount.cs │ ├── JsonMessagePollMedia.cs │ ├── JsonMessagePollResults.cs │ ├── JsonMessageReaction.cs │ ├── JsonMessageReactionCountDetails.cs │ ├── JsonMessageReference.cs │ ├── JsonMessageSnapshot.cs │ ├── JsonMessageSnapshotMessage.cs │ ├── JsonMessageSticker.cs │ ├── JsonPermissionOverwrite.cs │ ├── JsonRole.cs │ ├── JsonRoleSubscriptionData.cs │ ├── JsonRoleTags.cs │ ├── JsonSelectMenuDefaultValue.cs │ ├── JsonSelectMenuDefaultValueType.cs │ ├── JsonStageInstance.cs │ ├── JsonSticker.cs │ ├── JsonSubscription.cs │ ├── JsonTeam.cs │ ├── JsonTeamUser.cs │ ├── JsonThreadCurrentUser.cs │ ├── JsonThreadUser.cs │ ├── JsonUser.cs │ ├── JsonWebhook.cs │ ├── JsonWelcomeScreen.cs │ └── JsonWelcomeScreenChannel.cs ├── Logging │ ├── ConsoleLogger.cs │ ├── GatewayWebSocketLogger.cs │ ├── IGatewayLogger.cs │ ├── IRestLogger.cs │ ├── IVoiceLogger.cs │ ├── IWebSocketLogger.cs │ ├── LogLevel.cs │ ├── LoggerHelpers.cs │ ├── NullLogger.cs │ ├── TextWriterLogger.cs │ └── VoiceWebSocketLogger.cs ├── MembershipState.cs ├── Mention.cs ├── MentionableMenuInteraction.cs ├── MessageActivity.cs ├── MessageActivityType.cs ├── MessageCommandInteraction.cs ├── MessageCommandInteractionData.cs ├── MessageComponentInteraction.cs ├── MessageComponentInteractionData.cs ├── MessageFlags.cs ├── MessageInteraction.cs ├── MessageInteractionMetadata.cs ├── MessagePoll.cs ├── MessagePollAnswer.cs ├── MessagePollAnswerCount.cs ├── MessagePollAnswerProperties.cs ├── MessagePollLayoutType.cs ├── MessagePollMedia.cs ├── MessagePollMediaProperties.cs ├── MessagePollProperties.cs ├── MessagePollResults.cs ├── MessageReaction.cs ├── MessageReactionCountDetails.cs ├── MessageReactionEmoji.cs ├── MessageReference.cs ├── MessageReferenceType.cs ├── MessageSnapshot.cs ├── MessageSnapshotMessage.cs ├── MessageSticker.cs ├── MessageType.cs ├── MfaLevel.cs ├── ModalInteraction.cs ├── ModalInteractionData.cs ├── NetCord.csproj ├── NsfwLevel.cs ├── PartialGuildUser.cs ├── PartialGuildUserExtensions.cs ├── PermissionOverwrite.cs ├── PermissionOverwriteType.cs ├── Permissions.cs ├── PingInteraction.cs ├── PremiumType.cs ├── ReactionType.cs ├── Rest │ ├── AllowedMentionsProperties.cs │ ├── ApplicationCommand.cs │ ├── ApplicationCommandGuildPermissionProperties.cs │ ├── ApplicationCommandGuildPermissions.cs │ ├── ApplicationCommandGuildPermissionsProperties.cs │ ├── ApplicationCommandOption.cs │ ├── ApplicationCommandOptionChoice.cs │ ├── ApplicationCommandOptionChoiceProperties.cs │ ├── ApplicationCommandOptionChoiceValueType.cs │ ├── ApplicationCommandOptionProperties.cs │ ├── ApplicationCommandOptions.cs │ ├── ApplicationCommandProperties.cs │ ├── ApplicationEmojiOptions.cs │ ├── ApplicationEmojiProperties.cs │ ├── ApplicationInstallParamsProperties.cs │ ├── ApplicationIntegrationTypeConfigurationProperties.cs │ ├── ApplicationRoleConnection.cs │ ├── ApplicationRoleConnectionMetadata.cs │ ├── ApplicationRoleConnectionMetadataProperties.cs │ ├── ApplicationRoleConnectionMetadataType.cs │ ├── ApplicationRoleConnectionProperties.cs │ ├── AttachmentProperties.cs │ ├── AuthorizationInformation.cs │ ├── BulkDeleteMessagesProperties.cs │ ├── ChannelPositionProperties.cs │ ├── ComponentProperties │ │ ├── ActionRowProperties.cs │ │ ├── ButtonProperties.cs │ │ ├── ChannelMenuProperties.cs │ │ ├── ComponentContainerProperties.cs │ │ ├── ComponentMediaProperties.cs │ │ ├── ComponentSectionProperties.cs │ │ ├── ComponentSectionThumbnailProperties.cs │ │ ├── ComponentSeparatorProperties.cs │ │ ├── EntityMenuProperties.cs │ │ ├── FileDisplayProperties.cs │ │ ├── IButtonProperties.cs │ │ ├── IComponentProperties.cs │ │ ├── IComponentSectionAccessoryProperties.cs │ │ ├── ICustomizableButtonProperties.cs │ │ ├── LinkButtonProperties.cs │ │ ├── MediaGalleryProperties.cs │ │ ├── MentionableMenuProperties.cs │ │ ├── MenuProperties.cs │ │ ├── PremiumButtonProperties.cs │ │ ├── RoleMenuProperties.cs │ │ ├── StringMenuProperties.cs │ │ ├── TextDisplayProperties.cs │ │ ├── TextInputProperties.cs │ │ └── UserMenuProperties.cs │ ├── Connection.cs │ ├── ConnectionType.cs │ ├── ConnectionVisibility.cs │ ├── ContentPaginationAsyncEnumerable.cs │ ├── CurrentApplicationOptions.cs │ ├── CurrentGuildUserOptions.cs │ ├── CurrentUserOptions.cs │ ├── CurrentUserVoiceStateOptions.cs │ ├── DMChannelProperties.cs │ ├── EmbedAuthorProperties.cs │ ├── EmbedFieldProperties.cs │ ├── EmbedFooterProperties.cs │ ├── EmbedImageProperties.cs │ ├── EmbedProperties.cs │ ├── EmbedThumbnailProperties.cs │ ├── EntitlementsPaginationProperties.cs │ ├── FollowAnnouncementGuildChannelProperties.cs │ ├── FollowedChannel.cs │ ├── ForumGuildChannelDefaultReactionProperties.cs │ ├── ForumGuildThreadMessageProperties.cs │ ├── ForumGuildThreadProperties.cs │ ├── ForumTagProperties.cs │ ├── GatewayBot.cs │ ├── GatewaySessionStartLimit.cs │ ├── GoogleCloudPlatformStorageBucket.cs │ ├── GoogleCloudPlatformStorageBucketProperties.cs │ ├── GoogleCloudPlatformStorageBucketsProperties.cs │ ├── GroupDMChannelOptions.cs │ ├── GroupDMChannelProperties.cs │ ├── GroupDMUserAddProperties.cs │ ├── GuildApplicationCommand.cs │ ├── GuildApplicationCommandPermissionsProperties.cs │ ├── GuildAuditLogPaginationProperties.cs │ ├── GuildBan.cs │ ├── GuildBanProperties.cs │ ├── GuildBulkBan.cs │ ├── GuildBulkBanProperties.cs │ ├── GuildChannelOptions.cs │ ├── GuildChannelProperties.cs │ ├── GuildEmojiOptions.cs │ ├── GuildEmojiProperties.cs │ ├── GuildMfaLevelProperties.cs │ ├── GuildOnboarding.cs │ ├── GuildOnboardingMode.cs │ ├── GuildOnboardingOptions.cs │ ├── GuildOnboardingPrompt.cs │ ├── GuildOnboardingPromptOption.cs │ ├── GuildOnboardingPromptOptionProperties.cs │ ├── GuildOnboardingPromptProperties.cs │ ├── GuildOnboardingPromptType.cs │ ├── GuildOptions.cs │ ├── GuildPreview.cs │ ├── GuildProperties.cs │ ├── GuildPruneProperties.cs │ ├── GuildScheduledEventMetadataProperties.cs │ ├── GuildScheduledEventOptions.cs │ ├── GuildScheduledEventProperties.cs │ ├── GuildScheduledEventUser.cs │ ├── GuildStickerOptions.cs │ ├── GuildStickerProperties.cs │ ├── GuildTemplate.cs │ ├── GuildTemplateOptions.cs │ ├── GuildTemplatePreview.cs │ ├── GuildTemplateProperties.cs │ ├── GuildThreadFromMessageProperties.cs │ ├── GuildThreadGenerator.cs │ ├── GuildThreadProperties.cs │ ├── GuildThreadUser.cs │ ├── GuildUserInfo.cs │ ├── GuildUserJoinSourceType.cs │ ├── GuildUserOptions.cs │ ├── GuildUserProperties.cs │ ├── GuildUsersSearchPaginationProperties.cs │ ├── GuildUsersSearchTimestamp.cs │ ├── GuildVanityInvite.cs │ ├── GuildWelcomeScreenChannelProperties.cs │ ├── GuildWelcomeScreenOptions.cs │ ├── GuildWidget.cs │ ├── GuildWidgetChannel.cs │ ├── GuildWidgetSettings.cs │ ├── GuildWidgetSettingsOptions.cs │ ├── GuildsPaginationProperties.cs │ ├── HttpInteractionFactory.cs │ ├── HttpInteractionValidator.cs │ ├── IGuildUsersSearchQuery.cs │ ├── IMessageProperties.cs │ ├── IPaginationProperties.cs │ ├── IRestRequestHandler.cs │ ├── ImageProperties.cs │ ├── IncomingWebhook.cs │ ├── InteractionCallback.cs │ ├── InteractionCallbackChoicesDataProperties.cs │ ├── InteractionCallbackType.cs │ ├── InteractionMessageProperties.cs │ ├── InviteProperties.cs │ ├── JsonContent.cs │ ├── JsonModels │ │ ├── JsonApplicationCommand.cs │ │ ├── JsonApplicationCommandOption.cs │ │ ├── JsonApplicationCommandOptionChoice.cs │ │ ├── JsonApplicationEmojisResult.cs │ │ ├── JsonApplicationRoleConnection.cs │ │ ├── JsonApplicationRoleConnectionMetadata.cs │ │ ├── JsonAuditLog.cs │ │ ├── JsonAuthorizationInformation.cs │ │ ├── JsonConnection.cs │ │ ├── JsonCreateGoogleCloudPlatformStorageBucketResult.cs │ │ ├── JsonFollowedChannel.cs │ │ ├── JsonGateway.cs │ │ ├── JsonGatewayBot.cs │ │ ├── JsonGatewaySessionStartLimit.cs │ │ ├── JsonGoogleCloudPlatformStorageBucket.cs │ │ ├── JsonGuildApplicationCommandPermissions.cs │ │ ├── JsonGuildBan.cs │ │ ├── JsonGuildBulkBan.cs │ │ ├── JsonGuildMfaLevel.cs │ │ ├── JsonGuildOnboarding.cs │ │ ├── JsonGuildOnboardingPrompt.cs │ │ ├── JsonGuildOnboardingPromptOption.cs │ │ ├── JsonGuildPruneCountResult.cs │ │ ├── JsonGuildPruneResult.cs │ │ ├── JsonGuildScheduledEventUser.cs │ │ ├── JsonGuildTemplate.cs │ │ ├── JsonGuildUserInfo.cs │ │ ├── JsonGuildUserSearchResult.cs │ │ ├── JsonGuildVanityInvite.cs │ │ ├── JsonGuildWidget.cs │ │ ├── JsonGuildWidgetChannel.cs │ │ ├── JsonGuildWidgetSettings.cs │ │ ├── JsonMessagePollAnswerVotersResult.cs │ │ ├── JsonRestGuildThreadPartialResult.cs │ │ ├── JsonRestGuildThreadResult.cs │ │ ├── JsonRestInvite.cs │ │ ├── JsonSku.cs │ │ ├── JsonStickerPack.cs │ │ ├── JsonStickerPacks.cs │ │ └── JsonVoiceRegion.cs │ ├── MentionableValueProperties.cs │ ├── MentionableValueType.cs │ ├── MenuSelectOptionProperties.cs │ ├── MessageCall.cs │ ├── MessageCommandProperties.cs │ ├── MessageOptions.cs │ ├── MessageProperties.cs │ ├── MessageReactionsPaginationProperties.cs │ ├── MessageReferenceProperties.cs │ ├── ModalProperties.cs │ ├── NonceProperties.cs │ ├── OptimizedQueryPaginationAsyncEnumerable.cs │ ├── OptionalGuildUsersPaginationProperties.cs │ ├── PaginationContentBuilder.cs │ ├── PaginationDirection.cs │ ├── PaginationProperties.cs │ ├── PaginationQueryBuilder.cs │ ├── PermissionOverwriteProperties.cs │ ├── QueryPaginationAsyncEnumerable.cs │ ├── RateLimitScope.cs │ ├── RateLimits │ │ ├── BucketInfo.cs │ │ ├── GlobalRateLimiter.cs │ │ ├── IGlobalRateLimiter.cs │ │ ├── IRateLimitManager.cs │ │ ├── IRateLimiter.cs │ │ ├── IRouteRateLimiter.cs │ │ ├── ITrackingRouteRateLimiter.cs │ │ ├── NoRateLimitRouteRateLimiter.cs │ │ ├── RateLimitAcquisitionResult.cs │ │ ├── RateLimitInfo.cs │ │ ├── RateLimitManager.cs │ │ ├── RateLimitManagerConfiguration.cs │ │ ├── Route.cs │ │ ├── RouteRateLimiter.cs │ │ └── UnknownRouteRateLimiter.cs │ ├── ReactionEmojiProperties.cs │ ├── ReplyMessageProperties.cs │ ├── RestAuditLogEntry.cs │ ├── RestAuditLogEntryData.cs │ ├── RestClient.Application.cs │ ├── RestClient.ApplicationRoleConnectionMetadata.cs │ ├── RestClient.AuditLog.cs │ ├── RestClient.AutoModeration.cs │ ├── RestClient.Channel.cs │ ├── RestClient.Emoji.cs │ ├── RestClient.Gateway.cs │ ├── RestClient.Guild.cs │ ├── RestClient.GuildScheduledEvent.cs │ ├── RestClient.GuildTemplate.cs │ ├── RestClient.Interactions.ApplicationCommands.cs │ ├── RestClient.Interactions.ReceivingAndResponding.cs │ ├── RestClient.Invite.cs │ ├── RestClient.Monetization.Entitlements.cs │ ├── RestClient.Monetization.Skus.cs │ ├── RestClient.OAuth2.cs │ ├── RestClient.Poll.cs │ ├── RestClient.StageInstance.cs │ ├── RestClient.Sticker.cs │ ├── RestClient.Subscription.cs │ ├── RestClient.Undocumented.cs │ ├── RestClient.User.cs │ ├── RestClient.Voice.cs │ ├── RestClient.Webhook.cs │ ├── RestClient.cs │ ├── RestClientConfiguration.cs │ ├── RestError.cs │ ├── RestException.cs │ ├── RestGuild.cs │ ├── RestGuildInvite.cs │ ├── RestMessage.cs │ ├── RestRateLimitHandling.cs │ ├── RestRateLimitedException.cs │ ├── RestRequestHandler.cs │ ├── RestRequestProperties.cs │ ├── RoleOptions.cs │ ├── RolePositionProperties.cs │ ├── RoleProperties.cs │ ├── SafetySignalsGuildUsersSearchQuery.cs │ ├── Sku.cs │ ├── SkuFlags.cs │ ├── SkuType.cs │ ├── SlashCommandProperties.cs │ ├── StageInstanceOptions.cs │ ├── StageInstanceProperties.cs │ ├── StickerPack.cs │ ├── SubscriptionPaginationProperties.cs │ ├── SystemChannelFlags.cs │ ├── TestEntitlementOwnerType.cs │ ├── TestEntitlementProperties.cs │ ├── TextInputStyle.cs │ ├── TopLevelResourceInfo.cs │ ├── TypingReminder.cs │ ├── UserCommandProperties.cs │ ├── UserIdsGuildUsersSearchQuery.cs │ ├── UsernamesGuildUsersSearchQuery.cs │ ├── VoiceRegion.cs │ ├── VoiceStateOptions.cs │ ├── Webhook.cs │ ├── WebhookClient.cs │ ├── WebhookClientConfiguration.cs │ ├── WebhookMessageProperties.cs │ ├── WebhookOptions.cs │ ├── WebhookProperties.cs │ └── WebhookType.cs ├── Role.cs ├── RoleFlags.cs ├── RoleMenuInteraction.cs ├── RoleSubscriptionData.cs ├── Serialization.cs ├── SlashCommandInteraction.cs ├── SlashCommandInteractionData.cs ├── SlashCommandMention.cs ├── Snowflake.cs ├── SortOrderType.cs ├── StageInstance.cs ├── StageInstancePrivacyLevel.cs ├── StandardSticker.cs ├── Sticker.cs ├── StickerFormat.cs ├── StickerType.cs ├── StringMenuInteraction.cs ├── StringMenuInteractionData.cs ├── Subscription.cs ├── SubscriptionStatus.cs ├── Team.cs ├── TeamRole.cs ├── TeamUser.cs ├── ThreadArchiveDuration.cs ├── ThreadCurrentUser.cs ├── ThreadUser.cs ├── Timestamp.cs ├── TimestampStyle.cs ├── User.cs ├── UserCommandInteraction.cs ├── UserCommandInteractionData.cs ├── UserFlags.cs ├── UserMenuInteraction.cs ├── UserStatusType.cs ├── Utils │ ├── CollectionUtils.cs │ ├── SerializationUtils.cs │ └── StringUtils.cs ├── VerificationLevel.cs ├── VideoQualityMode.cs └── VoiceAttachment.cs ├── README.md ├── Resources ├── Logo │ ├── pdn │ │ ├── Big.pdn │ │ ├── BigOutline.pdn │ │ ├── Small.pdn │ │ └── SmallSquare.pdn │ ├── png │ │ ├── Big.png │ │ ├── BigOutline.png │ │ ├── Small.png │ │ └── SmallSquare.png │ └── svg │ │ ├── Big.svg │ │ ├── BigOutline.svg │ │ ├── Small.svg │ │ └── SmallSquare.svg └── NuGet │ ├── ICON.png │ └── README.md ├── SourceGenerators ├── Directory.Build.props ├── Directory.Build.targets ├── MethodsForPropertiesGenerator │ ├── MethodsForPropertiesGenerator.cs │ ├── MethodsForPropertiesGenerator.csproj │ └── PropertyData.cs ├── RestClientMethodAliasesGenerator │ ├── RestClientMethodAliasesGenerator.cs │ └── RestClientMethodAliasesGenerator.csproj ├── ShardedGatewayClientEventsGenerator │ ├── ShardedGatewayClientEventsGenerator.cs │ └── ShardedGatewayClientEventsGenerator.csproj ├── Shared │ ├── ParameterSymbolExtensions.cs │ ├── Shared.csproj │ ├── StringWriterExtensions.cs │ └── TypeSymbolExtensions.cs ├── UserAgentHeaderGenerator │ ├── UserAgentHeaderGenerator.cs │ └── UserAgentHeaderGenerator.csproj └── WebSocketClientEventsGenerator │ ├── WebSocketClientEventsGenerator.cs │ └── WebSocketClientEventsGenerator.csproj ├── Tests ├── ColorTest │ ├── ColorTest.csproj │ └── Test.cs ├── Directory.Build.props ├── Directory.Build.targets ├── MentionTest │ ├── MentionTest.csproj │ ├── Parse.cs │ └── TryFormat.cs ├── NetCord.Test.Hosting.AspNetCore │ ├── .editorconfig │ ├── EchoAutocompleteProvider.cs │ ├── InteractionHandler.cs │ ├── NetCord.Test.Hosting.AspNetCore.csproj │ ├── Program.cs │ └── Properties │ │ └── launchSettings.json ├── NetCord.Test.Hosting │ ├── .editorconfig │ ├── ApplicationCommandModule.cs │ ├── ChannelCreateUpdateDeleteHandler.cs │ ├── ConnectHandler.cs │ ├── CustomApplicationCommandResultHandler.cs │ ├── MessageReactionAddAndMessageDeleteHandler.cs │ ├── NetCord.Test.Hosting.csproj │ ├── Program.cs │ └── StringAutocompleteProvider.cs ├── NetCord.Test.Sharded.Hosting │ ├── .editorconfig │ ├── NetCord.Test.Sharded.Hosting.csproj │ └── Program.cs ├── NetCord.Test.Sharded │ ├── .editorconfig │ ├── ExampleModule.cs │ ├── ExampleModule2.cs │ ├── NetCord.Test.Sharded.csproj │ ├── PermissionsTypeReader.cs │ └── Program.cs ├── NetCord.Test │ ├── .editorconfig │ ├── AdministrativeInteractions.cs │ ├── ApplicationCommands │ │ ├── Commands.cs │ │ ├── DDGAutocomplete.cs │ │ ├── MessageCommands.cs │ │ ├── ModalCommand.cs │ │ ├── MustContainAttribute.cs │ │ ├── PercentageTypeReader.cs │ │ ├── PermissionsTypeReader.cs │ │ ├── UserCommands.cs │ │ └── VoiceCommands.cs │ ├── ButtonInteractions.cs │ ├── ChannelMenuInteractions.cs │ ├── Commands │ │ ├── Administrative │ │ │ ├── BanCommands.cs │ │ │ ├── CanManageAttribute.cs │ │ │ ├── MuteCommands.cs │ │ │ └── OtherCommands.cs │ │ ├── EvalCommand.cs │ │ ├── NormalCommands.cs │ │ └── StrangeCommands.cs │ ├── Localizations │ │ └── localization.pl.pl.pl.json │ ├── MentionableMenuInteractions.cs │ ├── MenuInteractions.cs │ ├── ModalInteractions.cs │ ├── NetCord.Test.csproj │ ├── NotEmptyAttribute.cs │ ├── Program.cs │ ├── ReverseStringTypeReader.cs │ ├── RoleMenuInteractions.cs │ ├── UserMenuInteractions.cs │ └── opus.dll ├── SnowflakeTest │ ├── SnowflakeTest.csproj │ └── Test.cs ├── TimestampTest │ ├── Test.cs │ └── TimestampTest.csproj ├── TokenTest │ ├── Test.cs │ └── TokenTest.csproj └── VoiceEncryptionTest │ ├── Test.cs │ └── VoiceEncryptionTest.csproj └── global.json /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: KubaZ2 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/enhancement.yml: -------------------------------------------------------------------------------- 1 | name: Enhancement 2 | description: Report a missing function 3 | labels: ["enhancement"] 4 | body: 5 | - type: textarea 6 | id: description 7 | attributes: 8 | label: Description 9 | description: A detailed description with possible examples and links to Discord API documentation. 10 | validations: 11 | required: true 12 | -------------------------------------------------------------------------------- /Directory.Build.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(DefineConstants);$([System.String]::Copy('$(AssemblyName)').Replace('.', '_')) 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Documentation/.gitignore: -------------------------------------------------------------------------------- 1 | ############### 2 | # folder # 3 | ############### 4 | /**/DROP/ 5 | /**/TEMP/ 6 | /**/packages/ 7 | /**/bin/ 8 | /**/obj/ 9 | _site 10 | templates 11 | -------------------------------------------------------------------------------- /Documentation/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | enable 6 | preview 7 | enable 8 | MyBot 9 | MyBot 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Documentation/Directory.Build.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Documentation/README.md: -------------------------------------------------------------------------------- 1 | # Building 2 | 3 | ## Installing dependencies 4 | ```bash 5 | npm install 6 | ``` 7 | 8 | ## Building the documentation 9 | ```bash 10 | npm run build 11 | ``` 12 | 13 | ## Building templates only 14 | ```bash 15 | npm run build-templates 16 | ``` 17 | 18 | ## Serving the documentation 19 | ```bash 20 | npm run serve 21 | ``` 22 | -------------------------------------------------------------------------------- /Documentation/build.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | import { execSync } from "child_process"; 4 | import { build as buildTemplates } from "./build-templates.js"; 5 | 6 | build(); 7 | 8 | async function build() { 9 | await buildTemplates(); 10 | execSync(`docfx ${process.argv.slice(2).join(" ")}`, { stdio: "inherit" }); 11 | } 12 | -------------------------------------------------------------------------------- /Documentation/docs/.gitignore: -------------------------------------------------------------------------------- 1 | ############### 2 | # temp file # 3 | ############### 4 | *.yml 5 | .manifest 6 | -------------------------------------------------------------------------------- /Documentation/docs/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | canonicalPath: [ "docs/" ] 3 | --- 4 | 5 | # API Documentation 6 | 7 | You can find information about all NetCord objects here. 8 | -------------------------------------------------------------------------------- /Documentation/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/favicon.ico -------------------------------------------------------------------------------- /Documentation/guides/basic-concepts/HttpInteractions/HttpInteractionHandler.cs: -------------------------------------------------------------------------------- 1 | using NetCord; 2 | using NetCord.Hosting; 3 | 4 | namespace MyBot; 5 | 6 | public class HttpInteractionHandler(ILogger logger) : IHttpInteractionHandler 7 | { 8 | public ValueTask HandleAsync(Interaction interaction) 9 | { 10 | logger.LogInformation("Received interaction: {}", interaction); 11 | return default; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Documentation/guides/basic-concepts/HttpInteractions/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "HttpInteractions": { 4 | "commandName": "Project", 5 | "launchBrowser": false, 6 | "environmentVariables": { 7 | "ASPNETCORE_ENVIRONMENT": "Development" 8 | }, 9 | "applicationUrl": "https://localhost:56793" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Documentation/guides/basic-concepts/HttpInteractions/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Discord": { 3 | "Token": "Token from Discord Developer Portal", 4 | "PublicKey": "Public Key from Discord Developer Portal" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Documentation/guides/basic-concepts/RespondingToInteractions/RespondingToInteractions.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Documentation/guides/basic-concepts/SendingMessages/SendingMessages.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Documentation/guides/basic-concepts/Sharding/Program.cs: -------------------------------------------------------------------------------- 1 | using NetCord; 2 | using NetCord.Gateway; 3 | using NetCord.Logging; 4 | 5 | ShardedGatewayClient client = new(new BotToken("Token from Discord Developer Portal"), new ShardedGatewayClientConfiguration 6 | { 7 | LoggerFactory = ShardedConsoleLogger.GetFactory(), 8 | }); 9 | 10 | await client.StartAsync(); 11 | await Task.Delay(-1); 12 | -------------------------------------------------------------------------------- /Documentation/guides/basic-concepts/Sharding/Sharding.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Documentation/guides/basic-concepts/ShardingHosting/MessageUpdateHandler.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Gateway; 2 | using NetCord.Hosting.Gateway; 3 | 4 | namespace MyBot; 5 | 6 | [GatewayEvent(nameof(GatewayClient.MessageUpdate))] 7 | public class MessageUpdateHandler : IShardedGatewayEventHandler 8 | { 9 | public async ValueTask HandleAsync(GatewayClient client, Message message) 10 | { 11 | await message.ReplyAsync("Message updated!"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Documentation/guides/basic-concepts/ShardingHosting/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Hosting; 2 | 3 | using NetCord.Hosting.Gateway; 4 | 5 | var builder = Host.CreateApplicationBuilder(args); 6 | 7 | builder.Services 8 | .AddDiscordShardedGateway(); 9 | 10 | var host = builder.Build(); 11 | 12 | await host.RunAsync(); 13 | -------------------------------------------------------------------------------- /Documentation/guides/basic-concepts/Voice/Voice.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Documentation/guides/events/FirstEvents/FirstEvents.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Documentation/guides/events/Intents/Intents.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Documentation/guides/events/Intents/Program.cs: -------------------------------------------------------------------------------- 1 | using NetCord; 2 | using NetCord.Gateway; 3 | 4 | GatewayClient client = new(new BotToken("Token from Discord Developer Portal"), new GatewayClientConfiguration() 5 | { 6 | Intents = GatewayIntents.GuildMessages | GatewayIntents.DirectMessages | GatewayIntents.MessageContent, 7 | }); 8 | -------------------------------------------------------------------------------- /Documentation/guides/events/IntentsHosting/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Hosting; 2 | 3 | using NetCord.Gateway; 4 | using NetCord.Hosting.Gateway; 5 | 6 | var builder = Host.CreateApplicationBuilder(args); 7 | 8 | builder.Services 9 | .AddDiscordGateway(options => 10 | { 11 | options.Intents = GatewayIntents.GuildMessages | GatewayIntents.DirectMessages | GatewayIntents.MessageContent; 12 | }); 13 | -------------------------------------------------------------------------------- /Documentation/guides/getting-started/Coding/Coding.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Documentation/guides/getting-started/Coding/Program.cs: -------------------------------------------------------------------------------- 1 | using NetCord; 2 | using NetCord.Gateway; 3 | using NetCord.Logging; 4 | 5 | GatewayClient client = new(new BotToken("Token from Discord Developer Portal"), new GatewayClientConfiguration 6 | { 7 | Logger = new ConsoleLogger(), 8 | }); 9 | 10 | await client.StartAsync(); 11 | await Task.Delay(-1); 12 | -------------------------------------------------------------------------------- /Documentation/guides/getting-started/CodingHosting/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Hosting; 2 | 3 | using NetCord.Hosting.Gateway; 4 | 5 | var builder = Host.CreateApplicationBuilder(args); 6 | 7 | builder.Services 8 | .AddDiscordGateway(); 9 | 10 | var host = builder.Build(); 11 | 12 | await host.RunAsync(); 13 | -------------------------------------------------------------------------------- /Documentation/guides/getting-started/CodingHosting/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Discord": { 3 | "Token": "Token from Discord Developer Portal" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Documentation/guides/services/CustomModuleBasesAndContexts/CustomContexts/CustomCommandContext.cs: -------------------------------------------------------------------------------- 1 | using NetCord; 2 | using NetCord.Gateway; 3 | using NetCord.Services.Commands; 4 | 5 | namespace MyBot; 6 | 7 | public class CustomCommandContext(Message message, GatewayClient client) : CommandContext(message, client) 8 | { 9 | public GuildUser BotGuildUser => Guild!.Users[Client.Id]; 10 | } 11 | -------------------------------------------------------------------------------- /Documentation/guides/services/CustomModuleBasesAndContexts/CustomContexts/CustomContexts.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Documentation/guides/services/CustomModuleBasesAndContexts/CustomModuleBases/CustomModuleBases.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Documentation/guides/services/DependencyInjection/DataModule.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Services.Commands; 2 | 3 | namespace MyBot; 4 | 5 | public class DataModule(ISomeService someService) : CommandModule 6 | { 7 | [Command("data")] 8 | public string Data(int count) => string.Join(' ', someService.GetSomeData().Take(count)); 9 | } 10 | -------------------------------------------------------------------------------- /Documentation/guides/services/DependencyInjection/ISomeService.cs: -------------------------------------------------------------------------------- 1 | namespace MyBot; 2 | 3 | public interface ISomeService 4 | { 5 | public IReadOnlyList GetSomeData(); 6 | } 7 | 8 | public class SomeService : ISomeService 9 | { 10 | public IReadOnlyList GetSomeData() => ["hello", "world"]; 11 | } 12 | -------------------------------------------------------------------------------- /Documentation/guides/services/Preconditions/ParameterPreconditions/HelloModule.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Services.ApplicationCommands; 2 | 3 | namespace MyBot; 4 | 5 | public class HelloModule : ApplicationCommandModule 6 | { 7 | [SlashCommand("hello", "Say hello!")] 8 | public static string Hello([MustContain("hello")] string text) => text; 9 | } 10 | -------------------------------------------------------------------------------- /Documentation/guides/services/Preconditions/Preconditions/AvatarModule.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Services.Commands; 2 | 3 | namespace MyBot; 4 | 5 | public class AvatarModule : CommandModule 6 | { 7 | [RequireAnimatedAvatar] 8 | [Command("avatar")] 9 | public string Avatar() => Context.User.GetAvatarUrl()!.ToString(); 10 | } 11 | -------------------------------------------------------------------------------- /Documentation/guides/services/Preconditions/Preconditions/ButtonModule.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Services.ComponentInteractions; 2 | 3 | namespace MyBot; 4 | 5 | [RequireAnimatedAvatar] 6 | public class ButtonModule : ComponentInteractionModule 7 | { 8 | // All interactions here will require animated avatars 9 | } 10 | -------------------------------------------------------------------------------- /Documentation/guides/services/application-commands/Introduction/Introduction.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Documentation/guides/services/application-commands/MultipleServices/MultipleServices.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Documentation/guides/services/application-commands/Parameters/Animal.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Services.ApplicationCommands; 2 | 3 | namespace MyBot; 4 | 5 | public enum Animal 6 | { 7 | Dog, 8 | Cat, 9 | Fish, 10 | [SlashCommandChoice("Guinea Pig")] 11 | GuineaPig, 12 | } 13 | -------------------------------------------------------------------------------- /Documentation/guides/services/application-commands/Parameters/Parameters.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Documentation/guides/services/application-commands/Permissions/Permissions.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Documentation/guides/services/application-commands/Subcommands/Subcommands.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Documentation/guides/services/application-commands/permissions.md: -------------------------------------------------------------------------------- 1 | # Permissions 2 | 3 | Instead of using Precondition Attributes, you can specify command required permissions to Discord. The commands will not show up to users without the permissions then. You can also specify if commands can be used in DM. Example: 4 | [!code-cs[ExampleModule.cs](Permissions/ExampleModule.cs#L9-L19)] 5 | -------------------------------------------------------------------------------- /Documentation/guides/services/application-commands/subcommands.md: -------------------------------------------------------------------------------- 1 | # Subcommands 2 | 3 | > [!NOTE] 4 | > Subcommands are only supported by slash commands. 5 | 6 | ## Example 7 | [!code-cs[GuildCommandsModule.cs](Subcommands/GuildCommandsModule.cs)] 8 | -------------------------------------------------------------------------------- /Documentation/guides/services/component-interactions/Introduction/ButtonModule.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Services.ComponentInteractions; 2 | 3 | namespace MyBot; 4 | 5 | public class ButtonModule : ComponentInteractionModule 6 | { 7 | [ComponentInteraction("button")] 8 | public static string Button() => "You clicked a button!"; 9 | } 10 | -------------------------------------------------------------------------------- /Documentation/guides/services/component-interactions/Introduction/ChannelMenuModule.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Services.ComponentInteractions; 2 | 3 | namespace MyBot; 4 | 5 | public class ChannelMenuModule : ComponentInteractionModule 6 | { 7 | [ComponentInteraction("menu")] 8 | public string Menu() => $"You selected: {string.Join(", ", Context.SelectedChannels)}"; 9 | } 10 | -------------------------------------------------------------------------------- /Documentation/guides/services/component-interactions/Introduction/Introduction.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Documentation/guides/services/component-interactions/Introduction/MentionableMenuModule.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Services.ComponentInteractions; 2 | 3 | namespace MyBot; 4 | 5 | public class MentionableMenuModule : ComponentInteractionModule 6 | { 7 | [ComponentInteraction("menu")] 8 | public string Menu() => $"You selected: {string.Join(", ", Context.SelectedMentionables)}"; 9 | } 10 | -------------------------------------------------------------------------------- /Documentation/guides/services/component-interactions/Introduction/RoleMenuModule.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Services.ComponentInteractions; 2 | 3 | namespace MyBot; 4 | 5 | public class RoleMenuModule : ComponentInteractionModule 6 | { 7 | [ComponentInteraction("menu")] 8 | public string Menu() => $"You selected: {string.Join(", ", Context.SelectedRoles)}"; 9 | } 10 | -------------------------------------------------------------------------------- /Documentation/guides/services/component-interactions/Introduction/StringMenuModule.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Services.ComponentInteractions; 2 | 3 | namespace MyBot; 4 | 5 | public class StringMenuModule : ComponentInteractionModule 6 | { 7 | [ComponentInteraction("menu")] 8 | public string Menu() => $"You selected: {string.Join(", ", Context.SelectedValues)}"; 9 | } 10 | -------------------------------------------------------------------------------- /Documentation/guides/services/component-interactions/Introduction/UserMenuModule.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Services.ComponentInteractions; 2 | 3 | namespace MyBot; 4 | 5 | public class UserMenuModule : ComponentInteractionModule 6 | { 7 | [ComponentInteraction("menu")] 8 | public string Menu() => $"You selected: {string.Join(", ", Context.SelectedUsers)}"; 9 | } 10 | -------------------------------------------------------------------------------- /Documentation/guides/services/component-interactions/Parameters/Parameters.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Documentation/guides/services/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | This section is about [NetCord.Services](https://www.nuget.org/packages/NetCord.Services) package. It allows you to create and handle commands and interactions easily. 4 | -------------------------------------------------------------------------------- /Documentation/guides/services/text-commands/Aliases/Aliases.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Documentation/guides/services/text-commands/Aliases/ExampleModule.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Services.Commands; 2 | 3 | namespace MyBot; 4 | 5 | public class ExampleModule : CommandModule 6 | { 7 | [Command("average", "mean")] 8 | public static string Average(params double[] numbers) => $"Average: {numbers.Average()}"; 9 | } 10 | -------------------------------------------------------------------------------- /Documentation/guides/services/text-commands/Introduction/ExampleModule.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Services.Commands; 2 | 3 | namespace MyBot; 4 | 5 | public class ExampleModule : CommandModule 6 | { 7 | [Command("pong")] 8 | public static string Pong() => "Ping!"; 9 | } 10 | -------------------------------------------------------------------------------- /Documentation/guides/services/text-commands/Introduction/Introduction.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Documentation/guides/services/text-commands/IntroductionHosting/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Discord": { 3 | "Prefix": "!" 4 | // You can also specify multiple prefixes using 'Prefixes' 5 | // "Prefixes": [ "!", "?" ] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Documentation/guides/services/text-commands/Parameters/Parameters.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Documentation/guides/services/text-commands/aliases.md: -------------------------------------------------------------------------------- 1 | # Aliases 2 | 3 | Each command can have multiple aliases, example: 4 | [!code-cs[ExampleModule.cs](Aliases/ExampleModule.cs#L7-L8)] 5 | -------------------------------------------------------------------------------- /Documentation/guides/services/type-readers.md: -------------------------------------------------------------------------------- 1 | # Type Readers 2 | 3 | Type Readers are responsible for parsing command and interaction arguments. Some are built-in, so you don't need to create them. To use custom Type Readers, add them to your `...ServiceConfiguration.TypeReaders` or use `...ParameterAttribute.TypeReaderType` on a specified argument. 4 | -------------------------------------------------------------------------------- /Documentation/image_sources/http-interactions_FindingPublicKeyAndSpecifyingInteractionEndpointUrl.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/image_sources/http-interactions_FindingPublicKeyAndSpecifyingInteractionEndpointUrl.pdn -------------------------------------------------------------------------------- /Documentation/image_sources/installation_JetBrainsRider_1.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/image_sources/installation_JetBrainsRider_1.pdn -------------------------------------------------------------------------------- /Documentation/image_sources/installation_JetBrainsRider_2.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/image_sources/installation_JetBrainsRider_2.pdn -------------------------------------------------------------------------------- /Documentation/image_sources/installation_VisualStudio_1.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/image_sources/installation_VisualStudio_1.pdn -------------------------------------------------------------------------------- /Documentation/image_sources/installation_VisualStudio_2.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/image_sources/installation_VisualStudio_2.pdn -------------------------------------------------------------------------------- /Documentation/image_sources/intents_Privileged.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/image_sources/intents_Privileged.pdn -------------------------------------------------------------------------------- /Documentation/image_sources/making-a-bot_AddBotToServer_1.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/image_sources/making-a-bot_AddBotToServer_1.pdn -------------------------------------------------------------------------------- /Documentation/image_sources/making-a-bot_AddBotToServer_2.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/image_sources/making-a-bot_AddBotToServer_2.pdn -------------------------------------------------------------------------------- /Documentation/image_sources/making-a-bot_BotOnline.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/image_sources/making-a-bot_BotOnline.pdn -------------------------------------------------------------------------------- /Documentation/image_sources/making-a-bot_CreateApplication_1.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/image_sources/making-a-bot_CreateApplication_1.pdn -------------------------------------------------------------------------------- /Documentation/image_sources/making-a-bot_CreateApplication_2.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/image_sources/making-a-bot_CreateApplication_2.pdn -------------------------------------------------------------------------------- /Documentation/image_sources/making-a-bot_Token_1.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/image_sources/making-a-bot_Token_1.pdn -------------------------------------------------------------------------------- /Documentation/image_sources/making-a-bot_Token_2.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/image_sources/making-a-bot_Token_2.pdn -------------------------------------------------------------------------------- /Documentation/images/BigOutline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/images/BigOutline.png -------------------------------------------------------------------------------- /Documentation/images/BigOutline.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/images/BigOutline.webp -------------------------------------------------------------------------------- /Documentation/images/SmallSquare.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/images/SmallSquare.png -------------------------------------------------------------------------------- /Documentation/images/SmallSquare.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/images/SmallSquare.webp -------------------------------------------------------------------------------- /Documentation/images/http-interactions_FindingPublicKeyAndSpecifyingInteractionEndpointUrl.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/images/http-interactions_FindingPublicKeyAndSpecifyingInteractionEndpointUrl.webp -------------------------------------------------------------------------------- /Documentation/images/installation_JetBrainsRider_1.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/images/installation_JetBrainsRider_1.webp -------------------------------------------------------------------------------- /Documentation/images/installation_JetBrainsRider_2.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/images/installation_JetBrainsRider_2.webp -------------------------------------------------------------------------------- /Documentation/images/installation_VisualStudio_1.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/images/installation_VisualStudio_1.webp -------------------------------------------------------------------------------- /Documentation/images/installation_VisualStudio_2.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/images/installation_VisualStudio_2.webp -------------------------------------------------------------------------------- /Documentation/images/intents_Privileged.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/images/intents_Privileged.webp -------------------------------------------------------------------------------- /Documentation/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/images/logo.png -------------------------------------------------------------------------------- /Documentation/images/logo.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/images/logo.webp -------------------------------------------------------------------------------- /Documentation/images/making-a-bot_AddBotToServer_1.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/images/making-a-bot_AddBotToServer_1.webp -------------------------------------------------------------------------------- /Documentation/images/making-a-bot_AddBotToServer_2.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/images/making-a-bot_AddBotToServer_2.webp -------------------------------------------------------------------------------- /Documentation/images/making-a-bot_BotOnline.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/images/making-a-bot_BotOnline.webp -------------------------------------------------------------------------------- /Documentation/images/making-a-bot_CreateApplication_1.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/images/making-a-bot_CreateApplication_1.webp -------------------------------------------------------------------------------- /Documentation/images/making-a-bot_CreateApplication_2.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/images/making-a-bot_CreateApplication_2.webp -------------------------------------------------------------------------------- /Documentation/images/making-a-bot_Token_1.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/images/making-a-bot_Token_1.webp -------------------------------------------------------------------------------- /Documentation/images/making-a-bot_Token_2.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/images/making-a-bot_Token_2.webp -------------------------------------------------------------------------------- /Documentation/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: NetCord - Modern C# Discord Bot Library for .NET Developers 3 | omitAppTitle: true 4 | _root: true 5 | canonicalPath: [ "" ] 6 | --- 7 | -------------------------------------------------------------------------------- /Documentation/robots.txt: -------------------------------------------------------------------------------- 1 | Sitemap: https://netcord.dev/sitemap.xml 2 | -------------------------------------------------------------------------------- /Documentation/templates-src/.editorconfig: -------------------------------------------------------------------------------- 1 | root = false 2 | 3 | # Settings for Docfx template files 4 | [*] 5 | charset = utf-8 6 | end_of_line = lf 7 | indent_size = 2 8 | -------------------------------------------------------------------------------- /Documentation/templates-src/.gitignore: -------------------------------------------------------------------------------- 1 | */public 2 | -------------------------------------------------------------------------------- /Documentation/templates-src/NetCord/ApiPage.html.primary.js: -------------------------------------------------------------------------------- 1 | // Licensed to the .NET Foundation under one or more agreements. 2 | // The .NET Foundation licenses this file to you under the MIT license. 3 | 4 | exports.transform = function (model) { 5 | return model; 6 | } 7 | -------------------------------------------------------------------------------- /Documentation/templates-src/NetCord/ApiPage.html.primary.tmpl: -------------------------------------------------------------------------------- 1 | {{!Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license.}} 2 | {{!master(layout/_master.tmpl)}} 3 | 4 | {{{content}}} 5 | -------------------------------------------------------------------------------- /Documentation/templates-src/NetCord/fonts/cascadia-code.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/templates-src/NetCord/fonts/cascadia-code.woff2 -------------------------------------------------------------------------------- /Documentation/templates-src/NetCord/fonts/franklin-gothic-heavy.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Documentation/templates-src/NetCord/fonts/franklin-gothic-heavy.woff2 -------------------------------------------------------------------------------- /Documentation/templates-src/NetCord/partials/collection.tmpl.partial: -------------------------------------------------------------------------------- 1 | {{!Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license.}} 2 | 3 | {{>partials/class}} 4 | -------------------------------------------------------------------------------- /Documentation/templates-src/NetCord/partials/customMREFContent.tmpl.partial: -------------------------------------------------------------------------------- 1 | {{!Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license.}} 2 | {{!Add your own custom template for the content for ManagedReference here}} 3 | {{#_splitReference}} 4 | {{#isCollection}} 5 | {{>partials/collection}} 6 | {{/isCollection}} 7 | {{#isItem}} 8 | {{>partials/item}} 9 | {{/isItem}} 10 | {{/_splitReference}} 11 | -------------------------------------------------------------------------------- /Documentation/templates-src/NetCord/partials/example.tmpl.partial: -------------------------------------------------------------------------------- 1 | var builder = Host.CreateDefaultBuilder(args) 2 | .UseDiscordGateway() 3 | .UseApplicationCommands(); 4 | 5 | var host = builder.Build() 6 | .AddSlashCommand("square", "Square!", (int a) => $"{a}² = {a * a}") 7 | .UseGatewayEventHandlers(); 8 | 9 | await host.RunAsync(); 10 | -------------------------------------------------------------------------------- /Documentation/templates-src/NetCord/partials/item.tmpl.partial: -------------------------------------------------------------------------------- 1 | {{!Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license.}} 2 | 3 | {{>partials/class.header}} 4 | -------------------------------------------------------------------------------- /Documentation/toc.yml: -------------------------------------------------------------------------------- 1 | - name: Guides 2 | href: guides/ 3 | - name: API Docs 4 | href: docs/ 5 | homepage: docs/ 6 | -------------------------------------------------------------------------------- /Documentation/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "removeComments": true, 4 | "resolveJsonModule": true, 5 | "esModuleInterop": true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Hosting/NetCord.Hosting.AspNetCore/NetCord.Hosting.AspNetCore.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Hosting/NetCord.Hosting.Services/Commands/ICommandResultHandler.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | 3 | using NetCord.Gateway; 4 | using NetCord.Services; 5 | using NetCord.Services.Commands; 6 | 7 | namespace NetCord.Hosting.Services.Commands; 8 | 9 | public interface ICommandResultHandler where TContext : ICommandContext 10 | { 11 | public ValueTask HandleResultAsync(IExecutionResult result, TContext context, GatewayClient client, ILogger logger, IServiceProvider services); 12 | } 13 | -------------------------------------------------------------------------------- /Hosting/NetCord.Hosting/Gateway/GatewayEventAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Hosting.Gateway; 2 | 3 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] 4 | public class GatewayEventAttribute(string name) : Attribute 5 | { 6 | public string Name { get; } = name; 7 | } 8 | -------------------------------------------------------------------------------- /Hosting/NetCord.Hosting/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using DAMAttribute = System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute; 2 | global using DAMT = System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes; 3 | global using MSLogLevel = Microsoft.Extensions.Logging.LogLevel; 4 | global using NCLogLevel = NetCord.Logging.LogLevel; 5 | -------------------------------------------------------------------------------- /Hosting/NetCord.Hosting/IDiscordOptions.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Hosting; 2 | 3 | public interface IDiscordOptions 4 | { 5 | /// 6 | /// The token used to authenticate with Discord. 7 | /// 8 | public string? Token { get; set; } 9 | 10 | /// 11 | /// The public key used to validate HTTP interactions. 12 | /// 13 | public string? PublicKey { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /NetCord.Services/ApplicationCommands/GuildCommands.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services.ApplicationCommands; 2 | 3 | internal record struct GuildCommands(ulong GuildId, IReadOnlyList Commands); 4 | -------------------------------------------------------------------------------- /NetCord.Services/ApplicationCommands/IApplicationCommandContext.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services.ApplicationCommands; 2 | 3 | public interface IApplicationCommandContext : IInteractionContext 4 | { 5 | public new ApplicationCommandInteraction Interaction { get; } 6 | 7 | Interaction IInteractionContext.Interaction => Interaction; 8 | } 9 | -------------------------------------------------------------------------------- /NetCord.Services/ApplicationCommands/IAutocompleteInteractionContext.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services.ApplicationCommands; 2 | 3 | public interface IAutocompleteInteractionContext : IInteractionContext 4 | { 5 | public new AutocompleteInteraction Interaction { get; } 6 | 7 | Interaction IInteractionContext.Interaction => Interaction; 8 | } 9 | -------------------------------------------------------------------------------- /NetCord.Services/ApplicationCommands/IAutocompleteProvider.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Rest; 2 | 3 | namespace NetCord.Services.ApplicationCommands; 4 | 5 | public interface IAutocompleteProvider where TAutocompleteContext : IAutocompleteInteractionContext 6 | { 7 | public ValueTask?> GetChoicesAsync(ApplicationCommandInteractionDataOption option, TAutocompleteContext context); 8 | } 9 | -------------------------------------------------------------------------------- /NetCord.Services/ApplicationCommands/IChoicesProvider.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Rest; 2 | 3 | namespace NetCord.Services.ApplicationCommands; 4 | 5 | public interface IChoicesProvider where TContext : IApplicationCommandContext 6 | { 7 | public ValueTask?> GetChoicesAsync(SlashCommandParameter parameter); 8 | } 9 | -------------------------------------------------------------------------------- /NetCord.Services/ApplicationCommands/ILocalizationsProvider.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services.ApplicationCommands; 2 | 3 | public interface ILocalizationsProvider 4 | { 5 | public ValueTask?> GetLocalizationsAsync(IReadOnlyList path, CancellationToken cancellationToken = default); 6 | } 7 | -------------------------------------------------------------------------------- /NetCord.Services/ApplicationCommands/MessageCommandAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services.ApplicationCommands; 2 | 3 | public class MessageCommandAttribute(string name) : ApplicationCommandAttribute(name) 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /NetCord.Services/ApplicationCommands/SlashCommandAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services.ApplicationCommands; 2 | 3 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)] 4 | public class SlashCommandAttribute(string name, string description) : ApplicationCommandAttribute(name) 5 | { 6 | public string Description { get; } = description; 7 | } 8 | -------------------------------------------------------------------------------- /NetCord.Services/ApplicationCommands/SlashCommandChoiceAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services.ApplicationCommands; 2 | 3 | [AttributeUsage(AttributeTargets.Field)] 4 | public class SlashCommandChoiceAttribute(string name) : Attribute 5 | { 6 | public string Name { get; } = name; 7 | } 8 | -------------------------------------------------------------------------------- /NetCord.Services/ApplicationCommands/SubSlashCommandAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services.ApplicationCommands; 2 | 3 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)] 4 | public class SubSlashCommandAttribute(string name, string description) : Attribute 5 | { 6 | public string Name { get; } = name; 7 | 8 | public string Description { get; } = description; 9 | } 10 | -------------------------------------------------------------------------------- /NetCord.Services/ApplicationCommands/TypeReaders/Channels/CategoryGuildChannelTypeReader.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services.ApplicationCommands.TypeReaders; 2 | 3 | public class CategoryGuildChannelTypeReader : ChannelTypeReader where TContext : IApplicationCommandContext 4 | { 5 | public override IEnumerable? AllowedChannelTypes 6 | { 7 | get 8 | { 9 | yield return ChannelType.CategoryChannel; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord.Services/ApplicationCommands/TypeReaders/Channels/TextChannels/GroupDMChannelTypeReader.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services.ApplicationCommands.TypeReaders; 2 | 3 | public class GroupDMChannelTypeReader : ChannelTypeReader where TContext : IApplicationCommandContext 4 | { 5 | public override IEnumerable? AllowedChannelTypes 6 | { 7 | get 8 | { 9 | yield return ChannelType.GroupDMChannel; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord.Services/ApplicationCommands/TypeReaders/Channels/VoiceChannels/Guild/StageGuildChannelTypeReader.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services.ApplicationCommands.TypeReaders; 2 | 3 | public class StageGuildChannelTypeReader : ChannelTypeReader where TContext : IApplicationCommandContext 4 | { 5 | public override IEnumerable? AllowedChannelTypes 6 | { 7 | get 8 | { 9 | yield return ChannelType.StageGuildChannel; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord.Services/ApplicationCommands/TypeReaders/Channels/VoiceChannels/Guild/VoiceGuildChannelTypeReader.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services.ApplicationCommands.TypeReaders; 2 | 3 | public class VoiceGuildChannelTypeReader : ChannelTypeReader where TContext : IApplicationCommandContext 4 | { 5 | public override IEnumerable? AllowedChannelTypes 6 | { 7 | get 8 | { 9 | yield return ChannelType.VoiceGuildChannel; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord.Services/ApplicationCommands/UserCommandAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services.ApplicationCommands; 2 | 3 | public class UserCommandAttribute(string name) : ApplicationCommandAttribute(name) 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /NetCord.Services/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly: InternalsVisibleTo("NetCord.Hosting.Services")] 4 | -------------------------------------------------------------------------------- /NetCord.Services/Commands/AllowByValueAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services.Commands; 2 | 3 | [AttributeUsage(AttributeTargets.Enum | AttributeTargets.Parameter)] 4 | public class AllowByValueAttribute : Attribute 5 | { 6 | } 7 | -------------------------------------------------------------------------------- /NetCord.Services/Commands/CommandAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services.Commands; 2 | 3 | [AttributeUsage(AttributeTargets.Method)] 4 | public class CommandAttribute(params string[] aliases) : Attribute 5 | { 6 | public string[] Aliases { get; } = aliases; 7 | public int Priority { get; init; } 8 | } 9 | -------------------------------------------------------------------------------- /NetCord.Services/Commands/CommandTypeReader.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services.Commands; 2 | 3 | public abstract class CommandTypeReader : ICommandTypeReader where TContext : ICommandContext 4 | { 5 | public abstract ValueTask ReadAsync(ReadOnlyMemory input, TContext context, CommandParameter parameter, CommandServiceConfiguration configuration, IServiceProvider? serviceProvider); 6 | } 7 | 8 | internal interface ICommandTypeReader 9 | { 10 | } 11 | -------------------------------------------------------------------------------- /NetCord.Services/Commands/ICommandContext.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Gateway; 2 | 3 | namespace NetCord.Services.Commands; 4 | 5 | public interface ICommandContext 6 | { 7 | public Message Message { get; } 8 | } 9 | -------------------------------------------------------------------------------- /NetCord.Services/Commands/TypeReaders/StringTypeReader.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services.Commands.TypeReaders; 2 | 3 | public class StringTypeReader : CommandTypeReader where TContext : ICommandContext 4 | { 5 | public override ValueTask ReadAsync(ReadOnlyMemory input, TContext context, CommandParameter parameter, CommandServiceConfiguration configuration, IServiceProvider? serviceProvider) => new(TypeReaderResult.Success(input.ToString())); 6 | } 7 | -------------------------------------------------------------------------------- /NetCord.Services/ComponentInteractions/ComponentInteractionAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services.ComponentInteractions; 2 | 3 | [AttributeUsage(AttributeTargets.Method)] 4 | public class ComponentInteractionAttribute(string customId) : Attribute 5 | { 6 | public string CustomId { get; } = customId; 7 | } 8 | -------------------------------------------------------------------------------- /NetCord.Services/ComponentInteractions/IComponentInteractionContext.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services.ComponentInteractions; 2 | 3 | public interface IComponentInteractionContext : IInteractionContext 4 | { 5 | public new ComponentInteraction Interaction { get; } 6 | 7 | Interaction IInteractionContext.Interaction => Interaction; 8 | } 9 | -------------------------------------------------------------------------------- /NetCord.Services/Contexts/IChannelContext.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services; 2 | 3 | public interface IChannelContext : IContext 4 | { 5 | public TextChannel? Channel { get; } 6 | } 7 | -------------------------------------------------------------------------------- /NetCord.Services/Contexts/IContext.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services; 2 | 3 | public interface IContext 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /NetCord.Services/Contexts/IGatewayClientContext.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Gateway; 2 | 3 | namespace NetCord.Services; 4 | 5 | public interface IGatewayClientContext : IContext 6 | { 7 | public GatewayClient Client { get; } 8 | } 9 | -------------------------------------------------------------------------------- /NetCord.Services/Contexts/IGuildContext.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Gateway; 2 | 3 | namespace NetCord.Services; 4 | 5 | public interface IGuildContext : IContext 6 | { 7 | public Guild? Guild { get; } 8 | 9 | internal protected ulong? GuildId { get; } 10 | } 11 | -------------------------------------------------------------------------------- /NetCord.Services/Contexts/IInteractionContext.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services; 2 | 3 | public interface IInteractionContext : IContext 4 | { 5 | public Interaction Interaction { get; } 6 | } 7 | -------------------------------------------------------------------------------- /NetCord.Services/Contexts/IRestClientContext.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Rest; 2 | 3 | namespace NetCord.Services; 4 | 5 | public interface IRestClientContext : IContext 6 | { 7 | public RestClient Client { get; } 8 | } 9 | -------------------------------------------------------------------------------- /NetCord.Services/Contexts/IRestMessageContext.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Rest; 2 | 3 | namespace NetCord.Services; 4 | 5 | public interface IRestMessageContext : IContext 6 | { 7 | public RestMessage Message { get; } 8 | } 9 | -------------------------------------------------------------------------------- /NetCord.Services/Contexts/IUserContext.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services; 2 | 3 | public interface IUserContext : IContext 4 | { 5 | public User User { get; } 6 | } 7 | -------------------------------------------------------------------------------- /NetCord.Services/EnumTypeReaders/IEnumTypeReader.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | 3 | namespace NetCord.Services.EnumTypeReaders; 4 | 5 | internal interface IEnumTypeReader 6 | { 7 | public bool TryRead(ReadOnlyMemory input, [MaybeNullWhen(false)] out object value); 8 | } 9 | -------------------------------------------------------------------------------- /NetCord.Services/ExecutionExceptionResult.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services; 2 | 3 | public class ExecutionExceptionResult(Exception exception) : IExceptionResult 4 | { 5 | public Exception Exception { get; } = exception; 6 | 7 | public string Message => Exception.Message; 8 | } 9 | -------------------------------------------------------------------------------- /NetCord.Services/IBaseModule.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services; 2 | 3 | #nullable disable 4 | 5 | internal interface IBaseModule 6 | { 7 | public TContext Context { get; } 8 | 9 | internal void SetContext(TContext context); 10 | } 11 | -------------------------------------------------------------------------------- /NetCord.Services/IExecutionResult.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services; 2 | 3 | public interface IExecutionResult 4 | { 5 | } 6 | 7 | public interface IFailResult : IExecutionResult 8 | { 9 | public string Message { get; } 10 | } 11 | 12 | public interface IExceptionResult : IFailResult 13 | { 14 | public Exception Exception { get; } 15 | } 16 | -------------------------------------------------------------------------------- /NetCord.Services/IResultResolverProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | 3 | namespace NetCord.Services; 4 | 5 | public interface IResultResolverProvider 6 | { 7 | public bool TryGetResolver(Type type, [MaybeNullWhen(false)] out Func resolver); 8 | } 9 | -------------------------------------------------------------------------------- /NetCord.Services/IService.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | using System.Reflection; 3 | 4 | namespace NetCord.Services; 5 | 6 | public interface IService 7 | { 8 | [RequiresUnreferencedCode("Types might be removed")] 9 | public void AddModules(Assembly assembly); 10 | } 11 | -------------------------------------------------------------------------------- /NetCord.Services/IServiceResolverProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | namespace NetCord.Services; 4 | 5 | #if NetCord_Services 6 | public 7 | #else 8 | internal 9 | #endif 10 | interface IServiceResolverProvider 11 | { 12 | public Func GetResolver(ParameterInfo parameter); 13 | } 14 | -------------------------------------------------------------------------------- /NetCord.Services/NetCord.Services.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /NetCord.Services/NotFoundResult.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services; 2 | 3 | public class NotFoundResult(string message) : IFailResult 4 | { 5 | public string Message { get; } = message; 6 | } 7 | -------------------------------------------------------------------------------- /NetCord.Services/ParameterCountMismatchType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services; 2 | 3 | public enum ParameterCountMismatchType 4 | { 5 | TooFew, 6 | TooMany, 7 | } 8 | -------------------------------------------------------------------------------- /NetCord.Services/PreconditionAttributes/PermissionsType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services; 2 | 3 | [Flags] 4 | internal enum PermissionsType : byte 5 | { 6 | Channel = 1 << 0, 7 | Guild = 1 << 1, 8 | } 9 | -------------------------------------------------------------------------------- /NetCord.Services/PreconditionAttributes/PreconditionAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services; 2 | 3 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)] 4 | public abstract class PreconditionAttribute : Attribute, IPreconditionAttribute 5 | { 6 | public abstract ValueTask EnsureCanExecuteAsync(TContext context, IServiceProvider? serviceProvider); 7 | } 8 | 9 | internal interface IPreconditionAttribute 10 | { 11 | } 12 | -------------------------------------------------------------------------------- /NetCord.Services/SuccessResult.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services; 2 | 3 | internal class SuccessResult : IExecutionResult 4 | { 5 | internal static SuccessResult Instance { get; } = new(); 6 | } 7 | -------------------------------------------------------------------------------- /NetCord.Services/TypeReaderNotFoundException.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Services; 2 | 3 | public class TypeReaderNotFoundException : Exception 4 | { 5 | public TypeReaderNotFoundException(Type type) : base($"Type name: '{type}'.") 6 | { 7 | } 8 | 9 | public TypeReaderNotFoundException(Type type, Type type2) : base($"Type name: '{type}' or '{type2}'.") 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/ApplicationEmoji.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | using NetCord.Rest; 3 | 4 | namespace NetCord; 5 | 6 | public partial class ApplicationEmoji(JsonEmoji jsonModel, ulong applicationId, RestClient client) : CustomEmoji(jsonModel, client) 7 | { 8 | public ulong ApplicationId { get; } = applicationId; 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/ApplicationIntegrationType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum ApplicationIntegrationType 4 | { 5 | /// 6 | /// App is installable to servers. 7 | /// 8 | GuildInstall = 0, 9 | 10 | /// 11 | /// App is installable to users. 12 | /// 13 | UserInstall = 1, 14 | } 15 | -------------------------------------------------------------------------------- /NetCord/AttachmentFlags.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | [Flags] 4 | public enum AttachmentFlags 5 | { 6 | /// 7 | /// This attachment is a clip. 8 | /// 9 | IsClip = 1 << 0, 10 | 11 | /// 12 | /// This attachment is a thumbnail. 13 | /// 14 | IsThumbnail = 1 << 1, 15 | 16 | /// 17 | /// This attachment has been edited using the remix feature on mobile. 18 | /// 19 | IsRemix = 1 << 2, 20 | } 21 | -------------------------------------------------------------------------------- /NetCord/AutoModerationActionMetadataProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord; 4 | 5 | public partial class AutoModerationActionMetadataProperties 6 | { 7 | [JsonPropertyName("channel_id")] 8 | public ulong? ChannelId { get; set; } 9 | 10 | [JsonPropertyName("duration_seconds")] 11 | public int? DurationSeconds { get; set; } 12 | 13 | [JsonPropertyName("custom_message")] 14 | public string? CustomMessage { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/AutoModerationActionType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum AutoModerationActionType 4 | { 5 | BlockMessage = 1, 6 | SendAlertMessage = 2, 7 | Timeout = 3, 8 | BlockUserInteraction = 4, 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/AutoModerationRuleEventType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum AutoModerationRuleEventType 4 | { 5 | MessageSend = 1, 6 | UserUpdate = 2, 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/AutoModerationRuleKeywordPresetType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum AutoModerationRuleKeywordPresetType 4 | { 5 | Profanity = 1, 6 | SexualContent = 2, 7 | Slurs = 3, 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/AutoModerationRuleTriggerType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum AutoModerationRuleTriggerType 4 | { 5 | Keyword = 1, 6 | Spam = 3, 7 | KeywordPreset = 4, 8 | MentionSpam = 5, 9 | UserProfile = 6, 10 | } 11 | -------------------------------------------------------------------------------- /NetCord/AutocompleteInteractionData.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Rest; 2 | 3 | namespace NetCord; 4 | 5 | public class AutocompleteInteractionData(JsonModels.JsonInteractionData jsonModel, ulong? guildId, RestClient client) : SlashCommandInteractionData(jsonModel, guildId, client) 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/AvatarDecorationData.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | 3 | namespace NetCord; 4 | 5 | public class AvatarDecorationData(JsonAvatarDecorationData jsonModel) : IJsonModel 6 | { 7 | JsonAvatarDecorationData IJsonModel.JsonModel => jsonModel; 8 | 9 | public string Hash => jsonModel.Hash; 10 | 11 | public ulong SkuId => jsonModel.SkuId; 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/ButtonInteraction.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Gateway; 2 | using NetCord.Rest; 3 | 4 | namespace NetCord; 5 | 6 | public class ButtonInteraction(JsonModels.JsonInteraction jsonModel, Guild? guild, Func sendResponseAsync, RestClient client) : MessageComponentInteraction(jsonModel, guild, sendResponseAsync, client) 7 | { 8 | public override ButtonInteractionData Data { get; } = new(jsonModel.Data!); 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/ButtonInteractionData.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public class ButtonInteractionData(JsonModels.JsonInteractionData jsonModel) : MessageComponentInteractionData(jsonModel) 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /NetCord/ButtonStyle.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum ButtonStyle 4 | { 5 | Primary = 1, 6 | Secondary = 2, 7 | Success = 3, 8 | Danger = 4, 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/ChannelMenuInteraction.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Gateway; 2 | using NetCord.Rest; 3 | 4 | namespace NetCord; 5 | 6 | public class ChannelMenuInteraction(JsonModels.JsonInteraction jsonModel, Guild? guild, Func sendResponseAsync, RestClient client) : EntityMenuInteraction(jsonModel, guild, sendResponseAsync, client) 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Channels/IInteractionChannel.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public interface IInteractionChannel : IEntity, ISpanFormattable 4 | { 5 | public Permissions Permissions { get; } 6 | 7 | public string ToString(); 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Channels/INamedChannel.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public interface INamedChannel : IEntity, ISpanFormattable 4 | { 5 | public string Name { get; } 6 | 7 | public string ToString(); 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Channels/IUnknownChannel.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public interface IUnknownChannel : IEntity, ISpanFormattable 4 | { 5 | public ChannelType Type { get; } 6 | } 7 | -------------------------------------------------------------------------------- /NetCord/Channels/IUnknownGuildChannel.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public partial interface IUnknownGuildChannel : IUnknownChannel, IGuildChannel 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /NetCord/Channels/TextChannels/Guild/AnnouncementGuildChannel.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Rest; 2 | 3 | namespace NetCord; 4 | 5 | public partial class AnnouncementGuildChannel(JsonModels.JsonChannel jsonModel, ulong guildId, RestClient client) : TextGuildChannel(jsonModel, guildId, client) 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/Channels/TextChannels/Guild/MediaForumGuildChannel.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | using NetCord.Rest; 3 | 4 | namespace NetCord; 5 | 6 | public partial class MediaForumGuildChannel(JsonChannel jsonModel, ulong guildId, RestClient client) : ForumGuildChannel(jsonModel, guildId, client) 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Channels/TextChannels/Guild/Threads/AnnouncementGuildThread.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Rest; 2 | 3 | namespace NetCord; 4 | 5 | public partial class AnnouncementGuildThread(JsonModels.JsonChannel jsonModel, RestClient client) : GuildThread(jsonModel, client) 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/Channels/TextChannels/Guild/Threads/ForumGuildThread.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | using NetCord.Rest; 3 | 4 | namespace NetCord; 5 | 6 | public partial class ForumGuildThread(JsonChannel jsonModel, RestClient client) : PublicGuildThread(jsonModel, client) 7 | { 8 | public RestMessage Message { get; } = new(jsonModel.Message!, client); 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Channels/TextChannels/Guild/Threads/IUnknownGuildThread.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public partial interface IUnknownGuildThread : IUnknownGuildChannel 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /NetCord/Channels/TextChannels/Guild/Threads/PrivateGuildThread.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Rest; 2 | 3 | namespace NetCord; 4 | 5 | public partial class PrivateGuildThread(JsonModels.JsonChannel jsonModel, RestClient client) : GuildThread(jsonModel, client) 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/Channels/TextChannels/Guild/Threads/PublicGuildThread.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Rest; 2 | 3 | namespace NetCord; 4 | 5 | public partial class PublicGuildThread(JsonModels.JsonChannel jsonModel, RestClient client) : GuildThread(jsonModel, client) 6 | { 7 | public IReadOnlyList? AppliedTags => _jsonModel.AppliedTags; 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Channels/TextChannels/Guild/Threads/UnknownGuildThread.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Rest; 2 | 3 | namespace NetCord; 4 | 5 | public partial class UnknownGuildThread(JsonModels.JsonChannel jsonModel, RestClient client) : GuildThread(jsonModel, client), IUnknownGuildThread 6 | { 7 | public ChannelType Type => _jsonModel.Type; 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Channels/TextChannels/IUnknownDMChannel.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public interface IUnknownDMChannel : IUnknownTextChannel 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /NetCord/Channels/TextChannels/IUnknownTextChannel.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public interface IUnknownTextChannel : IUnknownChannel 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /NetCord/Channels/TextChannels/UnknownDMChannel.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Rest; 2 | 3 | namespace NetCord; 4 | 5 | internal partial class UnknownDMChannel(JsonModels.JsonChannel jsonModel, RestClient client) : DMChannel(jsonModel, client), IUnknownDMChannel 6 | { 7 | public ChannelType Type => _jsonModel.Type; 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Channels/TextChannels/UnknownTextChannel.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | using NetCord.Rest; 3 | 4 | namespace NetCord; 5 | 6 | internal partial class UnknownTextChannel(JsonChannel jsonModel, RestClient client) : TextChannel(jsonModel, client), IUnknownTextChannel 7 | { 8 | public ChannelType Type => _jsonModel.Type; 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Channels/UnknownChannel.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | using NetCord.Rest; 3 | 4 | namespace NetCord; 5 | 6 | internal partial class UnknownChannel(JsonChannel jsonModel, RestClient client) : Channel(jsonModel, client), IUnknownChannel 7 | { 8 | public ChannelType Type => _jsonModel.Type; 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Channels/VoiceChannels/Guild/IVoiceGuildChannel.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public partial interface IVoiceGuildChannel : IGuildChannel 4 | { 5 | public bool Nsfw { get; } 6 | public int Bitrate { get; } 7 | public int UserLimit { get; } 8 | public int Slowmode { get; } 9 | public ulong? ParentId { get; } 10 | public string? RtcRegion { get; } 11 | public VideoQualityMode VideoQualityMode { get; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/ClientEntity.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Rest; 2 | 3 | namespace NetCord; 4 | 5 | public abstract class ClientEntity : Entity 6 | { 7 | private protected readonly RestClient _client; 8 | 9 | private protected ClientEntity(RestClient client) 10 | { 11 | _client = client; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /NetCord/ComponentInteractionData.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public class ComponentInteractionData : InteractionData 4 | { 5 | private protected ComponentInteractionData(JsonModels.JsonInteractionData jsonModel) : base(jsonModel) 6 | { 7 | } 8 | 9 | public string CustomId => _jsonModel.CustomId!; 10 | } 11 | -------------------------------------------------------------------------------- /NetCord/Components/ActionRow.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | 3 | namespace NetCord; 4 | 5 | public class ActionRow(JsonComponent jsonModel) : IComponent, IJsonModel 6 | { 7 | JsonComponent IJsonModel.JsonModel => jsonModel; 8 | 9 | public int Id => jsonModel.Id; 10 | 11 | public IReadOnlyList Buttons { get; } = jsonModel.Components!.Select(IButton.CreateFromJson).ToArray(); 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Components/ChannelMenu.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | 3 | namespace NetCord; 4 | 5 | public class ChannelMenu(JsonComponent jsonModel, int parentId) : EntityMenu(jsonModel, parentId) 6 | { 7 | public IReadOnlyList ChannelTypes => _jsonModel.ChannelTypes!; 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Components/ComponentMediaLoadingState.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum ComponentMediaLoadingState : byte 4 | { 5 | Unknown = 0, 6 | Loading = 1, 7 | LoadedSuccess = 2, 8 | LoadedNotFound = 3, 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Components/ComponentSeparator.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | 3 | namespace NetCord; 4 | 5 | public class ComponentSeparator(JsonComponent jsonModel) : IComponent, IJsonModel 6 | { 7 | JsonComponent IJsonModel.JsonModel => jsonModel; 8 | 9 | public int Id => jsonModel.Id; 10 | public bool Divider => jsonModel.Divider.GetValueOrDefault(); 11 | public ComponentSeparatorSpacingSize Spacing => jsonModel.Spacing.GetValueOrDefault(); 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Components/ComponentSeparatorSpacingSize.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum ComponentSeparatorSpacingSize 4 | { 5 | Small = 1, 6 | Large = 2, 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/Components/ComponentType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum ComponentType 4 | { 5 | ActionRow = 1, 6 | Button = 2, 7 | StringMenu = 3, 8 | TextInput = 4, 9 | UserMenu = 5, 10 | RoleMenu = 6, 11 | MentionableMenu = 7, 12 | ChannelMenu = 8, 13 | Section = 9, 14 | TextDisplay = 10, 15 | Thumbnail = 11, 16 | MediaGallery = 12, 17 | File = 13, 18 | Separator = 14, 19 | ContentInventoryEntry = 16, 20 | Container = 17, 21 | } 22 | -------------------------------------------------------------------------------- /NetCord/Components/EntityMenu.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | 3 | namespace NetCord; 4 | 5 | public abstract class EntityMenu(JsonComponent jsonModel, IReadOnlyList defaultValues, int parentId) : Menu(jsonModel, parentId) 6 | { 7 | public EntityMenu(JsonComponent jsonModel, int parentId) : this(jsonModel, jsonModel.DefaultValues.SelectOrEmpty(d => d.Id).ToArray(), parentId) 8 | { 9 | } 10 | 11 | public IReadOnlyList DefaultValues { get; } = defaultValues; 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Components/FileDisplay.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | 3 | namespace NetCord; 4 | 5 | public class FileDisplay(JsonComponent jsonModel) : IComponent, IJsonModel 6 | { 7 | JsonComponent IJsonModel.JsonModel => jsonModel; 8 | 9 | public int Id => jsonModel.Id; 10 | public ComponentMedia File { get; } = new(jsonModel.File!); 11 | public bool Spoiler => jsonModel.Spoiler.GetValueOrDefault(); 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Components/ICustomizableButton.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public interface ICustomizableButton : IButton 4 | { 5 | public string? Label { get; } 6 | public EmojiReference? Emoji { get; } 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/Components/MentionableMenuDefaultValue.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | 3 | namespace NetCord; 4 | 5 | public class MentionableMenuDefaultValue(JsonSelectMenuDefaultValue jsonModel) : Entity 6 | { 7 | public override ulong Id { get; } = jsonModel.Id; 8 | 9 | public MentionableMenuDefaultValueType Type { get; } = (MentionableMenuDefaultValueType)jsonModel.Type; 10 | } 11 | -------------------------------------------------------------------------------- /NetCord/Components/MentionableMenuDefaultValueType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum MentionableMenuDefaultValueType 4 | { 5 | User, 6 | Role, 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/Components/PremiumButton.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | 3 | namespace NetCord; 4 | public class PremiumButton(JsonComponent jsonModel) : IButton, IJsonModel 5 | { 6 | JsonComponent IJsonModel.JsonModel => jsonModel; 7 | 8 | public int Id => jsonModel.Id; 9 | public ulong SkuId => jsonModel.SkuId.GetValueOrDefault(); 10 | public bool Disabled => jsonModel.Disabled.GetValueOrDefault(); 11 | } 12 | -------------------------------------------------------------------------------- /NetCord/Components/RoleMenu.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | 3 | namespace NetCord; 4 | 5 | public class RoleMenu(JsonComponent jsonModel, int parentId) : EntityMenu(jsonModel, parentId) 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/Components/StringMenu.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | 3 | namespace NetCord; 4 | 5 | public class StringMenu(JsonComponent jsonModel, int parentId) : Menu(jsonModel, parentId) 6 | { 7 | public IReadOnlyList Options { get; } = jsonModel.Options.Select(o => new StringMenuSelectOption(o)).ToArray(); 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Components/TextDisplay.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | 3 | namespace NetCord; 4 | 5 | public class TextDisplay(JsonComponent jsonModel) : IComponent, IJsonModel 6 | { 7 | JsonComponent IJsonModel.JsonModel => jsonModel; 8 | 9 | public int Id => jsonModel.Id; 10 | public string Content => jsonModel.Content!; 11 | } 12 | -------------------------------------------------------------------------------- /NetCord/Components/TextInput.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | 3 | namespace NetCord; 4 | 5 | public class TextInput(JsonComponent jsonModel, int parentId) : IComponent, IJsonModel 6 | { 7 | JsonComponent IJsonModel.JsonModel => jsonModel; 8 | 9 | public int Id => jsonModel.Id; 10 | public string CustomId => jsonModel.CustomId!; 11 | public string Value => jsonModel.Value!; 12 | public int ParentId => parentId; 13 | } 14 | -------------------------------------------------------------------------------- /NetCord/Components/UserMenu.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | 3 | namespace NetCord; 4 | 5 | public class UserMenu(JsonComponent jsonModel, int parentId) : EntityMenu(jsonModel, parentId) 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/ContentFilter.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum ContentFilter 4 | { 5 | Disabled = 0, 6 | UsersWithoutRoles = 1, 7 | AllUsers = 2, 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/CurrentApplication.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Rest; 2 | 3 | namespace NetCord; 4 | 5 | public partial class CurrentApplication(JsonModels.JsonApplication jsonModel, RestClient client) : Application(jsonModel, client) 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/CurrentUser.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Rest; 2 | 3 | namespace NetCord; 4 | 5 | public partial class CurrentUser(JsonModels.JsonUser jsonModel, RestClient client) : User(jsonModel, client) 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/DefaultMessageNotificationLevel.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum DefaultMessageNotificationLevel 4 | { 5 | AllMessages = 0, 6 | OnlyMentions = 1, 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/EmojiReference.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public class EmojiReference(JsonModels.JsonEmoji jsonModel) : IJsonModel 4 | { 5 | JsonModels.JsonEmoji IJsonModel.JsonModel => jsonModel; 6 | 7 | public ulong? Id => jsonModel.Id; 8 | 9 | public string Name => jsonModel.Name!; 10 | 11 | public bool Animated => jsonModel.Animated; 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/EntityNotFoundException.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public class EntityNotFoundException : Exception 4 | { 5 | public EntityNotFoundException() : base() 6 | { 7 | } 8 | 9 | public EntityNotFoundException(string? message) : base(message) 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/ForumGuildChannelDefaultReaction.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | 3 | namespace NetCord; 4 | 5 | public class ForumGuildChannelDefaultReaction(JsonForumGuildChannelDefaultReaction jsonModel) : IJsonModel 6 | { 7 | JsonForumGuildChannelDefaultReaction IJsonModel.JsonModel => jsonModel; 8 | 9 | public ulong? EmojiId => jsonModel.EmojiId; 10 | public string? EmojiName => jsonModel.EmojiName; 11 | } 12 | -------------------------------------------------------------------------------- /NetCord/ForumLayoutType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum ForumLayoutType 4 | { 5 | NotSet = 0, 6 | ListView = 1, 7 | GalleryView = 2, 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Gateway/Compression/UncompressedGatewayCompression.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway.Compression; 2 | 3 | public sealed class UncompressedGatewayCompression : IGatewayCompression 4 | { 5 | public string Name => "uncompressed"; 6 | 7 | public ReadOnlySpan Decompress(ReadOnlySpan payload) => payload; 8 | 9 | public void Initialize() 10 | { 11 | } 12 | 13 | public void Dispose() 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /NetCord/Gateway/Compression/ZstandardException.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway.Compression; 2 | 3 | public class ZstandardException(nuint code) : Exception($"Zstandard returned an '{Zstandard.GetErrorName(code)}' error.") 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /NetCord/Gateway/EventArgs/DisconnectEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway; 2 | 3 | public class DisconnectEventArgs(bool reconnect) 4 | { 5 | /// 6 | /// Whether the client will attempt to reconnect after the disconnect. 7 | /// 8 | public bool Reconnect => reconnect; 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Gateway/EventArgs/GuildCreateEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway; 2 | 3 | public class GuildCreateEventArgs(ulong guildId, Guild? guild) 4 | { 5 | public ulong GuildId { get; } = guildId; 6 | 7 | public Guild? Guild { get; } = guild; 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Gateway/EventArgs/GuildIntegrationEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway; 2 | 3 | public class GuildIntegrationEventArgs(Integration integration, ulong guildId) 4 | { 5 | public Integration Integration { get; } = integration; 6 | 7 | public ulong GuildId { get; } = guildId; 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Gateway/EventArgs/GuildIntegrationsUpdateEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway; 2 | 3 | public class GuildIntegrationsUpdateEventArgs(JsonModels.EventArgs.JsonGuildIntegrationsUpdateEventArgs jsonModel) : IJsonModel 4 | { 5 | JsonModels.EventArgs.JsonGuildIntegrationsUpdateEventArgs IJsonModel.JsonModel => jsonModel; 6 | 7 | public ulong GuildId => jsonModel.GuildId; 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Gateway/EventArgs/GuildThreadCreateEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway; 2 | 3 | public class GuildThreadCreateEventArgs(GuildThread thread, bool newlyCreated) 4 | { 5 | public GuildThread Thread { get; } = thread; 6 | 7 | public bool NewlyCreated { get; } = newlyCreated; 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Gateway/EventArgs/GuildThreadDeleteEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway; 2 | 3 | public class GuildThreadDeleteEventArgs(ulong threadId, ulong guildId, ulong threadParentId, ChannelType threadType) 4 | { 5 | public ulong ThreadId { get; } = threadId; 6 | 7 | public ulong GuildId { get; } = guildId; 8 | 9 | public ulong ThreadParentId { get; } = threadParentId; 10 | 11 | public ChannelType ThreadType { get; } = threadType; 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Gateway/EventArgs/GuildThreadUserUpdateEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway; 2 | 3 | public class GuildThreadUserUpdateEventArgs(ThreadUser user, ulong guildId) 4 | { 5 | public ThreadUser User { get; } = user; 6 | 7 | public ulong GuildId { get; } = guildId; 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Gateway/EventArgs/RoleDeleteEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway; 2 | 3 | public class RoleDeleteEventArgs(JsonModels.EventArgs.JsonRoleDeleteEventArgs jsonModel) : IJsonModel 4 | { 5 | JsonModels.EventArgs.JsonRoleDeleteEventArgs IJsonModel.JsonModel => jsonModel; 6 | 7 | public ulong GuildId => jsonModel.GuildId; 8 | 9 | public ulong RoleId => jsonModel.RoleId; 10 | } 11 | -------------------------------------------------------------------------------- /NetCord/Gateway/EventArgs/UnknownEventEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json; 2 | 3 | namespace NetCord.Gateway; 4 | 5 | public class UnknownEventEventArgs(string name, JsonElement data) 6 | { 7 | /// 8 | /// Event name. 9 | /// 10 | public string Name { get; } = name; 11 | 12 | /// 13 | /// Event data. 14 | /// 15 | public JsonElement Data { get; } = data; 16 | } 17 | -------------------------------------------------------------------------------- /NetCord/Gateway/IRateLimiter.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway; 2 | 3 | public interface IRateLimiter : IDisposable 4 | { 5 | public ValueTask TryAcquireAsync(CancellationToken cancellationToken = default); 6 | 7 | public ValueTask CancelAcquireAsync(long acquisitionTimestamp, CancellationToken cancellationToken = default); 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Gateway/IRateLimiterProvider.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway; 2 | 3 | public interface IRateLimiterProvider 4 | { 5 | public IRateLimiter CreateRateLimiter(); 6 | } 7 | -------------------------------------------------------------------------------- /NetCord/Gateway/IRestClientOwnerConfiguration.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Logging; 2 | using NetCord.Rest; 3 | 4 | namespace NetCord.Gateway; 5 | 6 | internal interface IRestClientOwnerConfiguration 7 | { 8 | public RestClientConfiguration? RestClientConfiguration { get; } 9 | 10 | public IRestLogger? Logger { get; } 11 | } 12 | -------------------------------------------------------------------------------- /NetCord/Gateway/JsonModels/EventArgs/JsonGuildBanEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | using NetCord.JsonModels; 4 | 5 | namespace NetCord.Gateway.JsonModels.EventArgs; 6 | 7 | public class JsonGuildBanEventArgs 8 | { 9 | [JsonPropertyName("guild_id")] 10 | public ulong GuildId { get; set; } 11 | 12 | [JsonPropertyName("user")] 13 | public JsonUser User { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /NetCord/Gateway/JsonModels/EventArgs/JsonGuildEmojisUpdateEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Immutable; 2 | using System.Text.Json.Serialization; 3 | 4 | using NetCord.JsonModels; 5 | 6 | namespace NetCord.Gateway.JsonModels.EventArgs; 7 | 8 | public class JsonGuildEmojisUpdateEventArgs 9 | { 10 | [JsonPropertyName("guild_id")] 11 | public ulong GuildId { get; set; } 12 | 13 | [JsonPropertyName("emojis")] 14 | public ImmutableArray Emojis { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/Gateway/JsonModels/EventArgs/JsonGuildIntegrationsUpdateEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Gateway.JsonModels.EventArgs; 4 | 5 | public class JsonGuildIntegrationsUpdateEventArgs 6 | { 7 | [JsonPropertyName("guild_id")] 8 | public ulong GuildId { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Gateway/JsonModels/EventArgs/JsonGuildJoinRequestDeleteEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Gateway.JsonModels.EventArgs; 4 | 5 | public class JsonGuildJoinRequestDeleteEventArgs 6 | { 7 | [JsonPropertyName("id")] 8 | public ulong JoinRequestId { get; set; } 9 | 10 | [JsonPropertyName("user_id")] 11 | public ulong UserId { get; set; } 12 | 13 | [JsonPropertyName("guild_id")] 14 | public ulong GuildId { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/Gateway/JsonModels/EventArgs/JsonGuildStickersUpdateEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Immutable; 2 | using System.Text.Json.Serialization; 3 | 4 | using NetCord.JsonModels; 5 | 6 | namespace NetCord.Gateway.JsonModels.EventArgs; 7 | 8 | public class JsonGuildStickersUpdateEventArgs 9 | { 10 | [JsonPropertyName("guild_id")] 11 | public ulong GuildId { get; set; } 12 | 13 | [JsonPropertyName("stickers")] 14 | public ImmutableArray Stickers { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/Gateway/JsonModels/EventArgs/JsonGuildUserRemoveEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | using NetCord.JsonModels; 4 | 5 | namespace NetCord.Gateway.JsonModels.EventArgs; 6 | 7 | public class JsonGuildUserRemoveEventArgs 8 | { 9 | [JsonPropertyName("guild_id")] 10 | public ulong GuildId { get; set; } 11 | 12 | [JsonPropertyName("user")] 13 | public JsonUser User { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /NetCord/Gateway/JsonModels/EventArgs/JsonInviteDeleteEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Gateway.JsonModels.EventArgs; 4 | 5 | public class JsonInviteDeleteEventArgs 6 | { 7 | [JsonPropertyName("channel_id")] 8 | public ulong InviteChannelId { get; set; } 9 | 10 | [JsonPropertyName("guild_id")] 11 | public ulong? GuildId { get; set; } 12 | 13 | [JsonPropertyName("code")] 14 | public string InviteCode { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/Gateway/JsonModels/EventArgs/JsonMessageDeleteBulkEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Gateway.JsonModels.EventArgs; 4 | 5 | public class JsonMessageDeleteBulkEventArgs 6 | { 7 | [JsonPropertyName("ids")] 8 | public ulong[] MessageIds { get; set; } 9 | 10 | [JsonPropertyName("channel_id")] 11 | public ulong ChannelId { get; set; } 12 | 13 | [JsonPropertyName("guild_id")] 14 | public ulong? GuildId { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/Gateway/JsonModels/EventArgs/JsonMessageDeleteEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Gateway.JsonModels.EventArgs; 4 | 5 | public class JsonMessageDeleteEventArgs 6 | { 7 | [JsonPropertyName("id")] 8 | public ulong MessageId { get; set; } 9 | 10 | [JsonPropertyName("channel_id")] 11 | public ulong ChannelId { get; set; } 12 | 13 | [JsonPropertyName("guild_id")] 14 | public ulong? GuildId { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/Gateway/JsonModels/EventArgs/JsonRoleDeleteEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Gateway.JsonModels.EventArgs; 4 | 5 | public class JsonRoleDeleteEventArgs 6 | { 7 | [JsonPropertyName("guild_id")] 8 | public ulong GuildId { get; set; } 9 | 10 | [JsonPropertyName("role_id")] 11 | public ulong RoleId { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Gateway/JsonModels/EventArgs/JsonRoleEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | using NetCord.JsonModels; 4 | 5 | namespace NetCord.Gateway.JsonModels.EventArgs; 6 | 7 | internal class JsonRoleEventArgs 8 | { 9 | [JsonPropertyName("guild_id")] 10 | public ulong GuildId { get; set; } 11 | 12 | [JsonPropertyName("role")] 13 | public JsonRole Role { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /NetCord/Gateway/JsonModels/EventArgs/JsonVoiceServerUpdateEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Gateway.JsonModels.EventArgs; 4 | 5 | public class JsonVoiceServerUpdateEventArgs 6 | { 7 | [JsonPropertyName("token")] 8 | public string Token { get; set; } 9 | 10 | [JsonPropertyName("guild_id")] 11 | public ulong GuildId { get; set; } 12 | 13 | [JsonPropertyName("endpoint")] 14 | public string? Endpoint { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/Gateway/JsonModels/EventArgs/JsonWebhooksUpdateEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Gateway.JsonModels.EventArgs; 4 | 5 | public class JsonWebhooksUpdateEventArgs 6 | { 7 | [JsonPropertyName("guild_id")] 8 | public ulong GuildId { get; set; } 9 | 10 | [JsonPropertyName("channel_id")] 11 | public ulong ChannelId { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Gateway/JsonModels/JsonGatewayClientCache.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | using NetCord.JsonModels; 4 | 5 | namespace NetCord.Gateway.JsonModels; 6 | 7 | public class JsonGatewayClientCache 8 | { 9 | [JsonPropertyName("user")] 10 | public JsonUser? User { get; set; } 11 | 12 | [JsonPropertyName("guilds")] 13 | public IReadOnlyList Guilds { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /NetCord/Gateway/JsonModels/JsonHello.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Gateway.JsonModels; 4 | 5 | internal class JsonHello 6 | { 7 | [JsonPropertyName("heartbeat_interval")] 8 | public double HeartbeatInterval { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Gateway/JsonModels/JsonParty.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Gateway.JsonModels; 4 | 5 | public class JsonParty 6 | { 7 | [JsonPropertyName("id")] 8 | public string? Id { get; set; } 9 | 10 | [JsonPropertyName("size")] 11 | public int[]? Size { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Gateway/JsonModels/JsonUserActivitySecrets.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Gateway.JsonModels; 4 | 5 | public class JsonUserActivitySecrets 6 | { 7 | [JsonPropertyName("join")] 8 | public string? Join { get; set; } 9 | 10 | [JsonPropertyName("spectate")] 11 | public string? Spectate { get; set; } 12 | 13 | [JsonPropertyName("match")] 14 | public string? Match { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/Gateway/LatencyTimers/ILatencyTimer.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway.LatencyTimers; 2 | 3 | public interface ILatencyTimer 4 | { 5 | public TimeSpan Elapsed { get; } 6 | 7 | public void Start(); 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Gateway/LatencyTimers/LatencyTimer.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace NetCord.Gateway.LatencyTimers; 4 | 5 | public class LatencyTimer : ILatencyTimer 6 | { 7 | private readonly Stopwatch _stopwatch = new(); 8 | 9 | public TimeSpan Elapsed => _stopwatch.Elapsed; 10 | 11 | public void Start() 12 | { 13 | _stopwatch.Restart(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/Gateway/PartyProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Gateway; 4 | 5 | public partial class PartyProperties 6 | { 7 | [JsonPropertyName("id")] 8 | public string? Id { get; set; } 9 | 10 | [JsonPropertyName("size")] 11 | public PartySizeProperties? Size { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Gateway/Platform.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Gateway; 4 | 5 | [JsonConverter(typeof(JsonConverters.SafeStringEnumConverter))] 6 | public enum Platform : sbyte 7 | { 8 | [JsonPropertyName("desktop")] 9 | Desktop, 10 | 11 | [JsonPropertyName("mobile")] 12 | Mobile, 13 | 14 | [JsonPropertyName("web")] 15 | Web, 16 | } 17 | -------------------------------------------------------------------------------- /NetCord/Gateway/ReconnectStrategies/IReconnectStrategy.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway.ReconnectStrategies; 2 | 3 | public interface IReconnectStrategy 4 | { 5 | public IEnumerable GetDelays(); 6 | } 7 | -------------------------------------------------------------------------------- /NetCord/Gateway/UserActivityButton.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway; 2 | 3 | public class UserActivityButton 4 | { 5 | public string Label { get; } 6 | 7 | internal UserActivityButton(string label) 8 | { 9 | Label = label; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /NetCord/Gateway/UserActivityButtonProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Gateway; 4 | 5 | public partial class UserActivityButtonProperties(string label, string url) 6 | { 7 | [JsonPropertyName("label")] 8 | public string Label { get; set; } = label; 9 | 10 | [JsonPropertyName("url")] 11 | public string Url { get; set; } = url; 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Gateway/UserActivityFlags.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway; 2 | 3 | [Flags] 4 | public enum UserActivityFlags 5 | { 6 | Instance = 1 << 0, 7 | Join = 1 << 1, 8 | Spectate = 1 << 2, 9 | JoinRequest = 1 << 3, 10 | Sync = 1 << 4, 11 | Play = 1 << 5, 12 | PartyPrivacyFriends = 1 << 6, 13 | PartyPrivacyVoiceChannel = 1 << 7, 14 | Embedded = 1 << 8, 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/Gateway/UserActivitySecrets.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway; 2 | 3 | public class UserActivitySecrets(JsonModels.JsonUserActivitySecrets jsonModel) : IJsonModel 4 | { 5 | JsonModels.JsonUserActivitySecrets IJsonModel.JsonModel => jsonModel; 6 | 7 | public string? Join => jsonModel.Join; 8 | public string? Spectate => jsonModel.Spectate; 9 | public string? Match => jsonModel.Match; 10 | } 11 | -------------------------------------------------------------------------------- /NetCord/Gateway/UserActivitySecretsProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Gateway; 4 | 5 | public partial class UserActivitySecretsProperties 6 | { 7 | [JsonPropertyName("join")] 8 | public string? Join { get; set; } 9 | 10 | [JsonPropertyName("spectate")] 11 | public string? Spectate { get; set; } 12 | 13 | [JsonPropertyName("match")] 14 | public string? Match { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/Gateway/UserActivityTimestamps.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway; 2 | 3 | public class UserActivityTimestamps(JsonModels.JsonUserActivityTimestamps jsonModel) : IJsonModel 4 | { 5 | JsonModels.JsonUserActivityTimestamps IJsonModel.JsonModel => jsonModel; 6 | 7 | public DateTimeOffset? StartTime => jsonModel.StartTime; 8 | public DateTimeOffset? EndTime => jsonModel.EndTime; 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Gateway/UserActivityTimestampsProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Gateway; 4 | 5 | public partial class UserActivityTimestampsProperties 6 | { 7 | [JsonPropertyName("start")] 8 | public int? Start { get; set; } 9 | 10 | [JsonPropertyName("end")] 11 | public int? End { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Gateway/UserActivityType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway; 2 | 3 | public enum UserActivityType 4 | { 5 | Playing = 0, 6 | Streaming = 1, 7 | Listening = 2, 8 | Watching = 3, 9 | Custom = 4, 10 | Competing = 5, 11 | } 12 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/Channels.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway.Voice; 2 | 3 | /// 4 | /// Number of channels. 5 | /// 6 | public enum VoiceChannels : byte 7 | { 8 | /// 9 | /// One channel. 10 | /// 11 | Mono = 1, 12 | 13 | /// 14 | /// Two channels. 15 | /// 16 | Stereo = 2, 17 | } 18 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/Encryption/LibsodiumException.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway.Voice.Encryption; 2 | 3 | public class LibsodiumException : Exception 4 | { 5 | public LibsodiumException() : base("Libsodium returned an error.") 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/EventArgs/SpeakingEventArgs.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Gateway.Voice.JsonModels; 2 | 3 | namespace NetCord.Gateway.Voice; 4 | 5 | public class SpeakingEventArgs(JsonSpeaking jsonModel) : IJsonModel 6 | { 7 | JsonSpeaking IJsonModel.JsonModel => jsonModel; 8 | 9 | public ulong UserId => jsonModel.UserId; 10 | 11 | public uint Ssrc => jsonModel.Ssrc; 12 | 13 | public SpeakingFlags Speaking => jsonModel.Speaking; 14 | } 15 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/EventArgs/UserConnectEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway.Voice; 2 | 3 | public class UserConnectEventArgs(IReadOnlyList userIds) 4 | { 5 | /// 6 | /// The IDs of the users that connected. 7 | /// 8 | public IReadOnlyList UserIds => userIds; 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/EventArgs/UserDisconnectEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway.Voice; 2 | 3 | public class UserDisconnectEventArgs(ulong userId) 4 | { 5 | /// 6 | /// The ID of the user that disconnected. 7 | /// 8 | public ulong UserId => userId; 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/EventArgs/VoicePacketHandlingResult.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway.Voice; 2 | 3 | public readonly struct VoicePacketHandlingResult(ushort framesMissed, bool handle) 4 | { 5 | public ushort FramesMissed => framesMissed; 6 | 7 | public bool Handle => handle; 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/EventArgs/VoiceReceiveEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway.Voice; 2 | 3 | public readonly ref struct VoiceReceiveEventArgs(byte[]? buffer, int frameIndex, int frameLength, uint ssrc) 4 | { 5 | internal readonly byte[]? _buffer = buffer; 6 | 7 | public ReadOnlySpan Frame => new(_buffer, frameIndex, frameLength); 8 | 9 | public uint Ssrc => ssrc; 10 | } 11 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/IVoiceReceiveHandler.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway.Voice; 2 | 3 | public interface IVoiceReceiveHandler 4 | { 5 | public bool RequiresExternalSocketAddress { get; } 6 | 7 | public VoicePacketHandlingResult HandlePacket(VoiceClient client, RtpPacket packet); 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/JsonModels/JsonClientConnect.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Gateway.Voice.JsonModels; 4 | 5 | internal class JsonClientConnect 6 | { 7 | [JsonPropertyName("user_ids")] 8 | public ulong[] UserIds { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/JsonModels/JsonClientDisconnect.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Gateway.Voice.JsonModels; 4 | 5 | internal class JsonClientDisconnect 6 | { 7 | [JsonPropertyName("user_id")] 8 | public ulong UserId { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/JsonModels/JsonReady.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Gateway.Voice.JsonModels; 4 | 5 | internal class JsonReady 6 | { 7 | [JsonPropertyName("ssrc")] 8 | public uint Ssrc { get; set; } 9 | 10 | [JsonPropertyName("ip")] 11 | public string Ip { get; set; } 12 | 13 | [JsonPropertyName("port")] 14 | public ushort Port { get; set; } 15 | 16 | [JsonPropertyName("modes")] 17 | public string[] Modes { get; set; } 18 | } 19 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/JsonModels/JsonSpeaking.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Gateway.Voice.JsonModels; 4 | 5 | public class JsonSpeaking 6 | { 7 | [JsonPropertyName("user_id")] 8 | public ulong UserId { get; set; } 9 | 10 | [JsonPropertyName("ssrc")] 11 | public uint Ssrc { get; set; } 12 | 13 | [JsonPropertyName("speaking")] 14 | public SpeakingFlags Speaking { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/JsonModels/JsonVoicePayload.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace NetCord.Gateway.Voice.JsonModels; 5 | 6 | internal class JsonVoicePayload 7 | { 8 | [JsonPropertyName("op")] 9 | public VoiceOpcode Opcode { get; set; } 10 | 11 | [JsonPropertyName("d")] 12 | public JsonElement? Data { get; set; } 13 | 14 | [JsonPropertyName("seq")] 15 | public int? SequenceNumber { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/OpusDecoderHandle.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace NetCord.Gateway.Voice; 4 | 5 | internal class OpusDecoderHandle() : SafeHandle(0, true) 6 | { 7 | public override bool IsInvalid => handle is 0; 8 | 9 | protected override bool ReleaseHandle() 10 | { 11 | Opus.OpusDecoderDestroy(handle); 12 | return true; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/OpusEncoderHandle.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace NetCord.Gateway.Voice; 4 | 5 | internal class OpusEncoderHandle() : SafeHandle(0, true) 6 | { 7 | public override bool IsInvalid => handle is 0; 8 | 9 | protected override bool ReleaseHandle() 10 | { 11 | Opus.OpusEncoderDestroy(handle); 12 | return true; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/OpusException.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway.Voice; 2 | 3 | public class OpusException(OpusError error) : Exception($"Opus returned an '{error}' error.") 4 | { 5 | public OpusError OpusError { get; } = error; 6 | } 7 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/PcmFormat.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway.Voice; 2 | 3 | /// 4 | /// Format of PCM. 5 | /// 6 | public enum PcmFormat : byte 7 | { 8 | /// 9 | /// 16-bit signed integer format. 10 | /// 11 | Short = sizeof(short), 12 | 13 | /// 14 | /// 32-bit floating-point format. 15 | /// 16 | Float = sizeof(float), 17 | } 18 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/ProtocolDataProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Gateway.Voice; 4 | 5 | internal class ProtocolDataProperties(string address, ushort port, string mode) 6 | { 7 | [JsonPropertyName("address")] 8 | public string Address { get; set; } = address; 9 | 10 | [JsonPropertyName("port")] 11 | public ushort Port { get; set; } = port; 12 | 13 | [JsonPropertyName("mode")] 14 | public string Mode { get; set; } = mode; 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/ProtocolProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Gateway.Voice; 4 | 5 | internal class ProtocolProperties(string protocol, ProtocolDataProperties data) 6 | { 7 | [JsonPropertyName("protocol")] 8 | public string Protocol { get; set; } = protocol; 9 | 10 | [JsonPropertyName("data")] 11 | public ProtocolDataProperties Data { get; set; } = data; 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/RtpPacketStorage.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway.Voice; 2 | 3 | internal readonly struct RtpPacketStorage(ReadOnlyMemory datagram, bool encryptedExtension) 4 | { 5 | public readonly RtpPacket Packet => new(datagram.Span, encryptedExtension); 6 | } 7 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/SpeakingProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Gateway.Voice; 4 | 5 | public partial class SpeakingProperties(SpeakingFlags speaking) 6 | { 7 | [JsonPropertyName("speaking")] 8 | public SpeakingFlags Speaking { get; set; } = speaking; 9 | 10 | [JsonPropertyName("delay")] 11 | public int Delay { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/UdpSockets/IUdpConnectionProvider.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway.Voice.UdpSockets; 2 | 3 | public interface IUdpConnectionProvider 4 | { 5 | public IUdpConnection CreateConnection(string ip, ushort port); 6 | } 7 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/VoiceApiVersion.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway.Voice; 2 | 3 | public enum VoiceApiVersion 4 | { 5 | [Obsolete("Deprecated")] 6 | V1 = 1, 7 | [Obsolete("Deprecated")] 8 | V2 = 2, 9 | [Obsolete("Deprecated")] 10 | V3 = 3, 11 | V4 = 4, 12 | V5 = 5, 13 | V6 = 6, 14 | V7 = 7, 15 | V8 = 8, 16 | } 17 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/VoiceHeartbeatProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Gateway.Voice; 4 | 5 | internal class VoiceHeartbeatProperties(int timestamp, int sequenceNumber) 6 | { 7 | [JsonPropertyName("t")] 8 | public int Timestamp { get; set; } = timestamp; 9 | 10 | [JsonPropertyName("seq_ack")] 11 | public int SequenceNumber { get; set; } = sequenceNumber; 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Gateway/Voice/VoiceOpcode.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway.Voice; 2 | 3 | internal enum VoiceOpcode : byte 4 | { 5 | Identify = 0, 6 | SelectProtocol = 1, 7 | Ready = 2, 8 | Heartbeat = 3, 9 | SessionDescription = 4, 10 | Speaking = 5, 11 | HeartbeatACK = 6, 12 | Resume = 7, 13 | Hello = 8, 14 | Resumed = 9, 15 | ClientConnect = 11, 16 | ClientDisconnect = 13, 17 | } 18 | -------------------------------------------------------------------------------- /NetCord/Gateway/WebSocketRateLimitedException.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace NetCord.Gateway; 3 | 4 | public class WebSocketRateLimitedException(int resetAfter) : Exception($"Rate limit exceeded. Reset after {resetAfter} ms.") 5 | { 6 | /// 7 | /// The time in milliseconds after which a payload can be sent again. 8 | /// 9 | public int ResetAfter => resetAfter; 10 | } 11 | -------------------------------------------------------------------------------- /NetCord/Gateway/WebSocketRetryHandling.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway; 2 | 3 | [Flags] 4 | public enum WebSocketRetryHandling : byte 5 | { 6 | NoRetry = 0, 7 | RetryRateLimit = 1 << 0, 8 | RetryReconnect = 1 << 1, 9 | Retry = RetryRateLimit | RetryReconnect, 10 | } 11 | -------------------------------------------------------------------------------- /NetCord/Gateway/WebSockets/IWebSocketConnectionProvider.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway.WebSockets; 2 | 3 | public interface IWebSocketConnectionProvider 4 | { 5 | public IWebSocketConnection CreateConnection(); 6 | } 7 | -------------------------------------------------------------------------------- /NetCord/Gateway/WebSockets/WebSocketConnectionProvider.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway.WebSockets; 2 | 3 | public class WebSocketConnectionProvider : IWebSocketConnectionProvider 4 | { 5 | public static WebSocketConnectionProvider Instance { get; } = new(); 6 | 7 | private WebSocketConnectionProvider() 8 | { 9 | } 10 | 11 | public IWebSocketConnection CreateConnection() 12 | { 13 | return new WebSocketConnection(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/Gateway/WebSockets/WebSocketMessageFlags.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway.WebSockets; 2 | 3 | [Flags] 4 | public enum WebSocketMessageFlags : byte 5 | { 6 | None = 0, 7 | EndOfMessage = 1 << 0, 8 | DisableCompression = 1 << 1, 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Gateway/WebSockets/WebSocketMessageType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Gateway.WebSockets; 2 | 3 | public enum WebSocketMessageType : byte 4 | { 5 | Text = 0, 6 | Binary = 1, 7 | Close = 2, 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/GuildChannelMention.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public class GuildChannelMention(JsonModels.JsonGuildChannelMention jsonModel) : Entity 4 | { 5 | public override ulong Id => jsonModel.Id; 6 | public ulong GuildId => jsonModel.GuildId; 7 | public ChannelType Type => jsonModel.Type; 8 | public string Name => jsonModel.Name; 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/GuildEmoji.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | using NetCord.Rest; 3 | 4 | namespace NetCord; 5 | 6 | public partial class GuildEmoji(JsonEmoji jsonModel, ulong guildId, RestClient client) : CustomEmoji(jsonModel, client) 7 | { 8 | public IReadOnlyList? AllowedRoles => _jsonModel.AllowedRoles; 9 | 10 | public ulong GuildId { get; } = guildId; 11 | } 12 | -------------------------------------------------------------------------------- /NetCord/GuildFromGuildTemplateProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest; 4 | 5 | public partial class GuildFromGuildTemplateProperties(string name) 6 | { 7 | [JsonPropertyName("name")] 8 | public string Name { get; set; } = name; 9 | 10 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 11 | [JsonPropertyName("icon")] 12 | public ImageProperties? Icon { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /NetCord/GuildInteractionUser.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | using NetCord.Rest; 3 | 4 | namespace NetCord; 5 | 6 | public class GuildInteractionUser(JsonGuildUser jsonModel, ulong guildId, RestClient client) : GuildUser(jsonModel, guildId, client) 7 | { 8 | public Permissions Permissions => _jsonModel.Permissions.GetValueOrDefault(); 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/GuildNavigationType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum GuildNavigationType : byte 4 | { 5 | Customize, 6 | Browse, 7 | Guide, 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/GuildScheduledEventEntityType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum GuildScheduledEventEntityType 4 | { 5 | StageInstance = 1, 6 | Voice = 2, 7 | External = 3, 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/GuildScheduledEventPrivacyLevel.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum GuildScheduledEventPrivacyLevel 4 | { 5 | GuildOnly = 2, 6 | } 7 | -------------------------------------------------------------------------------- /NetCord/GuildScheduledEventRecurrenceRuleFrequency.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum GuildScheduledEventRecurrenceRuleFrequency : byte 4 | { 5 | Yearly = 0, 6 | Monthly = 1, 7 | Weekly = 2, 8 | Daily = 3, 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/GuildScheduledEventRecurrenceRuleMonth.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum GuildScheduledEventRecurrenceRuleMonth 4 | { 5 | January = 1, 6 | February = 2, 7 | March = 3, 8 | April = 4, 9 | May = 5, 10 | June = 6, 11 | July = 7, 12 | August = 8, 13 | September = 9, 14 | October = 10, 15 | November = 11, 16 | December = 12, 17 | } 18 | -------------------------------------------------------------------------------- /NetCord/GuildScheduledEventRecurrenceRuleWeekday.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum GuildScheduledEventRecurrenceRuleWeekday : byte 4 | { 5 | Monday = 0, 6 | Tuesday = 1, 7 | Wednesday = 2, 8 | Thursday = 3, 9 | Friday = 4, 10 | Saturday = 5, 11 | Sunday = 6, 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/GuildScheduledEventStatus.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum GuildScheduledEventStatus 4 | { 5 | Scheduled = 1, 6 | Active = 2, 7 | Completed = 3, 8 | Canceled = 4, 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/IEntity.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public interface IEntity 4 | { 5 | /// 6 | /// The unique identifier for this object. 7 | /// 8 | public ulong Id { get; } 9 | 10 | /// 11 | /// The time this object was created. 12 | /// 13 | public DateTimeOffset CreatedAt { get; } 14 | } 15 | -------------------------------------------------------------------------------- /NetCord/IHttpSerializable.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public interface IHttpSerializable 4 | { 5 | /// 6 | /// Serializes the object or its part into . 7 | /// 8 | public HttpContent Serialize(); 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/IJsonModel.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public interface IJsonModel 4 | { 5 | T JsonModel { get; } 6 | } 7 | -------------------------------------------------------------------------------- /NetCord/ImageAttachment.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public class ImageAttachment(JsonModels.JsonAttachment jsonModel) : Attachment(jsonModel) 4 | { 5 | /// 6 | /// Height of file. 7 | /// 8 | public int Height => _jsonModel.Height.GetValueOrDefault(); 9 | 10 | /// 11 | /// Width of file. 12 | /// 13 | public int Width => _jsonModel.Width.GetValueOrDefault(); 14 | } 15 | -------------------------------------------------------------------------------- /NetCord/ImageFormat.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum ImageFormat : byte 4 | { 5 | Jpeg, 6 | Png, 7 | WebP, 8 | Gif, 9 | Lottie, 10 | } 11 | -------------------------------------------------------------------------------- /NetCord/IntegrationExpireBehavior.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum IntegrationExpireBehavior 4 | { 5 | RemoveRole = 0, 6 | Kick = 1, 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/IntegrationType.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord; 4 | 5 | [JsonConverter(typeof(JsonConverters.SafeStringEnumConverter))] 6 | public enum IntegrationType : sbyte 7 | { 8 | [JsonPropertyName("twitch")] 9 | Twitch, 10 | 11 | [JsonPropertyName("youtube")] 12 | YouTube, 13 | 14 | [JsonPropertyName("discord")] 15 | Discord, 16 | 17 | [JsonPropertyName("guild_subscription")] 18 | GuildSubscription, 19 | } 20 | -------------------------------------------------------------------------------- /NetCord/InteractionData.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public abstract class InteractionData : IJsonModel 4 | { 5 | JsonModels.JsonInteractionData IJsonModel.JsonModel => _jsonModel; 6 | private protected readonly JsonModels.JsonInteractionData _jsonModel; 7 | 8 | private protected InteractionData(JsonModels.JsonInteractionData jsonModel) 9 | { 10 | _jsonModel = jsonModel; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/InteractionType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum InteractionType 4 | { 5 | Ping = 1, 6 | ApplicationCommand = 2, 7 | MessageComponent = 3, 8 | Autocomplete = 4, 9 | Modal = 5, 10 | } 11 | -------------------------------------------------------------------------------- /NetCord/InviteTargetType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum InviteTargetType 4 | { 5 | Stream = 1, 6 | EmbeddedApplication = 2, 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/InviteType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum InviteType : byte 4 | { 5 | Guild = 0, 6 | GroupDMChannel = 1, 7 | Friend = 2, 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonAccount.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonAccount : JsonEntity 6 | { 7 | [JsonPropertyName("name")] 8 | public string Name { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonApplicationCommandGuildPermission.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonApplicationCommandGuildPermission : JsonEntity 6 | { 7 | [JsonPropertyName("type")] 8 | public ApplicationCommandGuildPermissionType Type { get; set; } 9 | 10 | [JsonPropertyName("permission")] 11 | public bool Permission { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonApplicationInstallParams.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonApplicationInstallParams 6 | { 7 | [JsonPropertyName("scopes")] 8 | public string[] Scopes { get; set; } 9 | 10 | [JsonPropertyName("permissions")] 11 | public Permissions Permissions { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonApplicationIntegrationTypeConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonApplicationIntegrationTypeConfiguration 6 | { 7 | [JsonPropertyName("oauth2_install_params")] 8 | public JsonApplicationInstallParams? OAuth2InstallParams { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonAuditLogChange.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace NetCord.JsonModels; 5 | 6 | public class JsonAuditLogChange 7 | { 8 | [JsonPropertyName("new_value")] 9 | public JsonElement? NewValue { get; set; } 10 | 11 | [JsonPropertyName("old_value")] 12 | public JsonElement? OldValue { get; set; } 13 | 14 | [JsonPropertyName("key")] 15 | public string Key { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonAutoModerationAction.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonAutoModerationAction 6 | { 7 | [JsonPropertyName("type")] 8 | public AutoModerationActionType Type { get; set; } 9 | 10 | [JsonPropertyName("metadata")] 11 | public JsonAutoModerationActionMetadata? Metadata { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonAutoModerationActionMetadata.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonAutoModerationActionMetadata 6 | { 7 | [JsonPropertyName("channel_id")] 8 | public ulong? ChannelId { get; set; } 9 | 10 | [JsonPropertyName("duration_seconds")] 11 | public int? DurationSeconds { get; set; } 12 | 13 | [JsonPropertyName("custom_message")] 14 | public string? CustomMessage { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonAvatarDecorationData.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonAvatarDecorationData 6 | { 7 | [JsonPropertyName("asset")] 8 | public string Hash { get; set; } 9 | 10 | [JsonPropertyName("sku_id")] 11 | public ulong SkuId { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonEmbedField.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonEmbedField 6 | { 7 | [JsonPropertyName("name")] 8 | public string Name { get; set; } 9 | 10 | [JsonPropertyName("value")] 11 | public string Value { get; set; } 12 | 13 | [JsonPropertyName("inline")] 14 | public bool Inline { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonEmbedFooter.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonEmbedFooter 6 | { 7 | [JsonPropertyName("text")] 8 | public string Text { get; set; } 9 | 10 | [JsonPropertyName("icon_url")] 11 | public string? IconUrl { get; set; } 12 | 13 | [JsonPropertyName("proxy_icon_url")] 14 | public string? ProxyIconUrl { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonEmbedImage.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonEmbedImage 6 | { 7 | [JsonPropertyName("url")] 8 | public string? Url { get; set; } 9 | 10 | [JsonPropertyName("proxy_url")] 11 | public string? ProxyUrl { get; set; } 12 | 13 | [JsonPropertyName("height")] 14 | public int? Height { get; set; } 15 | 16 | [JsonPropertyName("width")] 17 | public int? Width { get; set; } 18 | } 19 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonEmbedProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonEmbedProvider 6 | { 7 | [JsonPropertyName("name")] 8 | public string? Name { get; set; } 9 | 10 | [JsonPropertyName("url")] 11 | public string? Url { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonEmbedVideo.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonEmbedVideo 6 | { 7 | [JsonPropertyName("url")] 8 | public string? Url { get; set; } 9 | 10 | [JsonPropertyName("proxy_url")] 11 | public string? ProxyUrl { get; set; } 12 | 13 | [JsonPropertyName("height")] 14 | public int? Height { get; set; } 15 | 16 | [JsonPropertyName("width")] 17 | public int? Width { get; set; } 18 | } 19 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonEntity.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonEntity 6 | { 7 | [JsonPropertyName("id")] 8 | public virtual ulong Id { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonForumGuildChannelDefaultReaction.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonForumGuildChannelDefaultReaction 6 | { 7 | [JsonPropertyName("emoji_id")] 8 | public ulong? EmojiId { get; set; } 9 | 10 | [JsonPropertyName("emoji_name")] 11 | public string? EmojiName { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonGuildChannelMention.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonGuildChannelMention : JsonEntity 6 | { 7 | [JsonPropertyName("guild_id")] 8 | public ulong GuildId { get; set; } 9 | 10 | [JsonPropertyName("type")] 11 | public ChannelType Type { get; set; } 12 | 13 | [JsonPropertyName("name")] 14 | public string Name { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonGuildScheduledEventMetadata.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonGuildScheduledEventMetadata 6 | { 7 | [JsonPropertyName("location")] 8 | public string? Location { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonGuildScheduledEventRecurrenceRuleNWeekday.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonGuildScheduledEventRecurrenceRuleNWeekday 6 | { 7 | [JsonPropertyName("n")] 8 | public int N { get; set; } 9 | 10 | [JsonPropertyName("day")] 11 | public GuildScheduledEventRecurrenceRuleWeekday Day { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonInteractionGuildReference.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonInteractionGuildReference : JsonEntity 6 | { 7 | [JsonPropertyName("features")] 8 | public string[] Features { get; set; } 9 | 10 | [JsonPropertyName("locale")] 11 | public string Locale { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonMessageActivity.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonMessageActivity 6 | { 7 | [JsonPropertyName("type")] 8 | public MessageActivityType Type { get; set; } 9 | 10 | [JsonPropertyName("party_id")] 11 | public string? PartyId { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonMessageCall.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonMessageCall 6 | { 7 | [JsonPropertyName("participants")] 8 | public ulong[] Participants { get; set; } 9 | 10 | [JsonPropertyName("ended_timestamp")] 11 | public DateTimeOffset? EndedAt { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonMessageInteraction.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonMessageInteraction : JsonEntity 6 | { 7 | [JsonPropertyName("type")] 8 | public InteractionType Type { get; set; } 9 | 10 | [JsonPropertyName("name")] 11 | public string Name { get; set; } 12 | 13 | [JsonPropertyName("user")] 14 | public JsonUser User { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonMessagePollAnswer.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonMessagePollAnswer 6 | { 7 | [JsonPropertyName("answer_id")] 8 | public int AnswerId { get; set; } 9 | 10 | [JsonPropertyName("poll_media")] 11 | public JsonMessagePollMedia PollMedia { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonMessagePollAnswerCount.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonMessagePollAnswerCount 6 | { 7 | [JsonPropertyName("id")] 8 | public int AnswerId { get; set; } 9 | 10 | [JsonPropertyName("count")] 11 | public int Count { get; set; } 12 | 13 | [JsonPropertyName("me_voted")] 14 | public bool MeVoted { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonMessagePollMedia.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonMessagePollMedia : JsonEntity 6 | { 7 | [JsonPropertyName("text")] 8 | public string? Text { get; set; } 9 | 10 | [JsonPropertyName("emoji")] 11 | public JsonEmoji? Emoji { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonMessagePollResults.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonMessagePollResults : JsonEntity 6 | { 7 | [JsonPropertyName("is_finalized")] 8 | public bool IsFinalized { get; set; } 9 | 10 | [JsonPropertyName("answer_counts")] 11 | public JsonMessagePollAnswerCount[] Answers { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonMessageReactionCountDetails.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonMessageReactionCountDetails 6 | { 7 | [JsonPropertyName("burst")] 8 | public int Burst { get; set; } 9 | 10 | [JsonPropertyName("normal")] 11 | public int Normal { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonMessageSnapshot.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonMessageSnapshot 6 | { 7 | [JsonPropertyName("message")] 8 | public JsonMessageSnapshotMessage Message { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonMessageSticker.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonMessageSticker : JsonEntity 6 | { 7 | [JsonPropertyName("name")] 8 | public string Name { get; set; } 9 | 10 | [JsonPropertyName("format_type")] 11 | public StickerFormat Format { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonPermissionOverwrite.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonPermissionOverwrite : JsonEntity 6 | { 7 | [JsonPropertyName("type")] 8 | public PermissionOverwriteType Type { get; set; } 9 | 10 | [JsonPropertyName("allow")] 11 | public Permissions Allowed { get; set; } 12 | 13 | [JsonPropertyName("deny")] 14 | public Permissions Denied { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonSelectMenuDefaultValue.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonSelectMenuDefaultValue : JsonEntity 6 | { 7 | [JsonPropertyName("type")] 8 | public JsonSelectMenuDefaultValueType Type { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonSelectMenuDefaultValueType.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | using NetCord.JsonConverters; 4 | 5 | namespace NetCord.JsonModels; 6 | 7 | [JsonConverter(typeof(SafeStringEnumConverter))] 8 | public enum JsonSelectMenuDefaultValueType : sbyte 9 | { 10 | [JsonPropertyName("user")] 11 | User, 12 | 13 | [JsonPropertyName("role")] 14 | Role, 15 | 16 | [JsonPropertyName("channel")] 17 | Channel, 18 | } 19 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonThreadCurrentUser.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonThreadCurrentUser 6 | { 7 | [JsonPropertyName("join_timestamp")] 8 | public DateTimeOffset JoinTimestamp { get; set; } 9 | 10 | [JsonPropertyName("flags")] 11 | public int Flags { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/JsonModels/JsonWelcomeScreen.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.JsonModels; 4 | 5 | public class JsonGuildWelcomeScreen 6 | { 7 | [JsonPropertyName("description")] 8 | public string? Description { get; set; } 9 | 10 | [JsonPropertyName("welcome_channels")] 11 | public JsonWelcomeScreenChannel[] WelcomeChannels { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Logging/GatewayWebSocketLogger.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Logging; 2 | 3 | internal class GatewayWebSocketLogger(IGatewayLogger logger) : IWebSocketLogger 4 | { 5 | public void Log(LogLevel logLevel, TState state, Exception? exception, Func formatter) 6 | { 7 | logger.Log(logLevel, state, exception, formatter); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Logging/IGatewayLogger.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Logging; 2 | 3 | public interface IGatewayLogger 4 | { 5 | public void Log(LogLevel logLevel, TState state, Exception? exception, Func formatter); 6 | } 7 | -------------------------------------------------------------------------------- /NetCord/Logging/IRestLogger.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Logging; 2 | 3 | public interface IRestLogger 4 | { 5 | public void Log(LogLevel logLevel, TState state, Exception? exception, Func formatter); 6 | } 7 | -------------------------------------------------------------------------------- /NetCord/Logging/IVoiceLogger.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Logging; 2 | 3 | public interface IVoiceLogger 4 | { 5 | public void Log(LogLevel logLevel, TState state, Exception? exception, Func formatter); 6 | } 7 | -------------------------------------------------------------------------------- /NetCord/Logging/IWebSocketLogger.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Logging; 2 | 3 | internal interface IWebSocketLogger 4 | { 5 | public void Log(LogLevel logLevel, TState state, Exception? exception, Func formatter); 6 | } 7 | -------------------------------------------------------------------------------- /NetCord/Logging/VoiceWebSocketLogger.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Logging; 2 | 3 | internal class VoiceWebSocketLogger(IVoiceLogger logger) : IWebSocketLogger 4 | { 5 | public void Log(LogLevel logLevel, TState state, Exception? exception, Func formatter) 6 | { 7 | logger.Log(logLevel, state, exception, formatter); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/MembershipState.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum MembershipState 4 | { 5 | Invited = 1, 6 | Accepted = 2, 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/MentionableMenuInteraction.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Gateway; 2 | using NetCord.Rest; 3 | 4 | namespace NetCord; 5 | 6 | public class MentionableMenuInteraction(JsonModels.JsonInteraction jsonModel, Guild? guild, Func sendResponseAsync, RestClient client) : EntityMenuInteraction(jsonModel, guild, sendResponseAsync, client) 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/MessageActivity.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public class MessageActivity(JsonModels.JsonMessageActivity jsonModel) : IJsonModel 4 | { 5 | JsonModels.JsonMessageActivity IJsonModel.JsonModel => jsonModel; 6 | 7 | public MessageActivityType Type => jsonModel.Type; 8 | public string? PartyId => jsonModel.PartyId; 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/MessageActivityType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum MessageActivityType 4 | { 5 | Join = 1, 6 | Spectate = 2, 7 | Listen = 3, 8 | JoinRequest = 5, 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/MessageCommandInteractionData.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Rest; 2 | 3 | namespace NetCord; 4 | 5 | public class MessageCommandInteractionData(JsonModels.JsonInteractionData jsonModel, RestClient client) : ApplicationCommandInteractionData(jsonModel) 6 | { 7 | public RestMessage TargetMessage { get; } = new(jsonModel.ResolvedData!.Messages![jsonModel.TargetId.GetValueOrDefault()], client); 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/MessageComponentInteractionData.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public abstract class MessageComponentInteractionData : ComponentInteractionData 4 | { 5 | private protected MessageComponentInteractionData(JsonModels.JsonInteractionData jsonModel) : base(jsonModel) 6 | { 7 | } 8 | 9 | public int Id => (int)_jsonModel.Id.GetValueOrDefault(); 10 | 11 | public ComponentType ComponentType => _jsonModel.ComponentType.GetValueOrDefault(); 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/MessageInteraction.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Rest; 2 | 3 | namespace NetCord; 4 | 5 | public class MessageInteraction(JsonModels.JsonMessageInteraction jsonModel, RestClient client) : Entity 6 | { 7 | public override ulong Id => jsonModel.Id; 8 | public InteractionType Type => jsonModel.Type; 9 | public string Name => jsonModel.Name; 10 | public User User { get; } = new(jsonModel.User, client); 11 | } 12 | -------------------------------------------------------------------------------- /NetCord/MessagePollAnswer.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | 3 | namespace NetCord; 4 | 5 | public class MessagePollAnswer(JsonMessagePollAnswer jsonModel) : IJsonModel 6 | { 7 | JsonMessagePollAnswer IJsonModel.JsonModel => jsonModel; 8 | 9 | public int AnswerId => jsonModel.AnswerId; 10 | public MessagePollMedia PollMedia { get; } = new(jsonModel.PollMedia); 11 | } 12 | -------------------------------------------------------------------------------- /NetCord/MessagePollAnswerCount.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | 3 | namespace NetCord; 4 | 5 | public class MessagePollAnswerCount(JsonMessagePollAnswerCount jsonModel) : IJsonModel 6 | { 7 | JsonMessagePollAnswerCount IJsonModel.JsonModel => jsonModel; 8 | 9 | public int AnswerId => jsonModel.AnswerId; 10 | public int Count => jsonModel.Count; 11 | public bool MeVoted => jsonModel.MeVoted; 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/MessagePollAnswerProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord; 4 | 5 | public partial class MessagePollAnswerProperties(MessagePollMediaProperties pollMedia) 6 | { 7 | [JsonPropertyName("poll_media")] 8 | public MessagePollMediaProperties PollMedia { get; set; } = pollMedia; 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/MessagePollLayoutType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum MessagePollLayoutType : byte 4 | { 5 | Default = 1, 6 | } 7 | -------------------------------------------------------------------------------- /NetCord/MessagePollMediaProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord; 4 | 5 | public partial class MessagePollMediaProperties 6 | { 7 | [JsonPropertyName("text")] 8 | public string? Text { get; set; } 9 | 10 | [JsonPropertyName("emoji")] 11 | public EmojiProperties? Emoji { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/MessagePollResults.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | 3 | namespace NetCord; 4 | 5 | public class MessagePollResults(JsonMessagePollResults jsonModel) : IJsonModel 6 | { 7 | JsonMessagePollResults IJsonModel.JsonModel => jsonModel; 8 | 9 | public bool IsFinalized => jsonModel.IsFinalized; 10 | public IReadOnlyList Answers { get; } = jsonModel.Answers.Select(x => new MessagePollAnswerCount(x)).ToArray(); 11 | } 12 | -------------------------------------------------------------------------------- /NetCord/MessageReactionEmoji.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public class MessageReactionEmoji(JsonModels.JsonEmoji jsonModel) : IJsonModel 4 | { 5 | JsonModels.JsonEmoji IJsonModel.JsonModel => jsonModel; 6 | 7 | public ulong? Id => jsonModel.Id; 8 | 9 | public string? Name => jsonModel.Name; 10 | 11 | public bool Animated => jsonModel.Animated; 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/MessageReferenceType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum MessageReferenceType : byte 4 | { 5 | Reply = 0, 6 | Forward = 1, 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/MessageSnapshot.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | using NetCord.Rest; 3 | 4 | namespace NetCord; 5 | 6 | public class MessageSnapshot(JsonMessageSnapshot jsonModel, ulong? guildId, RestClient client) : IJsonModel 7 | { 8 | JsonMessageSnapshot IJsonModel.JsonModel => jsonModel; 9 | 10 | public MessageSnapshotMessage Message { get; } = new(jsonModel.Message, guildId, client); 11 | } 12 | -------------------------------------------------------------------------------- /NetCord/MfaLevel.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum MfaLevel 4 | { 5 | None = 0, 6 | Elevated = 1, 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/ModalInteractionData.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public class ModalInteractionData(JsonModels.JsonInteractionData jsonModel) : ComponentInteractionData(jsonModel) 4 | { 5 | public IReadOnlyList Components { get; } = jsonModel.Components!.Select(IComponent.CreateFromJson).ToArray(); 6 | } 7 | -------------------------------------------------------------------------------- /NetCord/NsfwLevel.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum NsfwLevel 4 | { 5 | Default = 0, 6 | Explicit = 1, 7 | Safe = 2, 8 | AgeRestricted = 3, 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/PermissionOverwriteType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum PermissionOverwriteType 4 | { 5 | Role = 0, 6 | User = 1, 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/PremiumType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum PremiumType 4 | { 5 | None = 0, 6 | NitroClassic = 1, 7 | Nitro = 2, 8 | NitroBasic = 3, 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/ReactionType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum ReactionType : byte 4 | { 5 | Normal = 0, 6 | Burst = 1, 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/Rest/ApplicationCommandGuildPermissionsProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest; 4 | 5 | internal class ApplicationCommandGuildPermissionsProperties(IEnumerable newPermissions) 6 | { 7 | [JsonPropertyName("permissions")] 8 | public IEnumerable NewPermissions { get; set; } = newPermissions; 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Rest/ApplicationCommandOptionChoiceValueType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest; 2 | 3 | public enum ApplicationCommandOptionChoiceValueType 4 | { 5 | String, 6 | Numeric, 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/Rest/ApplicationEmojiOptions.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest; 4 | 5 | public partial class ApplicationEmojiOptions 6 | { 7 | internal ApplicationEmojiOptions() 8 | { 9 | } 10 | 11 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 12 | [JsonPropertyName("name")] 13 | public string? Name { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /NetCord/Rest/ApplicationEmojiProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest; 4 | 5 | public partial class ApplicationEmojiProperties(string name, ImageProperties image) 6 | { 7 | [JsonPropertyName("name")] 8 | public string Name { get; set; } = name; 9 | 10 | [JsonPropertyName("image")] 11 | public ImageProperties Image { get; set; } = image; 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Rest/ApplicationIntegrationTypeConfigurationProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest; 4 | 5 | public partial class ApplicationIntegrationTypeConfigurationProperties 6 | { 7 | [JsonPropertyName("oauth2_install_params")] 8 | public ApplicationInstallParamsProperties? OAuth2InstallParams { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Rest/ApplicationRoleConnectionMetadataType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest; 2 | 3 | public enum ApplicationRoleConnectionMetadataType 4 | { 5 | IntegerLessThanOrEqual = 1, 6 | IntegerGreaterThanOrEqual = 2, 7 | IntegerEqual = 3, 8 | IntegerNotEqual = 4, 9 | DateTimeLessThanOrEqual = 5, 10 | DateTimeGreaterThanOrEqual = 6, 11 | BooleanEqual = 7, 12 | BooleanNotEqual = 8, 13 | } 14 | -------------------------------------------------------------------------------- /NetCord/Rest/BulkDeleteMessagesProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest; 4 | 5 | internal class BulkDeleteMessagesProperties(ArraySegment messageIds) 6 | { 7 | [JsonPropertyName("messages")] 8 | public ArraySegment MessageIds { get; set; } = messageIds; 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Rest/ComponentProperties/ComponentMediaProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest; 4 | 5 | public partial class ComponentMediaProperties(string url) 6 | { 7 | [JsonPropertyName("url")] 8 | public string Url { get; set; } = url; 9 | 10 | public static implicit operator ComponentMediaProperties(string url) => new(url); 11 | } 12 | -------------------------------------------------------------------------------- /NetCord/Rest/ComponentProperties/EntityMenuProperties.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest; 2 | 3 | public abstract partial class EntityMenuProperties(string customId) : MenuProperties(customId) 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /NetCord/Rest/ComponentProperties/ICustomizableButtonProperties.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest; 2 | 3 | public partial interface ICustomizableButtonProperties : IButtonProperties 4 | { 5 | /// 6 | /// Text that appears on the button (max 80 characters). 7 | /// 8 | public string? Label { get; set; } 9 | 10 | /// 11 | /// Emoji that appears on the button. 12 | /// 13 | public EmojiProperties? Emoji { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /NetCord/Rest/ConnectionVisibility.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest; 2 | 3 | public enum ConnectionVisibility 4 | { 5 | /// 6 | /// Invisible to everyone except the user themselves. 7 | /// 8 | None = 0, 9 | 10 | /// 11 | /// Visible to everyone. 12 | /// 13 | Everyone = 1, 14 | } 15 | -------------------------------------------------------------------------------- /NetCord/Rest/CurrentGuildUserOptions.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest; 4 | 5 | public partial class CurrentGuildUserOptions 6 | { 7 | internal CurrentGuildUserOptions() 8 | { 9 | } 10 | 11 | /// 12 | /// New nickname, empty to remove nickname. 13 | /// 14 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 15 | [JsonPropertyName("nick")] 16 | public string? Nickname { get; set; } 17 | } 18 | -------------------------------------------------------------------------------- /NetCord/Rest/DMChannelProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest; 4 | 5 | internal partial class DMChannelProperties(ulong userId) 6 | { 7 | /// 8 | /// The recipient to open a DM channel with. 9 | /// 10 | [JsonPropertyName("recipient_id")] 11 | public ulong UserId { get; set; } = userId; 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Rest/FollowedChannel.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest; 2 | 3 | public class FollowedChannel(JsonModels.JsonFollowedChannel jsonModel, RestClient client) : ClientEntity(client), IJsonModel 4 | { 5 | JsonModels.JsonFollowedChannel IJsonModel.JsonModel => jsonModel; 6 | 7 | public override ulong Id => jsonModel.Id; 8 | 9 | public ulong WebhookId => jsonModel.WebhookId; 10 | } 11 | -------------------------------------------------------------------------------- /NetCord/Rest/GatewayBot.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest; 2 | 3 | public class GatewayBot(JsonModels.JsonGatewayBot jsonModel) : IJsonModel 4 | { 5 | JsonModels.JsonGatewayBot IJsonModel.JsonModel => jsonModel; 6 | 7 | public string Url => jsonModel.Url; 8 | 9 | public int ShardCount => jsonModel.ShardCount; 10 | 11 | public GatewaySessionStartLimit SessionStartLimit { get; } = new(jsonModel.SessionStartLimit); 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Rest/GoogleCloudPlatformStorageBucketsProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest; 4 | 5 | internal class GoogleCloudPlatformStorageBucketsProperties(IEnumerable buckets) 6 | { 7 | [JsonPropertyName("files")] 8 | public IEnumerable Buckets { get; set; } = buckets; 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Rest/GroupDMChannelProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest; 4 | 5 | public partial class GroupDMChannelProperties(IEnumerable accessTokens) 6 | { 7 | [JsonPropertyName("access_tokens")] 8 | public IEnumerable AccessTokens { get; set; } = accessTokens; 9 | 10 | [JsonPropertyName("nicks")] 11 | public IReadOnlyDictionary? Nicknames { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Rest/GroupDMUserAddProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest; 4 | 5 | public partial class GroupDMChannelUserAddProperties(string accessToken) 6 | { 7 | [JsonPropertyName("access_token")] 8 | public string AccessToken { get; set; } = accessToken; 9 | 10 | [JsonPropertyName("nick")] 11 | public string? Nickname { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Rest/GuildApplicationCommand.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest; 2 | 3 | public partial class GuildApplicationCommand(JsonModels.JsonApplicationCommand jsonModel, RestClient client) : ApplicationCommand(jsonModel, client) 4 | { 5 | public ulong GuildId => _jsonModel.GuildId.GetValueOrDefault(); 6 | } 7 | -------------------------------------------------------------------------------- /NetCord/Rest/GuildBan.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest; 2 | 3 | public partial class GuildBan(JsonModels.JsonGuildBan jsonModel, ulong guildId, RestClient client) : IJsonModel 4 | { 5 | JsonModels.JsonGuildBan IJsonModel.JsonModel => jsonModel; 6 | 7 | public string? Reason => jsonModel.Reason; 8 | 9 | public User User { get; } = new(jsonModel.User, client); 10 | 11 | public ulong GuildId { get; } = guildId; 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Rest/GuildBanProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest; 4 | 5 | internal class GuildBanProperties(int deleteMessageSeconds) 6 | { 7 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] 8 | [JsonPropertyName("delete_message_seconds")] 9 | public int DeleteMessageSeconds { get; set; } = deleteMessageSeconds; 10 | } 11 | -------------------------------------------------------------------------------- /NetCord/Rest/GuildBulkBan.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Rest.JsonModels; 2 | 3 | namespace NetCord.Rest; 4 | 5 | public class GuildBulkBan(JsonGuildBulkBan jsonModel) : IJsonModel 6 | { 7 | JsonGuildBulkBan IJsonModel.JsonModel => jsonModel; 8 | 9 | public IReadOnlyList BannedUsers => jsonModel.BannedUsers; 10 | 11 | public IReadOnlyList FailedUsers => jsonModel.FailedUsers; 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Rest/GuildBulkBanProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest; 4 | 5 | internal class GuildBulkBanProperties(IEnumerable userIds, int deleteMessageSeconds) : GuildBanProperties(deleteMessageSeconds) 6 | { 7 | [JsonPropertyName("user_ids")] 8 | public IEnumerable UserIds { get; set; } = userIds; 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Rest/GuildEmojiProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest; 4 | 5 | public partial class GuildEmojiProperties(string name, ImageProperties image) 6 | { 7 | [JsonPropertyName("name")] 8 | public string Name { get; set; } = name; 9 | 10 | [JsonPropertyName("image")] 11 | public ImageProperties Image { get; set; } = image; 12 | 13 | [JsonPropertyName("roles")] 14 | public IEnumerable? AllowedRoles { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/Rest/GuildMfaLevelProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest; 4 | 5 | internal class GuildMfaLevelProperties(MfaLevel level) 6 | { 7 | [JsonPropertyName("level")] 8 | public MfaLevel Level { get; set; } = level; 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Rest/GuildOnboardingMode.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest; 2 | 3 | public enum GuildOnboardingMode 4 | { 5 | /// 6 | /// Counts only Default Channels towards constraints. 7 | /// 8 | Default = 0, 9 | 10 | /// 11 | /// Counts Default Channels and Questions towards constraints. 12 | /// 13 | Advanced = 1, 14 | } 15 | -------------------------------------------------------------------------------- /NetCord/Rest/GuildOnboardingPromptType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest; 2 | 3 | public enum GuildOnboardingPromptType 4 | { 5 | MultipleChoice = 0, 6 | Dropdown = 1, 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/Rest/GuildScheduledEventMetadataProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest; 4 | 5 | public partial class GuildScheduledEventMetadataProperties(string location) 6 | { 7 | [JsonPropertyName("location")] 8 | public string Location { get; set; } = location; 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Rest/GuildTemplateProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest; 4 | 5 | public partial class GuildTemplateProperties(string name) 6 | { 7 | [JsonPropertyName("name")] 8 | public string Name { get; set; } = name; 9 | 10 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 11 | [JsonPropertyName("description")] 12 | public string? Description { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /NetCord/Rest/GuildThreadUser.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | 3 | namespace NetCord.Rest; 4 | 5 | public partial class GuildThreadUser(JsonThreadUser jsonModel, RestClient client) : ThreadUser(jsonModel, client) 6 | { 7 | public PartialGuildUser GuildUser { get; } = new(jsonModel.GuildUser!, client); 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Rest/GuildVanityInvite.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest; 2 | 3 | public class GuildVanityInvite(JsonModels.JsonGuildVanityInvite jsonModel) : IJsonModel 4 | { 5 | JsonModels.JsonGuildVanityInvite IJsonModel.JsonModel => jsonModel; 6 | 7 | public string Code => jsonModel.Code; 8 | 9 | public int Uses => jsonModel.Uses; 10 | } 11 | -------------------------------------------------------------------------------- /NetCord/Rest/GuildWidgetChannel.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest; 2 | 3 | public class GuildWidgetChannel(JsonModels.JsonGuildWidgetChannel jsonModel) : Entity, IJsonModel 4 | { 5 | JsonModels.JsonGuildWidgetChannel IJsonModel.JsonModel => jsonModel; 6 | 7 | public override ulong Id => jsonModel.Id; 8 | 9 | public string Name => jsonModel.Name; 10 | 11 | public int Position => jsonModel.Position; 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Rest/GuildWidgetSettings.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest; 2 | 3 | public class GuildWidgetSettings(JsonModels.JsonGuildWidgetSettings jsonModel) : IJsonModel 4 | { 5 | JsonModels.JsonGuildWidgetSettings IJsonModel.JsonModel => jsonModel; 6 | 7 | public bool Enabled => jsonModel.Enabled; 8 | 9 | public ulong? ChannelId => jsonModel.ChannelId; 10 | } 11 | -------------------------------------------------------------------------------- /NetCord/Rest/GuildWidgetSettingsOptions.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest; 4 | 5 | public partial class GuildWidgetSettingsOptions 6 | { 7 | internal GuildWidgetSettingsOptions() 8 | { 9 | } 10 | 11 | [JsonPropertyName("enabled")] 12 | public bool Enabled { get; set; } 13 | 14 | [JsonPropertyName("channel_id")] 15 | public ulong? ChannelId { get; set; } 16 | } 17 | -------------------------------------------------------------------------------- /NetCord/Rest/IGuildUsersSearchQuery.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json; 2 | 3 | namespace NetCord.Rest; 4 | 5 | public interface IGuildUsersSearchQuery 6 | { 7 | public void Serialize(Utf8JsonWriter writer); 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Rest/IRestRequestHandler.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest; 2 | 3 | public interface IRestRequestHandler : IDisposable 4 | { 5 | public Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken = default); 6 | 7 | public void AddDefaultHeader(string name, IEnumerable values); 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Rest/InteractionCallbackChoicesDataProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest; 4 | 5 | public partial class InteractionCallbackChoicesDataProperties(IEnumerable? choices) 6 | { 7 | [JsonPropertyName("choices")] 8 | public IEnumerable? Choices { get; set; } = choices; 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Rest/JsonModels/JsonApplicationEmojisResult.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | using NetCord.JsonModels; 4 | 5 | namespace NetCord.Rest.JsonModels; 6 | 7 | internal class JsonApplicationEmojisResult 8 | { 9 | [JsonPropertyName("items")] 10 | public JsonEmoji[] Items { get; set; } 11 | } 12 | -------------------------------------------------------------------------------- /NetCord/Rest/JsonModels/JsonCreateGoogleCloudPlatformStorageBucketResult.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest.JsonModels; 4 | 5 | internal class JsonCreateGoogleCloudPlatformStorageBucketResult 6 | { 7 | [JsonPropertyName("attachments")] 8 | public JsonGoogleCloudPlatformStorageBucket[] Buckets { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Rest/JsonModels/JsonFollowedChannel.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | using NetCord.JsonModels; 4 | 5 | namespace NetCord.Rest.JsonModels; 6 | 7 | public class JsonFollowedChannel : JsonEntity 8 | { 9 | [JsonPropertyName("channel_id")] 10 | public override ulong Id { get; set; } 11 | 12 | [JsonPropertyName("webhook_id")] 13 | public ulong WebhookId { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /NetCord/Rest/JsonModels/JsonGateway.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest.JsonModels; 4 | 5 | internal class JsonGateway 6 | { 7 | [JsonPropertyName("url")] 8 | public string Url { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Rest/JsonModels/JsonGatewayBot.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest.JsonModels; 4 | 5 | public class JsonGatewayBot 6 | { 7 | [JsonPropertyName("url")] 8 | public string Url { get; set; } 9 | 10 | [JsonPropertyName("shards")] 11 | public int ShardCount { get; set; } 12 | 13 | [JsonPropertyName("session_start_limit")] 14 | public JsonGatewaySessionStartLimit SessionStartLimit { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/Rest/JsonModels/JsonGoogleCloudPlatformStorageBucket.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest.JsonModels; 4 | 5 | public class JsonGoogleCloudPlatformStorageBucket 6 | { 7 | [JsonPropertyName("id")] 8 | public long? Id { get; set; } 9 | 10 | [JsonPropertyName("upload_url")] 11 | public string UploadUrl { get; set; } 12 | 13 | [JsonPropertyName("upload_filename")] 14 | public string UploadFileName { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/Rest/JsonModels/JsonGuildBan.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | using NetCord.JsonModels; 4 | 5 | namespace NetCord.Rest.JsonModels; 6 | 7 | public class JsonGuildBan 8 | { 9 | [JsonPropertyName("reason")] 10 | public string? Reason { get; set; } 11 | 12 | [JsonPropertyName("user")] 13 | public JsonUser User { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /NetCord/Rest/JsonModels/JsonGuildBulkBan.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest.JsonModels; 4 | 5 | public class JsonGuildBulkBan 6 | { 7 | [JsonPropertyName("banned_users")] 8 | public ulong[] BannedUsers { get; set; } 9 | 10 | [JsonPropertyName("failed_users")] 11 | public ulong[] FailedUsers { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Rest/JsonModels/JsonGuildMfaLevel.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest.JsonModels; 4 | 5 | internal class JsonGuildMfaLevel 6 | { 7 | [JsonPropertyName("level")] 8 | public MfaLevel Level { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Rest/JsonModels/JsonGuildPruneCountResult.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest.JsonModels; 4 | 5 | internal class JsonGuildPruneCountResult 6 | { 7 | [JsonPropertyName("pruned")] 8 | public int Pruned { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Rest/JsonModels/JsonGuildPruneResult.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest.JsonModels; 4 | 5 | internal class JsonGuildPruneResult 6 | { 7 | [JsonPropertyName("pruned")] 8 | public int? Pruned { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Rest/JsonModels/JsonGuildUserSearchResult.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest.JsonModels; 4 | 5 | internal class JsonGuildUserSearchResult 6 | { 7 | [JsonPropertyName("members")] 8 | public JsonGuildUserInfo[] Users { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Rest/JsonModels/JsonGuildVanityInvite.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest.JsonModels; 4 | 5 | public class JsonGuildVanityInvite 6 | { 7 | [JsonPropertyName("code")] 8 | public string Code { get; set; } 9 | 10 | [JsonPropertyName("uses")] 11 | public int Uses { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Rest/JsonModels/JsonGuildWidgetChannel.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | using NetCord.JsonModels; 4 | 5 | namespace NetCord.Rest.JsonModels; 6 | 7 | public class JsonGuildWidgetChannel : JsonEntity 8 | { 9 | [JsonPropertyName("name")] 10 | public string Name { get; set; } 11 | 12 | [JsonPropertyName("position")] 13 | public int Position { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /NetCord/Rest/JsonModels/JsonGuildWidgetSettings.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest.JsonModels; 4 | 5 | public class JsonGuildWidgetSettings 6 | { 7 | [JsonPropertyName("enabled")] 8 | public bool Enabled { get; set; } 9 | 10 | [JsonPropertyName("channel_id")] 11 | public ulong? ChannelId { get; set; } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Rest/JsonModels/JsonMessagePollAnswerVotersResult.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | using NetCord.JsonModels; 4 | 5 | namespace NetCord.Rest.JsonModels; 6 | 7 | internal class JsonMessagePollAnswerVotersResult 8 | { 9 | [JsonPropertyName("users")] 10 | public JsonUser[] Users { get; set; } 11 | } 12 | -------------------------------------------------------------------------------- /NetCord/Rest/JsonModels/JsonRestGuildThreadPartialResult.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest.JsonModels; 4 | 5 | internal class JsonRestGuildThreadPartialResult : JsonRestGuildThreadResult 6 | { 7 | [JsonPropertyName("has_more")] 8 | public bool HasMore { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Rest/JsonModels/JsonRestGuildThreadResult.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | using NetCord.JsonModels; 4 | 5 | namespace NetCord.Rest.JsonModels; 6 | 7 | internal class JsonRestGuildThreadResult 8 | { 9 | [JsonPropertyName("threads")] 10 | public JsonChannel[] Threads { get; set; } 11 | 12 | [JsonPropertyName("members")] 13 | public JsonThreadUser[] Users { get; set; } 14 | } 15 | -------------------------------------------------------------------------------- /NetCord/Rest/JsonModels/JsonStickerPacks.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest.JsonModels; 4 | 5 | internal class JsonStickerPacks 6 | { 7 | [JsonPropertyName("sticker_packs")] 8 | public JsonStickerPack[] StickerPacks { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Rest/MentionableValueProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest; 4 | 5 | public partial struct MentionableValueProperties(ulong id, MentionableValueType type) 6 | { 7 | [JsonPropertyName("id")] 8 | public ulong Id { get; set; } = id; 9 | 10 | [JsonPropertyName("type")] 11 | public MentionableValueType Type { get; set; } = type; 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Rest/MentionableValueType.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | using NetCord.JsonConverters; 4 | 5 | namespace NetCord.Rest; 6 | 7 | [JsonConverter(typeof(SafeStringEnumConverter))] 8 | public enum MentionableValueType : sbyte 9 | { 10 | [JsonPropertyName("user")] 11 | User, 12 | 13 | [JsonPropertyName("role")] 14 | Role, 15 | } 16 | -------------------------------------------------------------------------------- /NetCord/Rest/MessageCall.cs: -------------------------------------------------------------------------------- 1 | using NetCord.JsonModels; 2 | 3 | namespace NetCord.Rest; 4 | 5 | public class MessageCall(JsonMessageCall jsonModel) : IJsonModel 6 | { 7 | JsonMessageCall IJsonModel.JsonModel => jsonModel; 8 | 9 | public IReadOnlyList Participants => jsonModel.Participants; 10 | 11 | public DateTimeOffset? EndedAt => jsonModel.EndedAt; 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Rest/MessageCommandProperties.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest; 2 | 3 | /// 4 | /// 5 | /// 6 | /// Name of the command (1-32 characters). 7 | public partial class MessageCommandProperties(string name) : ApplicationCommandProperties(ApplicationCommandType.Message, name) 8 | { 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Rest/PaginationContentBuilder.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization.Metadata; 2 | 3 | namespace NetCord.Rest; 4 | 5 | internal class PaginationContentBuilder(T paginationProperties, JsonTypeInfo jsonTypeInfo) where T : PaginationProperties where TFrom : struct 6 | { 7 | public JsonContent Build(TFrom? from) 8 | { 9 | paginationProperties.From = from; 10 | return new(paginationProperties, jsonTypeInfo); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/Rest/PaginationDirection.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest; 2 | 3 | public enum PaginationDirection : byte 4 | { 5 | Before, 6 | After, 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/Rest/RateLimits/BucketInfo.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest.RateLimits; 2 | 3 | public record BucketInfo 4 | { 5 | public BucketInfo(string bucket, TopLevelResourceInfo? resourceInfo) 6 | { 7 | Bucket = bucket; 8 | ResourceInfo = resourceInfo; 9 | } 10 | 11 | public string Bucket { get; } 12 | 13 | public TopLevelResourceInfo? ResourceInfo { get; } 14 | } 15 | -------------------------------------------------------------------------------- /NetCord/Rest/RateLimits/IGlobalRateLimiter.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest.RateLimits; 2 | 3 | public interface IGlobalRateLimiter : IRateLimiter 4 | { 5 | public ValueTask IndicateRateLimitAsync(long reset, CancellationToken cancellationToken = default); 6 | } 7 | -------------------------------------------------------------------------------- /NetCord/Rest/RateLimits/IRateLimiter.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest.RateLimits; 2 | 3 | public interface IRateLimiter 4 | { 5 | public ValueTask TryAcquireAsync(CancellationToken cancellationToken = default); 6 | } 7 | -------------------------------------------------------------------------------- /NetCord/Rest/RateLimits/ITrackingRouteRateLimiter.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest.RateLimits; 2 | 3 | internal interface ITrackingRouteRateLimiter : IRouteRateLimiter 4 | { 5 | public long LastAccess { get; } 6 | 7 | public void IndicateAccess(); 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Rest/RateLimits/RateLimitManagerConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest.RateLimits; 2 | 3 | public class RateLimitManagerConfiguration 4 | { 5 | public int CacheSize { get; init; } = 10103; 6 | public int CacheCleanupCount { get; init; } = 5000; 7 | public int GlobalRateLimit { get; init; } = 50; 8 | public long GlobalRateLimitDuration { get; init; } = 1000; 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Rest/RestRateLimitHandling.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest; 2 | 3 | [Flags] 4 | public enum RestRateLimitHandling : sbyte 5 | { 6 | NoRetry = 0, 7 | RetryUser = 1 << 0, 8 | RetryGlobal = 1 << 1, 9 | RetryShared = 1 << 2, 10 | Retry = RetryUser | RetryGlobal | RetryShared, 11 | } 12 | -------------------------------------------------------------------------------- /NetCord/Rest/RolePositionProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest; 4 | 5 | public partial class RolePositionProperties(ulong id) 6 | { 7 | [JsonPropertyName("id")] 8 | public ulong Id { get; set; } = id; 9 | 10 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 11 | [JsonPropertyName("position")] 12 | public int? Position { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /NetCord/Rest/TestEntitlementOwnerType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest; 2 | 3 | public enum TestEntitlementOwnerType : byte 4 | { 5 | Guild = 1, 6 | User = 2, 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/Rest/TextInputStyle.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest; 2 | 3 | public enum TextInputStyle 4 | { 5 | Short = 1, 6 | Paragraph = 2, 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/Rest/TopLevelResourceInfo.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest; 2 | 3 | public readonly record struct TopLevelResourceInfo 4 | { 5 | public TopLevelResourceInfo(ulong resourceId, string? resourceToken = null) 6 | { 7 | ResourceId = resourceId; 8 | ResourceToken = resourceToken; 9 | } 10 | 11 | public ulong ResourceId { get; } 12 | 13 | public string? ResourceToken { get; } 14 | } 15 | -------------------------------------------------------------------------------- /NetCord/Rest/UserCommandProperties.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest; 2 | 3 | /// 4 | /// 5 | /// 6 | /// Name of the command (1-32 characters). 7 | public partial class UserCommandProperties(string name) : ApplicationCommandProperties(ApplicationCommandType.User, name) 8 | { 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/Rest/WebhookClientConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest; 2 | 3 | public class WebhookClientConfiguration 4 | { 5 | public RestClient? Client { get; set; } 6 | } 7 | -------------------------------------------------------------------------------- /NetCord/Rest/WebhookProperties.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace NetCord.Rest; 4 | 5 | public partial class WebhookProperties(string name) 6 | { 7 | [JsonPropertyName("name")] 8 | public string Name { get; set; } = name; 9 | 10 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 11 | [JsonPropertyName("avatar")] 12 | public ImageProperties? Avatar { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /NetCord/Rest/WebhookType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord.Rest; 2 | 3 | public enum WebhookType 4 | { 5 | Incoming = 1, 6 | ChannelFollower = 2, 7 | Application = 3, 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/RoleFlags.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | [Flags] 4 | public enum RoleFlags 5 | { 6 | /// 7 | /// Role can be selected by members in an onboarding prompt. 8 | /// 9 | InPrompt = 1 << 0, 10 | } 11 | -------------------------------------------------------------------------------- /NetCord/RoleMenuInteraction.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Gateway; 2 | using NetCord.Rest; 3 | 4 | namespace NetCord; 5 | 6 | public class RoleMenuInteraction(JsonModels.JsonInteraction jsonModel, Guild? guild, Func sendResponseAsync, RestClient client) : EntityMenuInteraction(jsonModel, guild, sendResponseAsync, client) 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/SortOrderType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum SortOrderType 4 | { 5 | LatestActivity = 0, 6 | CreationDate = 1, 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/StageInstancePrivacyLevel.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum StageInstancePrivacyLevel 4 | { 5 | Public = 1, 6 | GuildOnly = 2, 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/StandardSticker.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public class StandardSticker(JsonModels.JsonSticker jsonModel) : Sticker(jsonModel) 4 | { 5 | public ulong PackId => _jsonModel.PackId.GetValueOrDefault(); 6 | public int? SortValue => _jsonModel.SortValue; 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/StickerFormat.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum StickerFormat 4 | { 5 | Png = 1, 6 | Apng = 2, 7 | Lottie = 3, 8 | Gif = 4, 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/StickerType.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum StickerType 4 | { 5 | Standard = 1, 6 | Guild = 2, 7 | } 8 | -------------------------------------------------------------------------------- /NetCord/StringMenuInteraction.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Gateway; 2 | using NetCord.Rest; 3 | 4 | namespace NetCord; 5 | 6 | public class StringMenuInteraction(JsonModels.JsonInteraction jsonModel, Guild? guild, Func sendResponseAsync, RestClient client) : MessageComponentInteraction(jsonModel, guild, sendResponseAsync, client) 7 | { 8 | public override StringMenuInteractionData Data { get; } = new(jsonModel.Data!); 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/StringMenuInteractionData.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public class StringMenuInteractionData(JsonModels.JsonInteractionData jsonModel) : MessageComponentInteractionData(jsonModel) 4 | { 5 | public IReadOnlyList SelectedValues => _jsonModel.SelectedValues!; 6 | } 7 | -------------------------------------------------------------------------------- /NetCord/SubscriptionStatus.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum SubscriptionStatus : byte 4 | { 5 | /// 6 | /// Subscription is active and scheduled to renew. 7 | /// 8 | Active = 0, 9 | 10 | /// 11 | /// Subscription is active but will not renew. 12 | /// 13 | Ending = 1, 14 | 15 | /// 16 | /// Subscription is inactive and not being charged. 17 | /// 18 | Inactive = 2, 19 | } 20 | -------------------------------------------------------------------------------- /NetCord/ThreadArchiveDuration.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum ThreadArchiveDuration 4 | { 5 | OneHour = 60, 6 | OneDay = 24 * OneHour, 7 | ThreeDays = 3 * OneDay, 8 | OneWeek = 7 * OneDay, 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/ThreadCurrentUser.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public class ThreadCurrentUser(JsonModels.JsonThreadCurrentUser jsonModel) : IJsonModel 4 | { 5 | JsonModels.JsonThreadCurrentUser IJsonModel.JsonModel => jsonModel; 6 | 7 | public DateTimeOffset JoinTimestamp => jsonModel.JoinTimestamp; 8 | public int Flags => jsonModel.Flags; 9 | } 10 | -------------------------------------------------------------------------------- /NetCord/TimestampStyle.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum TimestampStyle : byte 4 | { 5 | ShortTime = (byte)'t', 6 | LongTime = (byte)'T', 7 | ShortDate = (byte)'d', 8 | LongDate = (byte)'D', 9 | ShortDateTime = (byte)'f', 10 | LongDateTime = (byte)'F', 11 | RelativeTime = (byte)'R', 12 | } 13 | -------------------------------------------------------------------------------- /NetCord/UserMenuInteraction.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Gateway; 2 | using NetCord.Rest; 3 | 4 | namespace NetCord; 5 | 6 | public class UserMenuInteraction(JsonModels.JsonInteraction jsonModel, Guild? guild, Func sendResponseAsync, RestClient client) : EntityMenuInteraction(jsonModel, guild, sendResponseAsync, client) 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /NetCord/Utils/StringUtils.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace NetCord; 5 | 6 | internal static class StringUtils 7 | { 8 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 9 | public static ReadOnlySpan AsSpanFast(this string s) => MemoryMarshal.CreateReadOnlySpan(in s.GetPinnableReference(), s.Length); 10 | } 11 | -------------------------------------------------------------------------------- /NetCord/VerificationLevel.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum VerificationLevel 4 | { 5 | None = 0, 6 | Low = 1, 7 | Medium = 2, 8 | High = 3, 9 | VeryHigh = 4, 10 | } 11 | -------------------------------------------------------------------------------- /NetCord/VideoQualityMode.cs: -------------------------------------------------------------------------------- 1 | namespace NetCord; 2 | 3 | public enum VideoQualityMode 4 | { 5 | None = 0, 6 | /// 7 | /// Discord chooses the quality for optimal performance 8 | /// 9 | Auto = 1, 10 | /// 11 | /// 720p 12 | /// 13 | Full = 2, 14 | } 15 | -------------------------------------------------------------------------------- /Resources/Logo/pdn/Big.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Resources/Logo/pdn/Big.pdn -------------------------------------------------------------------------------- /Resources/Logo/pdn/BigOutline.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Resources/Logo/pdn/BigOutline.pdn -------------------------------------------------------------------------------- /Resources/Logo/pdn/Small.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Resources/Logo/pdn/Small.pdn -------------------------------------------------------------------------------- /Resources/Logo/pdn/SmallSquare.pdn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Resources/Logo/pdn/SmallSquare.pdn -------------------------------------------------------------------------------- /Resources/Logo/png/Big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Resources/Logo/png/Big.png -------------------------------------------------------------------------------- /Resources/Logo/png/BigOutline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Resources/Logo/png/BigOutline.png -------------------------------------------------------------------------------- /Resources/Logo/png/Small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Resources/Logo/png/Small.png -------------------------------------------------------------------------------- /Resources/Logo/png/SmallSquare.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Resources/Logo/png/SmallSquare.png -------------------------------------------------------------------------------- /Resources/NuGet/ICON.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Resources/NuGet/ICON.png -------------------------------------------------------------------------------- /SourceGenerators/Directory.Build.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /SourceGenerators/MethodsForPropertiesGenerator/MethodsForPropertiesGenerator.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SourceGenerators/MethodsForPropertiesGenerator/PropertyData.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.CodeAnalysis; 2 | 3 | namespace MethodsForPropertiesGenerator; 4 | 5 | internal class PropertyData(IPropertySymbol symbol, INamedTypeSymbol containingType, bool inherited) 6 | { 7 | public IPropertySymbol Symbol { get; } = symbol; 8 | 9 | public INamedTypeSymbol ContainingType { get; } = containingType; 10 | 11 | public bool Inherited { get; } = inherited; 12 | } 13 | -------------------------------------------------------------------------------- /SourceGenerators/RestClientMethodAliasesGenerator/RestClientMethodAliasesGenerator.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SourceGenerators/ShardedGatewayClientEventsGenerator/ShardedGatewayClientEventsGenerator.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SourceGenerators/Shared/Shared.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /SourceGenerators/UserAgentHeaderGenerator/UserAgentHeaderGenerator.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SourceGenerators/WebSocketClientEventsGenerator/WebSocketClientEventsGenerator.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Tests/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Tests/Directory.Build.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Tests/NetCord.Test.Hosting.AspNetCore/InteractionHandler.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Hosting; 2 | 3 | namespace NetCord.Test.Hosting.AspNetCore; 4 | 5 | internal class InteractionHandler(ILogger logger) : IHttpInteractionHandler 6 | { 7 | public ValueTask HandleAsync(Interaction interaction) 8 | { 9 | logger.LogInformation("Interaction received: {Interaction}", interaction); 10 | 11 | return default; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Tests/NetCord.Test.Hosting.AspNetCore/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "NetCord.Test.Hosting.AspNetCore": { 4 | "commandName": "Project", 5 | "launchBrowser": false, 6 | "environmentVariables": { 7 | "ASPNETCORE_ENVIRONMENT": "Development" 8 | }, 9 | "applicationUrl": "https://localhost:57192" 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /Tests/NetCord.Test.Hosting/ConnectHandler.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.Logging; 2 | 3 | using NetCord.Gateway; 4 | using NetCord.Hosting.Gateway; 5 | 6 | namespace NetCord.Test.Hosting; 7 | 8 | [GatewayEvent(nameof(GatewayClient.Connect))] 9 | internal class ConnectHandler(ILogger logger) : IGatewayEventHandler 10 | { 11 | public ValueTask HandleAsync() 12 | { 13 | logger.LogInformation("Connect received"); 14 | 15 | return default; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Tests/NetCord.Test/ApplicationCommands/UserCommands.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Rest; 2 | using NetCord.Services.ApplicationCommands; 3 | 4 | namespace NetCord.Test.ApplicationCommands; 5 | 6 | public class UserCommands : ApplicationCommandModule 7 | { 8 | [UserCommand("Get ID")] 9 | [UserCommand("Get id")] 10 | public Task GetId() 11 | => RespondAsync(InteractionCallback.Message(Context.Target.Id.ToString()!)); 12 | } 13 | -------------------------------------------------------------------------------- /Tests/NetCord.Test/ChannelMenuInteractions.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Rest; 2 | using NetCord.Services.ComponentInteractions; 3 | 4 | namespace NetCord.Test; 5 | 6 | public class ChannelMenuInteractions : ComponentInteractionModule 7 | { 8 | [ComponentInteraction("channels")] 9 | public Task ChannelsAsync() 10 | { 11 | return RespondAsync(InteractionCallback.Message($"You selected: {string.Join(", ", Context.SelectedChannels)}")); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Tests/NetCord.Test/RoleMenuInteractions.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Rest; 2 | using NetCord.Services.ComponentInteractions; 3 | 4 | namespace NetCord.Test; 5 | 6 | public class RoleMenuInteractions : ComponentInteractionModule 7 | { 8 | [ComponentInteraction("roles")] 9 | public Task RolesAsync() 10 | { 11 | return RespondAsync(InteractionCallback.Message($"You selected: {string.Join(", ", Context.SelectedRoles)}")); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Tests/NetCord.Test/UserMenuInteractions.cs: -------------------------------------------------------------------------------- 1 | using NetCord.Rest; 2 | using NetCord.Services.ComponentInteractions; 3 | 4 | namespace NetCord.Test; 5 | 6 | public class UserMenuInteractions : ComponentInteractionModule 7 | { 8 | [ComponentInteraction("users")] 9 | public Task UsersAsync() 10 | { 11 | return RespondAsync(InteractionCallback.Message($"You selected: {string.Join(", ", Context.SelectedUsers)}")); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Tests/NetCord.Test/opus.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NetCordDev/NetCord/feef4ba055ad0ee869a4fa302ea02b252a6d7c1d/Tests/NetCord.Test/opus.dll -------------------------------------------------------------------------------- /global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "9.0.0", 4 | "rollForward": "latestFeature" 5 | } 6 | } 7 | --------------------------------------------------------------------------------