├── Anarchy.Tests
├── Resources
│ ├── poetry.txt
│ ├── image1.png
│ ├── image2.jpg
│ └── FileNames.cs
├── Usings.cs
├── Directory.Build.props
├── Options
│ └── Account.cs
├── appsettings.Example.json
└── Accounts.cs
├── Anarchy
├── nuget-logo.png
├── nuget-logo.psd
├── Commands
│ ├── SlashCommands
│ │ ├── IMentionable.cs
│ │ ├── SlashCommandCategoryAttribute.cs
│ │ ├── SlashParameterChoiceAttribute.cs
│ │ ├── SlashCommandAttribute.cs
│ │ ├── SlashParameterAttribute.cs
│ │ └── SlashCommand.cs
│ └── Command
│ │ ├── Parameter
│ │ ├── CommandParameter.cs
│ │ └── ParameterAttribute.cs
│ │ ├── CommandAttribute.cs
│ │ ├── CommandHandlerConfig.cs
│ │ ├── CommandBase.cs
│ │ └── DiscordCommand.cs
├── REST
│ ├── Invite
│ │ └── Models
│ │ │ ├── InviteType.cs
│ │ │ ├── InviteProperties.cs
│ │ │ └── GuildInvite.cs
│ ├── User
│ │ ├── Settings
│ │ │ ├── DiscordTheme.cs
│ │ │ ├── ExplicitContentFilter.cs
│ │ │ ├── StickerAnimationAvailability.cs
│ │ │ ├── FriendRequestFlags.cs
│ │ │ └── CustomStatus.cs
│ │ ├── User
│ │ │ ├── DiscordUserType.cs
│ │ │ ├── DiscordNitroType.cs
│ │ │ └── DiscordReportReason.cs
│ │ ├── Profile
│ │ │ ├── Hypesquad.cs
│ │ │ ├── MutualGuild.cs
│ │ │ ├── DiscordUserProfileUser.cs
│ │ │ ├── DiscordBadge.cs
│ │ │ ├── DiscordProfileUser.cs
│ │ │ └── UserProfileUpdate.cs
│ │ └── Connections
│ │ │ ├── ConnectedAccountMetadata.cs
│ │ │ ├── ConnectedAccountType.cs
│ │ │ ├── ConnectedAccount.cs
│ │ │ └── ConnectionProperties.cs
│ ├── Channel
│ │ ├── Guild
│ │ │ ├── Stage
│ │ │ │ ├── StagePrivacyLevel.cs
│ │ │ │ └── StageChannel.cs
│ │ │ ├── Guild
│ │ │ │ └── CreationProperties.cs
│ │ │ └── Voice
│ │ │ │ └── VoiceChannelProperties.cs
│ │ ├── Channel
│ │ │ ├── ChannelType.cs
│ │ │ ├── CreationProperties.cs
│ │ │ └── MinimalChannel.cs
│ │ └── Private
│ │ │ └── Group
│ │ │ └── GroupProperties.cs
│ ├── Guild
│ │ ├── Permissions
│ │ │ ├── PermissionOverwriteType.cs
│ │ │ ├── OverwrittenPermissionState.cs
│ │ │ └── DiscordPermissionOverwrite.cs
│ │ ├── Webhook
│ │ │ ├── DiscordWebhookType.cs
│ │ │ ├── Following
│ │ │ │ └── CrosspostChannel.cs
│ │ │ └── Default
│ │ │ │ └── DiscordWebhookProfile.cs
│ │ ├── Models
│ │ │ ├── PremiumTier.cs
│ │ │ ├── DefaultNotifications.cs
│ │ │ └── VerificationLevel.cs
│ │ ├── Settings
│ │ │ ├── ClientNotificationLevel.cs
│ │ │ ├── GuildMuteConfig.cs
│ │ │ ├── DiscordChannelSettings.cs
│ │ │ └── ClientGuildSettings.cs
│ │ ├── Role
│ │ │ └── Models
│ │ │ │ └── RolePositionUpdate.cs
│ │ ├── Threads
│ │ │ ├── ThreadCreationProperties.cs
│ │ │ ├── ThreadTTLs.cs
│ │ │ ├── DiscordThreadMember.cs
│ │ │ └── DiscordThreadMetadata.cs
│ │ ├── Properties
│ │ │ └── CreationProperties.cs
│ │ ├── AuditLog
│ │ │ └── Models
│ │ │ │ ├── Change.cs
│ │ │ │ ├── ActionType.cs
│ │ │ │ ├── Entry.cs
│ │ │ │ └── Filters.cs
│ │ ├── Community
│ │ │ ├── Screening
│ │ │ │ ├── GuildVerificationForm.cs
│ │ │ │ ├── GuildVerificationFormField.cs
│ │ │ │ ├── VerificationFormResponse.cs
│ │ │ │ └── VerificationFormProperties.cs
│ │ │ ├── WelcomeChannelProperties.cs
│ │ │ ├── WelcomeScreen.cs
│ │ │ └── WelcomeChannel.cs
│ │ ├── Member
│ │ │ └── Models
│ │ │ │ ├── MemberPruneProperties.cs
│ │ │ │ ├── PartialGuildMember.cs
│ │ │ │ └── DiscordBan.cs
│ │ └── Guild
│ │ │ ├── BaseGuild.cs
│ │ │ ├── PartialGuild.cs
│ │ │ └── SystemChannelInformation.cs
│ ├── Billing
│ │ ├── DiscordPaymentFlags.cs
│ │ ├── PaymentMethodType.cs
│ │ ├── DiscordPaymentStatus.cs
│ │ ├── PayPalPaymentMethod.cs
│ │ ├── CardPaymentMethod.cs
│ │ ├── BillingAddress.cs
│ │ └── DiscordPayment.cs
│ ├── HTTP
│ │ ├── DiscordReleaseChannel.cs
│ │ ├── Exceptions
│ │ │ ├── DiscordConnectionException.cs
│ │ │ ├── FieldErrorDictionary.cs
│ │ │ ├── DiscordFieldError.cs
│ │ │ ├── InvalidTokenException.cs
│ │ │ └── RateLimitException.cs
│ │ ├── DiscordHttpError.cs
│ │ ├── DiscordAttachmentFile.cs
│ │ └── DiscordHttpResponse.cs
│ ├── Message
│ │ ├── Message
│ │ │ ├── Stickers
│ │ │ │ ├── StickerFormatType.cs
│ │ │ │ └── DiscordSticker.cs
│ │ │ ├── Components
│ │ │ │ ├── MessageComponentType.cs
│ │ │ │ ├── Input
│ │ │ │ │ ├── MessageButtonStyle.cs
│ │ │ │ │ ├── MessageInputComponent.cs
│ │ │ │ │ ├── SelectMenuOption.cs
│ │ │ │ │ ├── ButtonComponent.cs
│ │ │ │ │ └── SelectMenuComponent.cs
│ │ │ │ ├── MessageComponent.cs
│ │ │ │ └── RowComponent.cs
│ │ │ ├── Properties
│ │ │ │ ├── MessageAttachmentFilter.cs
│ │ │ │ └── MessageFilters.cs
│ │ │ ├── MessageFlags.cs
│ │ │ ├── MessageAuthor.cs
│ │ │ ├── MessageReference.cs
│ │ │ ├── MessageType.cs
│ │ │ ├── DeletedMessage.cs
│ │ │ └── DiscordAttachment.cs
│ │ └── Reaction
│ │ │ ├── ReactionQuery.cs
│ │ │ └── MessageReaction.cs
│ ├── Subscriptions
│ │ ├── Subscriptions
│ │ │ ├── DiscordSubscriptionStatus.cs
│ │ │ ├── AdditionalSubscriptionPlan.cs
│ │ │ ├── DiscordSubscription.cs
│ │ │ ├── SubscriptionPlan.cs
│ │ │ └── DiscordActiveSubscription.cs
│ │ └── Nitro
│ │ │ ├── DiscordNitroSubType.cs
│ │ │ ├── DiscordBoostSlot.cs
│ │ │ ├── DiscordGuildSubscription.cs
│ │ │ └── DiscordNitroSubTypes.cs
│ ├── CDN
│ │ ├── DiscordCDNImageFormat.cs
│ │ └── CDNEndpoint.cs
│ ├── Relationships
│ │ └── Models
│ │ │ ├── RelationshipType.cs
│ │ │ └── DiscordRelationship.cs
│ ├── Interactions
│ │ ├── InteractionCallbackType.cs
│ │ ├── SlashCommands
│ │ │ ├── CommandOptionType.cs
│ │ │ ├── CommandOptionChoice.cs
│ │ │ ├── ApplicationCommandOption.cs
│ │ │ └── ApplicationCommandProperties.cs
│ │ ├── InteractionResponse.cs
│ │ └── InteractionExtensions.cs
│ ├── Discovery
│ │ ├── DiscoveryCategory.cs
│ │ ├── GuildQueryOptions.cs
│ │ └── GuildQueryResult.cs
│ ├── Embed
│ │ ├── EmbedError.cs
│ │ ├── EmbedException.cs
│ │ ├── Image.cs
│ │ ├── Video.cs
│ │ ├── Field.cs
│ │ ├── Footer.cs
│ │ └── Author.cs
│ ├── OAuth2
│ │ ├── Client
│ │ │ ├── OAuth2Exception.cs
│ │ │ ├── OAuth2HttpError.cs
│ │ │ └── DiscordOAuth2Authorization.cs
│ │ └── Models
│ │ │ ├── DiscordBotAuthProperties.cs
│ │ │ └── AuthorizedApp.cs
│ ├── Gifts
│ │ ├── DiscordNitroGift.cs
│ │ ├── PurchaseOptions.cs
│ │ └── DiscordGift.cs
│ ├── DiscordConfig.cs
│ ├── Emoji
│ │ └── Models
│ │ │ ├── UpdatedEventArgs.cs
│ │ │ ├── EmojiProperties.cs
│ │ │ └── EmojiContainer.cs
│ ├── LockedDiscordConfig.cs
│ └── Voice
│ │ └── VoiceRegion.cs
├── WebSockets
│ ├── Media
│ │ ├── Codecs
│ │ │ ├── CodecType.cs
│ │ │ ├── Opus
│ │ │ │ ├── AudioApplication.cs
│ │ │ │ ├── OpusSignal.cs
│ │ │ │ ├── OpusApplication.cs
│ │ │ │ ├── OpusCtl.cs
│ │ │ │ ├── OpusError.cs
│ │ │ │ ├── OpusException.cs
│ │ │ │ └── OpusConverter.cs
│ │ │ ├── VideoMediaCodec.cs
│ │ │ └── MediaCodec.cs
│ │ ├── Media
│ │ │ ├── MediaConnectionState.cs
│ │ │ ├── Payloads
│ │ │ │ ├── SSRCUpdate.cs
│ │ │ │ ├── DiscordSSRC.cs
│ │ │ │ ├── MediaProtocolData.cs
│ │ │ │ ├── DiscordMediaOpcode.cs
│ │ │ │ ├── MediaCodecSelection.cs
│ │ │ │ └── MediaProtocolSelection.cs
│ │ │ ├── MediaPacketEventArgs.cs
│ │ │ ├── Auth
│ │ │ │ ├── DiscordSessionDescription.cs
│ │ │ │ ├── DiscordMediaIdentify.cs
│ │ │ │ └── DiscordMediaReady.cs
│ │ │ └── DiscordMediaCloseCode.cs
│ │ ├── Livestreaming
│ │ │ ├── DiscordLivestreamError.cs
│ │ │ ├── StreamSSRC.cs
│ │ │ ├── LivestreamDisconnectEventArgs.cs
│ │ │ └── StreamKey.cs
│ │ ├── Voice
│ │ │ ├── VoiceConnectionProperties.cs
│ │ │ └── Speaking
│ │ │ │ ├── DiscordSpeakingFlags.cs
│ │ │ │ ├── DiscordVoicePacket.cs
│ │ │ │ ├── DiscordSpeakingRequest.cs
│ │ │ │ └── DiscordSpeakingState.cs
│ │ └── RTP
│ │ │ └── SodiumException.cs
│ ├── Gateway
│ │ ├── General
│ │ │ ├── GatewayConnectionState.cs
│ │ │ ├── LogoutEventArgs.cs
│ │ │ ├── GatewayCloseCode.cs
│ │ │ └── Opcode.cs
│ │ ├── Interaction
│ │ │ ├── DiscordInteractionType.cs
│ │ │ ├── Forms
│ │ │ │ ├── ComponentFormInput.cs
│ │ │ │ ├── FormSelectMenuEventArgs.cs
│ │ │ │ ├── ComponentFormSelectMenu.cs
│ │ │ │ └── ComponentFormButton.cs
│ │ │ ├── DiscordInteractionEventArgs.cs
│ │ │ ├── SlashCommandArgument.cs
│ │ │ └── DiscordInteractionData.cs
│ │ ├── Guild
│ │ │ ├── Member
│ │ │ │ ├── Query
│ │ │ │ │ ├── MemberListQueryOptions.cs
│ │ │ │ │ ├── GuildMemberQuery.cs
│ │ │ │ │ ├── GuildMembersEventArgs.cs
│ │ │ │ │ └── GuildMemberList.cs
│ │ │ │ ├── List
│ │ │ │ │ ├── MemberListGroup.cs
│ │ │ │ │ ├── MemberListItem.cs
│ │ │ │ │ ├── MemberListUpdateOperation.cs
│ │ │ │ │ └── DiscordMemberListUpdate.cs
│ │ │ │ ├── MemberEventArgs.cs
│ │ │ │ ├── MemberRemovedEventArgs.cs
│ │ │ │ └── BanUpdateEventArgs.cs
│ │ │ ├── Threads
│ │ │ │ ├── ThreadEventArgs.cs
│ │ │ │ └── ThreadMembersEventArgs.cs
│ │ │ └── Models
│ │ │ │ ├── GuildUnavailableEventArgs.cs
│ │ │ │ ├── GuildEventArgs.cs
│ │ │ │ ├── UnavailableGuild.cs
│ │ │ │ └── SocketGuildEventArgs.cs
│ │ ├── Presence
│ │ │ ├── Activity
│ │ │ │ ├── ActivityType.cs
│ │ │ │ ├── Properties
│ │ │ │ │ ├── StreamActivityProperties.cs
│ │ │ │ │ ├── ActivityProperties.cs
│ │ │ │ │ └── GameActivityProperties.cs
│ │ │ │ ├── User
│ │ │ │ │ ├── DiscordListeningActivity.cs
│ │ │ │ │ ├── DiscordActivity.cs
│ │ │ │ │ ├── CustomStatusActivity.cs
│ │ │ │ │ └── DiscordGameActivity.cs
│ │ │ │ └── TimestampProperties.cs
│ │ │ └── Presence
│ │ │ │ ├── UpdatedEventArgs.cs
│ │ │ │ ├── ActiveSessionPlatforms.cs
│ │ │ │ └── PresenceProperties.cs
│ │ ├── Media
│ │ │ ├── Go Live
│ │ │ │ ├── GoLiveStreamKey.cs
│ │ │ │ ├── StreamUpdate.cs
│ │ │ │ ├── GoLiveDelete.cs
│ │ │ │ ├── GoLiveCreate.cs
│ │ │ │ ├── StartStream.cs
│ │ │ │ └── GoLiveUpdate.cs
│ │ │ ├── Voice
│ │ │ │ ├── VoiceStateEventArgs.cs
│ │ │ │ ├── VoiceConnectEventArgs.cs
│ │ │ │ ├── VoiceChannelSpeakingEventArgs.cs
│ │ │ │ ├── VoiceClientDictionary.cs
│ │ │ │ ├── VoiceStateDictionary.cs
│ │ │ │ ├── DiscordVoiceStateContainer.cs
│ │ │ │ └── VoiceDisconnectEventArgs.cs
│ │ │ └── DiscordMediaServer.cs
│ │ ├── User
│ │ │ ├── DiscordSettingsEventArgs.cs
│ │ │ ├── RequiredActionEventArgs.cs
│ │ │ ├── RemovedRelationshipEventArgs.cs
│ │ │ ├── UserEventArgs.cs
│ │ │ └── RelationshipEventArgs.cs
│ │ ├── Role
│ │ │ ├── RoleDeletedEventArgs.cs
│ │ │ ├── RoleEventArgs.cs
│ │ │ ├── DeletedRole.cs
│ │ │ └── RoleUpdate.cs
│ │ ├── Session
│ │ │ ├── DiscordShard.cs
│ │ │ ├── DiscordSessionsEventArgs.cs
│ │ │ ├── DiscordSessionClientInfo.cs
│ │ │ ├── DiscordSession.cs
│ │ │ ├── DiscordGatewayIntent.cs
│ │ │ ├── Auth
│ │ │ │ └── Resume.cs
│ │ │ ├── Extensions.cs
│ │ │ └── GatewayIntentBundle.cs
│ │ ├── Channel
│ │ │ ├── Private
│ │ │ │ ├── CallUpdateEventArgs.cs
│ │ │ │ ├── RingingEventArgs.cs
│ │ │ │ ├── GatewayPrivateChannelExtensions.cs
│ │ │ │ ├── ChannelRecipientEventArgs.cs
│ │ │ │ └── DiscordCall.cs
│ │ │ ├── ChannelEventArgs.cs
│ │ │ └── Unread
│ │ │ │ ├── ChannelUnreadMessages.cs
│ │ │ │ ├── UnreadMessagesEventArgs.cs
│ │ │ │ └── GuildUnreadMessages.cs
│ │ ├── Subscriptions
│ │ │ └── NitroBoostEventArgs.cs
│ │ ├── Gifts
│ │ │ ├── GiftCodeCreatedEventArgs.cs
│ │ │ ├── EntitlementEventArgs.cs
│ │ │ └── GiftCodeUpdatedEventArgs.cs
│ │ ├── Message
│ │ │ ├── MessageDeletedEventArgs.cs
│ │ │ ├── MessageEventArgs.cs
│ │ │ ├── ReactionEventArgs.cs
│ │ │ └── UserTypingEventArgs.cs
│ │ ├── DiscordSocketConfig.cs
│ │ ├── LockedSocketConfig.cs
│ │ └── Invite
│ │ │ └── InviteDeletedEventArgs.cs
│ ├── DiscordWebSocketCloseEventArgs.cs
│ ├── DiscordWebSocketMessage.cs
│ └── DiscordWebSocketRequest.cs
├── Directory.Build.props
└── Local
│ ├── Controllable
│ ├── Controllable.cs
│ └── Extensions.cs
│ ├── DiscordParameter.cs
│ └── DiscordImageMediaTypes.cs
├── Examples
├── TicTacToe
│ ├── SquareState.cs
│ ├── Directory.Build.props
│ ├── TicTacToe.csproj
│ └── Program.cs
├── AntiRaid
│ ├── Directory.Build.props
│ └── AntiRaid.csproj
├── MusicBot
│ ├── Directory.Build.props
│ ├── MusicBot.csproj
│ ├── Commands
│ │ └── SkipCommand.cs
│ └── AudioTrack.cs
├── VCSpammer
│ ├── Directory.Build.props
│ └── VCSpammer.csproj
├── NitroSniper
│ ├── Directory.Build.props
│ └── NitroSniper.csproj
├── GuildDuplicator
│ ├── Directory.Build.props
│ └── GuildDuplicator.csproj
├── MessageListener
│ ├── Directory.Build.props
│ └── MessageListener.csproj
└── NicknameAnimation
│ ├── Directory.Build.props
│ └── NicknameAnimation.csproj
├── Anarchy.Puppeteer
├── DiscordResponse.cs
└── Anarchy.Puppeteer.csproj
└── README.md
/Anarchy.Tests/Resources/poetry.txt:
--------------------------------------------------------------------------------
1 | The quick brown fox jumps over the lazy dog.
--------------------------------------------------------------------------------
/Anarchy.Tests/Usings.cs:
--------------------------------------------------------------------------------
1 | global using Microsoft.VisualStudio.TestTools.UnitTesting;
--------------------------------------------------------------------------------
/Anarchy/nuget-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/not-ilinked/Anarchy/HEAD/Anarchy/nuget-logo.png
--------------------------------------------------------------------------------
/Anarchy/nuget-logo.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/not-ilinked/Anarchy/HEAD/Anarchy/nuget-logo.psd
--------------------------------------------------------------------------------
/Anarchy.Tests/Resources/image1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/not-ilinked/Anarchy/HEAD/Anarchy.Tests/Resources/image1.png
--------------------------------------------------------------------------------
/Anarchy.Tests/Resources/image2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/not-ilinked/Anarchy/HEAD/Anarchy.Tests/Resources/image2.jpg
--------------------------------------------------------------------------------
/Anarchy/Commands/SlashCommands/IMentionable.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Commands
2 | {
3 | public interface IMentionable
4 | {
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/Anarchy/REST/Invite/Models/InviteType.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum InviteType
4 | {
5 | Guild,
6 | Group
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Anarchy/REST/User/Settings/DiscordTheme.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum DiscordTheme
4 | {
5 | Light,
6 | Dark
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Codecs/CodecType.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Media
2 | {
3 | internal enum CodecType
4 | {
5 | Audio,
6 | Video
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Anarchy/REST/Channel/Guild/Stage/StagePrivacyLevel.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum StagePrivacyLevel
4 | {
5 | Public,
6 | GuildOnly
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Permissions/PermissionOverwriteType.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum PermissionOverwriteType
4 | {
5 | Role,
6 | Member
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Webhook/DiscordWebhookType.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum DiscordWebhookType
4 | {
5 | Default = 1,
6 | ChannelFollower
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Anarchy/REST/User/User/DiscordUserType.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum DiscordUserType
4 | {
5 | User,
6 | Bot,
7 | Webhook
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Examples/TicTacToe/SquareState.cs:
--------------------------------------------------------------------------------
1 | namespace TicTacToe
2 | {
3 | public enum SquareState
4 | {
5 | Neutral,
6 | Challenger,
7 | Challengee
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Anarchy/REST/Billing/DiscordPaymentFlags.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord
4 | {
5 | [Flags]
6 | public enum DiscordPaymentFlags
7 | {
8 | Gift = 1
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Anarchy/REST/HTTP/DiscordReleaseChannel.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum DiscordReleaseChannel
4 | {
5 | Stable,
6 | Canary,
7 | PTB
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Anarchy/REST/Billing/PaymentMethodType.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum PaymentMethodType
4 | {
5 | Card = 1,
6 | PayPal,
7 | PaySafeCard = 7
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Models/PremiumTier.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum GuildPremiumTier
4 | {
5 | None,
6 | Tier1,
7 | Tier2,
8 | Tier3
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Anarchy/REST/Message/Message/Stickers/StickerFormatType.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum StickerFormatType
4 | {
5 | PNG,
6 | APNG,
7 | LOTTIE
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Anarchy/REST/User/Profile/Hypesquad.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum Hypesquad
4 | {
5 | None,
6 | Bravery,
7 | Brilliance,
8 | Balance
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Anarchy/REST/Subscriptions/Subscriptions/DiscordSubscriptionStatus.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum DiscordSubscriptionStatus
4 | {
5 | Active = 1,
6 | Cancelled = 3
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Permissions/OverwrittenPermissionState.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum OverwrittenPermissionState
4 | {
5 | Allow,
6 | Inherit,
7 | Deny
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Anarchy/REST/Message/Message/Components/MessageComponentType.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum MessageComponentType
4 | {
5 | Row = 1,
6 | Button,
7 | Select
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Codecs/Opus/AudioApplication.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Media
2 | {
3 | public enum AudioApplication : int
4 | {
5 | Voice,
6 | Music,
7 | Mixed
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Models/DefaultNotifications.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum GuildDefaultNotifications
4 | {
5 | AllMessages,
6 | OnlyMentions,
7 | Nothing
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Settings/ClientNotificationLevel.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum ClientNotificationLevel
4 | {
5 | AllMessages,
6 | OnlyMentions,
7 | None
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Anarchy/REST/User/Settings/ExplicitContentFilter.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum ExplicitContentFilter
4 | {
5 | DoNotScan,
6 | MyFriendsAreNice,
7 | KeepMeSafe
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Anarchy/REST/User/User/DiscordNitroType.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum DiscordNitroType
4 | {
5 | None,
6 | Classic,
7 | Nitro,
8 | Basic
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Codecs/Opus/OpusSignal.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Media
2 | {
3 | internal enum OpusSignal
4 | {
5 | Auto = -1000,
6 | Voice = 3001,
7 | Music = 3002,
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Anarchy/REST/Billing/DiscordPaymentStatus.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum DiscordPaymentStatus
4 | {
5 | Pending,
6 | Success,
7 | Failed,
8 | Refunded = 4
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Anarchy/REST/CDN/DiscordCDNImageFormat.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum DiscordCDNImageFormat
4 | {
5 | Any,
6 | JPG,
7 | PNG,
8 | WebP,
9 | GIF
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Anarchy/REST/User/Settings/StickerAnimationAvailability.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum StickerAnimationAvailability
4 | {
5 | Always,
6 | OnInteraction,
7 | Never
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Models/VerificationLevel.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum GuildVerificationLevel
4 | {
5 | None,
6 | Low,
7 | Medium,
8 | High,
9 | Highest
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/General/GatewayConnectionState.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Gateway
2 | {
3 | public enum GatewayConnectionState
4 | {
5 | NotConnected,
6 | Connecting,
7 | Connected
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Interaction/DiscordInteractionType.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Gateway
2 | {
3 | public enum DiscordInteractionType
4 | {
5 | Ping = 1,
6 | ApplicationCommand,
7 | MessageComponent
8 | }
9 | }
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Codecs/Opus/OpusApplication.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Media
2 | {
3 | internal enum OpusApplication
4 | {
5 | Voice = 2048,
6 | MusicOrMixed = 2049,
7 | LowLatency = 2051
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Anarchy/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | ..\.obj\Anarchy
4 | ..\.obj\Anarchy
5 |
6 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Media/MediaConnectionState.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Media
2 | {
3 | public enum MediaConnectionState
4 | {
5 | NotConnected,
6 | Connecting,
7 | Connected,
8 | Ready
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Guild/Member/Query/MemberListQueryOptions.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Gateway
2 | {
3 | public class MemberListQueryOptions
4 | {
5 | public int Offset { get; set; }
6 | public int Count { get; set; }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Anarchy/REST/Relationships/Models/RelationshipType.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum RelationshipType
4 | {
5 | None,
6 | Friends,
7 | Blocked,
8 | IncomingRequest,
9 | OutgoingRequest
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Anarchy.Tests/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | ..\.obj\Anarchy.Tests
4 | ..\.obj\Anarchy.Tests
5 |
6 |
--------------------------------------------------------------------------------
/Anarchy/REST/Message/Message/Components/Input/MessageButtonStyle.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum MessageButtonStyle
4 | {
5 | Primary = 1,
6 | Secondary,
7 | Success,
8 | Danger,
9 | Link
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Examples/AntiRaid/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | ..\..\.obj\AntiRaidt
4 | ..\..\.obj\AntiRaid
5 |
6 |
--------------------------------------------------------------------------------
/Examples/MusicBot/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | ..\..\.obj\MusicBot
4 | ..\..\.obj\MusicBot
5 |
6 |
--------------------------------------------------------------------------------
/Anarchy/REST/User/User/DiscordReportReason.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum DiscordReportReason
4 | {
5 | IllegalContent,
6 | Harassment,
7 | SpamOrPhishingLinks,
8 | SelfHarm,
9 | NsfwContent
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Examples/TicTacToe/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | ..\..\.obj\TicTacToe
4 | ..\..\.obj\TicTacToe
5 |
6 |
--------------------------------------------------------------------------------
/Examples/VCSpammer/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | ..\..\.obj\VCSpammer
4 | ..\..\.obj\VCSpammer
5 |
6 |
--------------------------------------------------------------------------------
/Anarchy/REST/Billing/PayPalPaymentMethod.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class PayPalPaymentMethod : PaymentMethod
6 | {
7 | [JsonProperty("email")]
8 | public string Email { get; private set; }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Anarchy/REST/Message/Message/Properties/MessageAttachmentFilter.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum MessageAttachmentFilter
4 | {
5 | Link,
6 | Embed,
7 | File,
8 | Video,
9 | Image,
10 | Sound
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Examples/NitroSniper/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | ..\..\.obj\NitroSniper
4 | ..\..\.obj\NitroSniper
5 |
6 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Webhook/Following/CrosspostChannel.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class CrosspostChannel : MinimalTextChannel
6 | {
7 | [JsonProperty("name")]
8 | public string Name { get; private set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/Anarchy/REST/Message/Message/Components/MessageComponent.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class MessageComponent
6 | {
7 | [JsonProperty("type")]
8 | public MessageComponentType Type { get; protected set; }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Media/Payloads/SSRCUpdate.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Media
4 | {
5 | internal class SSRCUpdate : DiscordSSRC
6 | {
7 | [JsonProperty("user_id")]
8 | public ulong UserId { get; private set; }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Examples/GuildDuplicator/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | ..\..\.obj\GuildDuplicator
4 | ..\..\.obj\GuildDuplicator
5 |
6 |
--------------------------------------------------------------------------------
/Examples/MessageListener/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | ..\..\.obj\MessageListener
4 | ..\..\.obj\MessageListener
5 |
6 |
--------------------------------------------------------------------------------
/Examples/NicknameAnimation/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | ..\..\.obj\NicknameAnimation
4 | ..\..\.obj\NicknameAnimation
5 |
6 |
--------------------------------------------------------------------------------
/Anarchy/REST/Interactions/InteractionCallbackType.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum InteractionCallbackType
4 | {
5 | Pong = 1,
6 | RespondWithMessage = 4,
7 | DelayedMessage,
8 | DelayedMessageUpdate,
9 | UpdateMessage
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Presence/Activity/ActivityType.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Gateway
2 | {
3 | public enum ActivityType
4 | {
5 | Game,
6 | Streaming,
7 | Listening,
8 | Watching,
9 | CustomStatus,
10 | IdkWhatThisIs
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Livestreaming/DiscordLivestreamError.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Media
2 | {
3 | public enum DiscordLivestreamError
4 | {
5 | Unknown,
6 | Unauthorized,
7 | StreamNotFound,
8 | StreamEnded,
9 | UserRequested
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Anarchy.Tests/Resources/FileNames.cs:
--------------------------------------------------------------------------------
1 | namespace Anarchy.Resources;
2 |
3 | internal static class Filenames
4 | {
5 | public const string Image1 = @".\Resources\image1.png";
6 | public const string Image2 = @".\Resources\image2.jpg";
7 | public const string PoetryTxt = @".\Resources\poetry.txt";
8 | }
--------------------------------------------------------------------------------
/Anarchy/REST/HTTP/Exceptions/DiscordConnectionException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord
4 | {
5 | public class DiscordConnectionException : Exception
6 | {
7 | public DiscordConnectionException() : base("Failed to connect to Discord")
8 | { }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Codecs/Opus/OpusCtl.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Media
2 | {
3 | internal enum OpusCtl
4 | {
5 | SetBitrate = 4002,
6 | SetBandwidth = 4008,
7 | SetInbandFEC = 4012,
8 | SetPacketLossPercent = 4014,
9 | SetSignal = 4024
10 | }
11 | }
--------------------------------------------------------------------------------
/Anarchy/REST/Channel/Guild/Guild/CreationProperties.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | internal class GuildChannelCreationProperties : ChannelCreationProperties
6 | {
7 | [JsonProperty("parent_id")]
8 | public ulong? ParentId { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/Anarchy/REST/HTTP/Exceptions/FieldErrorDictionary.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace Discord
4 | {
5 | public class FieldErrorDictionary : Dictionary
6 | {
7 | public IReadOnlyList Errors { get; set; }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Voice/VoiceConnectionProperties.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Media
2 | {
3 | public class VoiceConnectionProperties
4 | {
5 | public bool? Muted { get; set; }
6 | public bool? Deafened { get; set; }
7 | public bool? Video { get; set; }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Anarchy/REST/Discovery/DiscoveryCategory.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum DiscoveryCategory
4 | {
5 | Gaming = 1,
6 | Music,
7 | ScienceAndTech = 5,
8 | Education,
9 | Anime = 16,
10 | Movies,
11 | ContentCreator = 35
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Anarchy/REST/Message/Message/MessageFlags.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum MessageFlags
4 | {
5 | Crossposted = 1 << 0,
6 | IsCrosspost = 1 << 1,
7 | SuppressEmbeds = 1 << 2,
8 | SourceMessageDeleted = 1 << 3,
9 | Urgent = 1 << 4
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Media/Go Live/GoLiveStreamKey.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Media
4 | {
5 | // Opcode: EndGoLive
6 | internal class GoLiveStreamKey
7 | {
8 | [JsonProperty("stream_key")]
9 | public string StreamKey { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/RTP/SodiumException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Media
4 | {
5 | internal class SodiumException : Exception
6 | {
7 | // libsodium might have return codes that go more in depth than 0 or -1, but i haven't been able to find that anywhere
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Media/Go Live/StreamUpdate.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Media
4 | {
5 | // Opcode: GoLiveUpdate
6 | internal class StreamUpdate : GoLiveStreamKey
7 | {
8 | [JsonProperty("paused")]
9 | public bool Paused { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Anarchy/REST/Embed/EmbedError.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum EmbedError
4 | {
5 | TitleTooLong,
6 | DescriptionTooLong,
7 | TooManyFields,
8 | FieldNameTooLong,
9 | FieldContentTooLong,
10 | FooterTextTooLong,
11 | AuthorNameToolong
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Voice/Speaking/DiscordSpeakingFlags.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Media
4 | {
5 | [Flags]
6 | public enum DiscordSpeakingFlags
7 | {
8 | NotSpeaking = 0,
9 | Microphone = 1 << 0,
10 | Soundshare = 1 << 1,
11 | Priority = 1 << 2
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Anarchy/REST/Discovery/GuildQueryOptions.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public class GuildQueryOptions
4 | {
5 | public string Query { get; set; }
6 | public int Limit { get; set; } = 20;
7 | public int Offset { get; set; }
8 | public DiscoveryCategory? Category { get; set; }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Anarchy/REST/Message/Reaction/ReactionQuery.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public class ReactionQuery
4 | {
5 | public string ReactionName { get; set; }
6 | public ulong? ReactionId { get; set; }
7 |
8 | public uint Limit { get; set; } = 25;
9 | public ulong AfterId { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/General/LogoutEventArgs.cs:
--------------------------------------------------------------------------------
1 | using Discord.WebSockets;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class LogoutEventArgs : DiscordWebSocketCloseEventArgs
6 | {
7 | public LogoutEventArgs(GatewayCloseCode error, string reason) : base((int) error, reason)
8 | { }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Media/Go Live/GoLiveDelete.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Media
4 | {
5 | internal class GoLiveDelete : GoLiveStreamKey
6 | {
7 | // stream_not_found, stream_ended
8 | [JsonProperty("reason")]
9 | public string RawReason { get; private set; }
10 | }
11 | }
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Role/Models/RolePositionUpdate.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class RolePositionUpdate
6 | {
7 | [JsonProperty("id")]
8 | public ulong Id { get; set; }
9 |
10 | [JsonProperty("position")]
11 | public int Position { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Interaction/Forms/ComponentFormInput.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Gateway
2 | {
3 | public abstract class ComponentFormInput
4 | {
5 | internal string Id { get; } = DiscordComponentForm.RandomString(8);
6 | internal abstract void Handle(DiscordSocketClient client, DiscordInteraction interaction);
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Anarchy/REST/Interactions/SlashCommands/CommandOptionType.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum CommandOptionType
4 | {
5 | SubCommand = 1,
6 | SubCommandGroup,
7 | String,
8 | Integer,
9 | Boolean,
10 | User,
11 | Channel,
12 | Role,
13 | Mentionable
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Anarchy/REST/Interactions/SlashCommands/CommandOptionChoice.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class CommandOptionChoice
6 | {
7 | [JsonProperty("name")]
8 | public string Name { get; set; }
9 |
10 | [JsonProperty("value")]
11 | public object Value { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Media/Voice/VoiceStateEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Gateway
2 | {
3 | public class VoiceStateEventArgs
4 | {
5 | public DiscordVoiceState State { get; private set; }
6 |
7 | internal VoiceStateEventArgs(DiscordVoiceState state)
8 | {
9 | State = state;
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Anarchy.Tests/Options/Account.cs:
--------------------------------------------------------------------------------
1 | namespace Anarchy.Options;
2 |
3 | internal sealed class Account
4 | {
5 | public Account(AccountOptions options)
6 | {
7 | Options = options;
8 | Clients = new Clients(options.Connection);
9 | }
10 |
11 | public Clients Clients { get; set; }
12 | public AccountOptions Options { get; set; }
13 | }
--------------------------------------------------------------------------------
/Anarchy/REST/Embed/EmbedException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord
4 | {
5 | public class EmbedException : Exception
6 | {
7 | public EmbedError Error { get; private set; }
8 |
9 | internal EmbedException(EmbedError error) : base(error.ToString())
10 | {
11 | Error = error;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Anarchy/REST/HTTP/Exceptions/DiscordFieldError.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class DiscordFieldError
6 | {
7 | [JsonProperty("code")]
8 | public string Code { get; private set; }
9 |
10 | [JsonProperty("message")]
11 | public string Message { get; private set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Anarchy/REST/OAuth2/Client/OAuth2Exception.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord
4 | {
5 | public class OAuth2Exception : Exception
6 | {
7 | public string Error { get; }
8 |
9 | internal OAuth2Exception(OAuth2HttpError err) : base(err.Description)
10 | {
11 | Error = err.Error;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Settings/GuildMuteConfig.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class GuildMuteConfig
6 | {
7 | [JsonProperty("end_time")]
8 | public int? EndTime { get; set; }
9 |
10 | [JsonProperty("selected_time_window")]
11 | public int SelectedTimeWindow { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Guild/Threads/ThreadEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class ThreadEventArgs : EventArgs
6 | {
7 | public DiscordThread Thread { get; }
8 |
9 | public ThreadEventArgs(DiscordThread thread)
10 | {
11 | Thread = thread;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/User/DiscordSettingsEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public class DiscordSettingsEventArgs
4 | {
5 | public DiscordUserSettings Settings { get; private set; }
6 |
7 | public DiscordSettingsEventArgs(DiscordUserSettings update)
8 | {
9 | Settings = update;
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/User/RequiredActionEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord.Gateway
5 | {
6 | public class RequiredActionEventArgs : EventArgs
7 | {
8 | // REQUIRE_VERIFIED_PHONE
9 | [JsonProperty("required_action")]
10 | public string Action { get; private set; }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Anarchy/REST/OAuth2/Client/OAuth2HttpError.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | internal class OAuth2HttpError
6 | {
7 | [JsonProperty("error")]
8 | public string Error { get; private set; }
9 |
10 | [JsonProperty("error_description")]
11 | public string Description { get; private set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Guild/Member/List/MemberListGroup.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class MemberListGroup
6 | {
7 | [JsonProperty("id")]
8 | public string Id { get; private set; }
9 |
10 | [JsonProperty("count")]
11 | public int Count { get; private set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Codecs/Opus/OpusError.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Media
2 | {
3 | internal enum OpusError
4 | {
5 | OK = 0,
6 | BadArg = -1,
7 | BufferTooSmall = -2,
8 | InternalError = -3,
9 | InvalidPacket = -4,
10 | Unimplemented = -5,
11 | InvalidState = -6,
12 | AllocFail = -7
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Anarchy.Puppeteer/DiscordResponse.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using Newtonsoft.Json.Linq;
3 |
4 | namespace Discord
5 | {
6 | internal class DiscordResponse
7 | {
8 | [JsonProperty("status")]
9 | public int Status { get; private set; }
10 |
11 | [JsonProperty("body")]
12 | public JToken Body { get; private set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Anarchy/REST/Subscriptions/Subscriptions/AdditionalSubscriptionPlan.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class AdditionalSubscriptionPlan
6 | {
7 | [JsonProperty("plan_id")]
8 | public ulong Id { get; set; }
9 |
10 | [JsonProperty("quantity")]
11 | public int Quantity { get; set; } = 1;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Role/RoleDeletedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class RoleDeletedEventArgs : EventArgs
6 | {
7 | public DeletedRole Role { get; private set; }
8 |
9 | internal RoleDeletedEventArgs(DeletedRole role)
10 | {
11 | Role = role;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Session/DiscordShard.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public class DiscordShard
4 | {
5 | public uint Index { get; set; }
6 | public uint Total { get; set; }
7 |
8 | public DiscordShard(uint index, uint total)
9 | {
10 | Index = index;
11 | Total = total;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Anarchy/REST/Interactions/InteractionResponse.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | internal class InteractionResponse
6 | {
7 | [JsonProperty("type")]
8 | public InteractionCallbackType Type { get; set; }
9 |
10 | [JsonProperty("data")]
11 | public InteractionResponseProperties Data { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Channel/Private/CallUpdateEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class CallUpdateEventArgs : EventArgs
6 | {
7 | public DiscordCall Call { get; private set; }
8 |
9 | public CallUpdateEventArgs(DiscordCall call)
10 | {
11 | Call = call;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Codecs/Opus/OpusException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Media
4 | {
5 | internal class OpusException : Exception
6 | {
7 | public OpusError Error { get; private set; }
8 |
9 | public OpusException(OpusError error) : base(error.ToString())
10 | {
11 | Error = error;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Threads/ThreadCreationProperties.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | internal class ThreadCreationProperties : ThreadProperties
6 | {
7 | [JsonProperty("location")]
8 | public string Location { get; set; }
9 |
10 | [JsonProperty("type")]
11 | public ChannelType Type { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Guild/Member/MemberEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class GuildMemberEventArgs : EventArgs
6 | {
7 | public GuildMember Member { get; private set; }
8 |
9 | internal GuildMemberEventArgs(GuildMember member)
10 | {
11 | Member = member;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Anarchy/REST/Message/Message/Components/Input/MessageInputComponent.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class MessageInputComponent : MessageComponent
6 | {
7 | [JsonProperty("custom_id")]
8 | public string Id { get; set; }
9 |
10 | [JsonProperty("disabled")]
11 | public bool Disabled { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Subscriptions/NitroBoostEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class NitroBoostEventArgs : EventArgs
6 | {
7 | public DiscordBoostSlot Slot { get; private set; }
8 |
9 | internal NitroBoostEventArgs(DiscordBoostSlot boost)
10 | {
11 | Slot = boost;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Gifts/GiftCodeCreatedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class GiftCodeCreatedEventArgs : Controllable
6 | {
7 | [JsonProperty("sku_id")]
8 | public ulong SkuId { get; private set; }
9 |
10 | [JsonProperty("code")]
11 | public string Code { get; private set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Anarchy/REST/HTTP/Exceptions/InvalidTokenException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord
4 | {
5 | public class InvalidTokenException : Exception
6 | {
7 | public string Token { get; private set; }
8 |
9 | public InvalidTokenException(string token) : base("An invalid token was encountered")
10 | {
11 | Token = token;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Guild/Member/MemberRemovedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class MemberRemovedEventArgs : EventArgs
6 | {
7 | public PartialGuildMember Member { get; private set; }
8 |
9 | public MemberRemovedEventArgs(PartialGuildMember member)
10 | {
11 | Member = member;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Media/Go Live/GoLiveCreate.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Media
4 | {
5 | internal class GoLiveCreate : GoLiveUpdate
6 | {
7 | [JsonProperty("session_id")]
8 | public string SessionId { get; private set; }
9 |
10 | [JsonProperty("rtc_server_id")]
11 | public ulong RtcServerId { get; private set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Codecs/VideoMediaCodec.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Media
4 | {
5 | internal class VideoMediaCodec : MediaCodec
6 | {
7 | public VideoMediaCodec()
8 | {
9 | Type = CodecType.Video;
10 | }
11 |
12 | [JsonProperty("rtx_payload_type")]
13 | public int RtxPayloadType { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Guild/Models/GuildUnavailableEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class GuildUnavailableEventArgs : EventArgs
6 | {
7 | public UnavailableGuild Guild { get; private set; }
8 |
9 | public GuildUnavailableEventArgs(UnavailableGuild guild)
10 | {
11 | Guild = guild;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Message/MessageDeletedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class MessageDeletedEventArgs : EventArgs
6 | {
7 | public DeletedMessage DeletedMessage { get; private set; }
8 |
9 | internal MessageDeletedEventArgs(DeletedMessage msg)
10 | {
11 | DeletedMessage = msg;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Anarchy/REST/Channel/Channel/ChannelType.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum ChannelType
4 | {
5 | Text,
6 | DM,
7 | Voice,
8 | Group,
9 | Category,
10 | News,
11 | Store,
12 | GuildNewsThread = 10,
13 | GuildPublicThread,
14 | GuildPrivateThread,
15 | Stage,
16 | Event = 14,
17 | Forum
18 | }
19 | }
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Gifts/EntitlementEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class EntitlementEventArgs : EventArgs
6 | {
7 | public DiscordEntitlement Entitlement { get; private set; }
8 |
9 | public EntitlementEventArgs(DiscordEntitlement entitlement)
10 | {
11 | Entitlement = entitlement;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Media/Voice/VoiceConnectEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Discord.Media;
3 |
4 | namespace Discord.Gateway
5 | {
6 | public class VoiceConnectEventArgs : EventArgs
7 | {
8 | public DiscordVoiceClient Client { get; }
9 |
10 | public VoiceConnectEventArgs(DiscordVoiceClient client)
11 | {
12 | Client = client;
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/User/RemovedRelationshipEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public class RemovedRelationshipEventArgs : EventArgs
7 | {
8 | [JsonProperty("id")]
9 | public ulong UserId { get; private set; }
10 |
11 | [JsonProperty("type")]
12 | public RelationshipType PreviousType { get; private set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Threads/ThreadTTLs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord
4 | {
5 | public static class ThreadTTLs
6 | {
7 | public static TimeSpan OneHour = new TimeSpan(1, 0, 0);
8 | public static TimeSpan OneDay = new TimeSpan(1, 0, 0, 0);
9 | public static TimeSpan ThreeDays = new TimeSpan(3, 0, 0, 0);
10 | public static TimeSpan OneWeek = new TimeSpan(7, 0, 0, 0);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Anarchy/REST/Gifts/DiscordNitroGift.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class DiscordNitroGift : DiscordGift
6 | {
7 | public ulong GifterId
8 | {
9 | get
10 | {
11 | return Gifter.Id;
12 | }
13 | }
14 |
15 | [JsonProperty("user")]
16 | public new DiscordUser Gifter { get; private set; }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Interaction/DiscordInteractionEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class DiscordInteractionEventArgs : EventArgs
6 | {
7 | public DiscordInteraction Interaction { get; private set; }
8 |
9 | public DiscordInteractionEventArgs(DiscordInteraction interaction)
10 | {
11 | Interaction = interaction;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Role/RoleEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Gateway
2 | {
3 | public class RoleEventArgs
4 | {
5 | public DiscordRole Role { get; private set; }
6 |
7 | internal RoleEventArgs(DiscordRole role)
8 | {
9 | Role = role;
10 | }
11 |
12 | public override string ToString()
13 | {
14 | return Role.ToString();
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Session/DiscordSessionsEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class DiscordSessionsEventArgs
6 | {
7 | public IReadOnlyList Sessions { get; private set; }
8 |
9 | internal DiscordSessionsEventArgs(List sessions)
10 | {
11 | Sessions = sessions;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/User/UserEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Gateway
2 | {
3 | public class UserEventArgs
4 | {
5 | public DiscordUser User { get; private set; }
6 |
7 | internal UserEventArgs(DiscordUser user)
8 | {
9 | User = user;
10 | }
11 |
12 | public override string ToString()
13 | {
14 | return User.ToString();
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Media/Payloads/DiscordSSRC.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Media
4 | {
5 | public class DiscordSSRC
6 | {
7 | [JsonProperty("audio_ssrc")]
8 | public uint Audio { get; set; }
9 |
10 | [JsonProperty("video_ssrc")]
11 | public uint Video { get; set; }
12 |
13 | [JsonProperty("rtx_ssrc")]
14 | public uint Rtx { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Guild/Member/List/MemberListItem.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class MemberListItem : Controllable
6 | {
7 | public MemberListItem()
8 | {
9 | OnClientUpdated += (s, e) => Member.SetClient(Client);
10 | }
11 |
12 | [JsonProperty("member")]
13 | public GuildMember Member { get; private set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Examples/AntiRaid/AntiRaid.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net6.0
4 | Exe
5 | false
6 | ..\..\.bin\$(MSBuildProjectName)
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Anarchy/Commands/SlashCommands/SlashCommandCategoryAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Commands
4 | {
5 | [AttributeUsage(AttributeTargets.Class)]
6 | public class SlashCommandCategoryAttribute : Attribute
7 | {
8 | public string Category { get; }
9 |
10 | public SlashCommandCategoryAttribute(string categoryName)
11 | {
12 | Category = categoryName;
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Examples/NitroSniper/NitroSniper.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net6.0
4 | Exe
5 | false
6 | ..\..\.bin\$(MSBuildProjectName)
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Examples/TicTacToe/TicTacToe.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net6.0
4 | Exe
5 | false
6 | ..\..\.bin\$(MSBuildProjectName)
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Guild/Models/GuildEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Gateway
2 | {
3 | public class GuildEventArgs
4 | {
5 | public DiscordGuild Guild { get; private set; }
6 |
7 | internal GuildEventArgs(DiscordGuild guild)
8 | {
9 | Guild = guild;
10 | }
11 |
12 | public override string ToString()
13 | {
14 | return Guild.ToString();
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Livestreaming/StreamSSRC.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Media
4 | {
5 | public class StreamSSRC
6 | {
7 | [JsonProperty("type")]
8 | public string Type { get; private set; }
9 |
10 | [JsonProperty("ssrc")]
11 | public uint SSRC { get; private set; }
12 |
13 | [JsonProperty("rtx_ssrc")]
14 | public uint RtxSsrc { get; private set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Media/Payloads/MediaProtocolData.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Media
4 | {
5 | internal class MediaProtocolData
6 | {
7 | [JsonProperty("address")]
8 | public string Host { get; set; }
9 |
10 | [JsonProperty("port")]
11 | public int Port { get; set; }
12 |
13 | [JsonProperty("mode")]
14 | public string EncryptionMode { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Voice/Speaking/DiscordVoicePacket.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Media
4 | {
5 | public class DiscordVoicePacket
6 | {
7 | public byte[] Data { get; private set; }
8 | public DateTime Timestamp { get; private set; }
9 |
10 | public DiscordVoicePacket(byte[] data)
11 | {
12 | Data = data;
13 | Timestamp = DateTime.Now;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Anarchy/Commands/Command/Parameter/CommandParameter.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 |
3 | namespace Discord.Commands
4 | {
5 | public class CommandParameter : ParameterAttribute
6 | {
7 | public CommandParameter(ParameterAttribute attr, PropertyInfo property) : base(attr.Name, attr.Optional)
8 | {
9 | Property = property;
10 | }
11 |
12 | public PropertyInfo Property { get; private set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Anarchy/REST/DiscordConfig.cs:
--------------------------------------------------------------------------------
1 | using System.Net;
2 |
3 | namespace Discord
4 | {
5 | public class ApiConfig
6 | {
7 | public IWebProxy Proxy { get; set; }
8 | public SuperProperties SuperProperties { get; set; } = new SuperProperties();
9 | public uint RestConnectionRetries { get; set; } = 0;
10 | public uint ApiVersion { get; set; } = 9;
11 | public bool RetryOnRateLimit { get; set; } = true;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Examples/GuildDuplicator/GuildDuplicator.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net6.0
4 | Exe
5 | false
6 | ..\..\.bin\$(MSBuildProjectName)
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Examples/MessageListener/MessageListener.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net6.0
4 | Exe
5 | false
6 | ..\..\.bin\$(MSBuildProjectName)
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Anarchy.Tests/appsettings.Example.json:
--------------------------------------------------------------------------------
1 | {
2 | "User": {
3 | "Connection": {
4 | "Token": "fBv76K1Iv4gLfIdYs~;Q~;R
2 |
3 | net6.0
4 | Exe
5 | false
6 | ..\..\.bin\$(MSBuildProjectName)
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Anarchy/REST/Subscriptions/Subscriptions/DiscordSubscription.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class DiscordSubscription
6 | {
7 | [JsonProperty("id")]
8 | public ulong Id { get; private set; }
9 |
10 | [JsonProperty("plan_id")]
11 | public ulong PlanId { get; private set; }
12 |
13 | [JsonProperty("quantity")]
14 | public int Quantity { get; private set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Interaction/Forms/FormSelectMenuEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Gateway
2 | {
3 | public class FormSelectMenuEventArgs : FormInteractionEventArgs
4 | {
5 | public string[] Values { get; }
6 |
7 | public FormSelectMenuEventArgs(DiscordSocketClient client, DiscordInteraction interaction) : base(client, interaction)
8 | {
9 | Values = interaction.Data.SelectMenuValues;
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Media/MediaPacketEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Media
4 | {
5 | internal class MediaPacketEventArgs : EventArgs
6 | {
7 | public RTPPacketHeader Header { get; }
8 | public byte[] Payload { get; }
9 |
10 | public MediaPacketEventArgs(RTPPacketHeader header, byte[] payload)
11 | {
12 | Header = header;
13 | Payload = payload;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Voice/Speaking/DiscordSpeakingRequest.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Media
4 | {
5 | internal class DiscordSpeakingRequest
6 | {
7 | [JsonProperty("speaking")]
8 | public DiscordSpeakingFlags State { get; set; }
9 |
10 | [JsonProperty("delay")]
11 | public int Delay { get; set; }
12 |
13 | [JsonProperty("ssrc")]
14 | public uint SSRC { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/DiscordSocketConfig.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Gateway
2 | {
3 | public class DiscordSocketConfig : ApiConfig
4 | {
5 | public bool Cache { get; set; } = true;
6 | public DiscordGatewayIntent? Intents { get; set; }
7 | public bool HandleIncomingMediaData { get; set; } = true;
8 | public uint VoiceChannelConnectTimeout { get; set; } = 10 * 1000;
9 | public DiscordShard Shard { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Anarchy/REST/User/Settings/FriendRequestFlags.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class FriendRequestFlags
6 | {
7 | [JsonProperty("all")]
8 | public bool Everyone { get; private set; }
9 |
10 | [JsonProperty("mutual_friends")]
11 | public bool MutualFriends { get; private set; }
12 |
13 | [JsonProperty("mutual_guilds")]
14 | public bool MutualGuilds { get; private set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/DiscordWebSocketCloseEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.WebSockets
4 | {
5 | public class DiscordWebSocketCloseEventArgs : EventArgs
6 | {
7 | public int Code { get; private set; }
8 | public string Reason { get; private set; }
9 |
10 | public DiscordWebSocketCloseEventArgs(int code, string reason)
11 | {
12 | Code = code;
13 | Reason = reason;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Session/DiscordSessionClientInfo.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class DiscordSessionClientInfo
6 | {
7 | [JsonProperty("version")]
8 | public int Version { get; private set; }
9 |
10 | [JsonProperty("os")]
11 | public string OS { get; private set; }
12 |
13 | [JsonProperty("client")]
14 | public string ClientType { get; private set; }
15 | }
16 | }
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Media/Payloads/DiscordMediaOpcode.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Media
2 | {
3 | public enum DiscordMediaOpcode
4 | {
5 | Identify,
6 | SelectProtocol,
7 | Ready,
8 | Heartbeat,
9 | SessionDescription,
10 | Speaking,
11 | HeartbeatAck,
12 | Resume,
13 | Hello,
14 | Resumed,
15 | SSRCUpdate = 12,
16 | UserDisconnect,
17 | ChangeCodecs
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Presence/Activity/Properties/StreamActivityProperties.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class StreamActivityProperties : ActivityProperties
6 | {
7 | [JsonProperty("type")]
8 | public new ActivityType Type
9 | {
10 | get { return ActivityType.Streaming; }
11 | }
12 |
13 | [JsonProperty("url")]
14 | public string Url { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Channel/Private/RingingEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class RingingEventArgs : CallUpdateEventArgs
6 | {
7 | public IReadOnlyList VoiceStates { get; private set; }
8 |
9 | public RingingEventArgs(DiscordCall call, IReadOnlyList states) : base(call)
10 | {
11 | VoiceStates = states;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Guild/Models/UnavailableGuild.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class UnavailableGuild
6 | {
7 | [JsonProperty("id")]
8 | public ulong Id { get; private set; }
9 |
10 | [JsonProperty("unavailable")]
11 | public bool Unavailable { get; private set; }
12 |
13 | public bool Removed
14 | {
15 | get { return !Unavailable; }
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Guild/Models/SocketGuildEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class SocketGuildEventArgs : EventArgs
6 | {
7 | public SocketGuild Guild { get; private set; }
8 |
9 | public bool Lurking { get; private set; }
10 |
11 | public SocketGuildEventArgs(SocketGuild guild, bool lurking)
12 | {
13 | Guild = guild;
14 | Lurking = lurking;
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Media/Voice/VoiceChannelSpeakingEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Media
2 | {
3 | public class VoiceChannelSpeakingEventArgs
4 | {
5 | public DiscordVoiceClient Client { get; }
6 | public IncomingVoiceStream Stream { get; }
7 |
8 | public VoiceChannelSpeakingEventArgs(DiscordVoiceClient client, IncomingVoiceStream stream)
9 | {
10 | Client = client;
11 | Stream = stream;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Message/MessageEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class MessageEventArgs : EventArgs
6 | {
7 | public DiscordMessage Message { get; private set; }
8 |
9 | internal MessageEventArgs(DiscordMessage msg)
10 | {
11 | Message = msg;
12 | }
13 |
14 | public override string ToString()
15 | {
16 | return Message.ToString();
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Message/ReactionEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Gateway
2 | {
3 | public class ReactionEventArgs
4 | {
5 | public MessageReactionUpdate Reaction { get; private set; }
6 |
7 | internal ReactionEventArgs(MessageReactionUpdate reaction)
8 | {
9 | Reaction = reaction;
10 | }
11 |
12 | public override string ToString()
13 | {
14 | return Reaction.ToString();
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Voice/Speaking/DiscordSpeakingState.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Media
4 | {
5 | internal class DiscordSpeakingState
6 | {
7 | [JsonProperty("user_id")]
8 | public ulong? UserId { get; internal set; }
9 |
10 | [JsonProperty("ssrc")]
11 | public uint SSRC { get; private set; }
12 |
13 | [JsonProperty("speaking")]
14 | public DiscordSpeakingFlags State { get; private set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Settings/DiscordChannelSettings.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class DiscordChannelSettings
6 | {
7 | [JsonProperty("channel_id")]
8 | public ulong Id { get; private set; }
9 |
10 | [JsonProperty("muted")]
11 | public bool Muted { get; private set; }
12 |
13 | [JsonProperty("message_notifications")]
14 | public ClientNotificationLevel Notifications { get; private set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Media/Voice/VoiceClientDictionary.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Discord.Media;
3 |
4 | namespace Discord.Gateway
5 | {
6 | public class VoiceClientDictionary : Dictionary
7 | {
8 | public VoiceClientDictionary(DiscordSocketClient client) : base()
9 | {
10 | Private = new DiscordVoiceClient(client, 0);
11 | }
12 |
13 | public DiscordVoiceClient Private { get; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Message/UserTypingEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class UserTypingEventArgs : EventArgs
6 | {
7 | public UserTyping Typing { get; private set; }
8 |
9 | internal UserTypingEventArgs(UserTyping typing)
10 | {
11 | Typing = typing;
12 | }
13 |
14 | public override string ToString()
15 | {
16 | return Typing.ToString();
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Presence/Activity/Properties/ActivityProperties.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class ActivityProperties
6 | {
7 | [JsonProperty("name")]
8 | public string Name { get; set; }
9 |
10 | [JsonProperty("type")]
11 | public ActivityType Type { get; set; }
12 |
13 | public override string ToString()
14 | {
15 | return Type.ToString();
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Presence/Presence/UpdatedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Gateway
2 | {
3 | public class PresenceUpdatedEventArgs
4 | {
5 | public DiscordPresence Presence { get; private set; }
6 |
7 | internal PresenceUpdatedEventArgs(DiscordPresence presence)
8 | {
9 | Presence = presence;
10 | }
11 |
12 | public override string ToString()
13 | {
14 | return Presence.ToString();
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Media/Payloads/MediaCodecSelection.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Media
4 | {
5 | internal class MediaCodecSelection
6 | {
7 | [JsonProperty("media_session_id")]
8 | internal string NewSessionId { get; private set; }
9 |
10 | [JsonProperty("audio_codec")]
11 | public string AudioCodec { get; set; }
12 |
13 | [JsonProperty("video_codec")]
14 | public string VideoCodec { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Anarchy/REST/Emoji/Models/UpdatedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class EmojisUpdatedEventArgs
6 | {
7 | public ulong GuildId { get; private set; }
8 | public IReadOnlyList Emojis { get; private set; }
9 |
10 | internal EmojisUpdatedEventArgs(EmojiContainer emojis)
11 | {
12 | GuildId = emojis.GuildId;
13 | Emojis = emojis.Emojis;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Role/DeletedRole.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class DeletedRole : Controllable
6 | {
7 | [JsonProperty("guild_id")]
8 | private readonly ulong _guildId;
9 |
10 | public MinimalGuild Guild
11 | {
12 | get { return new MinimalGuild(_guildId).SetClient(Client); }
13 | }
14 |
15 | [JsonProperty("role_id")]
16 | public ulong Id { get; private set; }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/User/RelationshipEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Gateway
2 | {
3 | public class RelationshipEventArgs
4 | {
5 | public DiscordRelationship Relationship { get; private set; }
6 |
7 | public RelationshipEventArgs(DiscordRelationship relationship)
8 | {
9 | Relationship = relationship;
10 | }
11 |
12 | public override string ToString()
13 | {
14 | return Relationship.ToString();
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Anarchy/Commands/Command/CommandAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Commands
4 | {
5 | [AttributeUsage(AttributeTargets.Class)]
6 | public class CommandAttribute : Attribute
7 | {
8 | public string Name { get; private set; }
9 | public string Description { get; private set; }
10 |
11 | public CommandAttribute(string name, string description = null)
12 | {
13 | Name = name;
14 | Description = description;
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Anarchy/REST/CDN/CDNEndpoint.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace Discord
4 | {
5 | public class CDNEndpoint
6 | {
7 | public string Template { get; private set; }
8 | public IReadOnlyList AllowedFormats { get; private set; }
9 |
10 | public CDNEndpoint(string template, List allowedFormats)
11 | {
12 | Template = template;
13 | AllowedFormats = allowedFormats;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Anarchy/Commands/Command/Parameter/ParameterAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Commands
4 | {
5 | [AttributeUsage(AttributeTargets.Property)]
6 | public class ParameterAttribute : Attribute
7 | {
8 | public string Name { get; private set; }
9 | public bool Optional { get; private set; }
10 |
11 | public ParameterAttribute(string name, bool optional = false)
12 | {
13 | Name = name;
14 | Optional = optional;
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Anarchy/REST/User/Profile/MutualGuild.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class MutualGuild : MinimalGuild
6 | {
7 | [JsonProperty("nick")]
8 | public string Nickname { get; private set; }
9 |
10 | public override string ToString()
11 | {
12 | return Id.ToString();
13 | }
14 |
15 | public static implicit operator ulong(MutualGuild instance)
16 | {
17 | return instance.Id;
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Anarchy/REST/User/Connections/ConnectedAccountMetadata.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 |
4 | namespace Discord
5 | {
6 | public class ConnectedAccountMetadata
7 | {
8 | // neither of these properties would get converted properly so therefore i'm setting them as a string for now.
9 | [JsonProperty("verified")]
10 | public string Verified { get; protected set; }
11 |
12 | [JsonProperty("created_at")]
13 | public string CreatedAt { get; protected set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Presence/Activity/User/DiscordListeningActivity.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class DiscordListeningActivity : DiscordActivity
6 | {
7 | [JsonProperty("state")]
8 | public string Authors { get; private set; }
9 |
10 | [JsonProperty("details")]
11 | public string Song { get; private set; }
12 |
13 | public override string ToString()
14 | {
15 | return Song;
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Examples/VCSpammer/VCSpammer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net6.0
4 | Exe
5 | false
6 | ..\..\.bin\$(MSBuildProjectName)
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Anarchy/Commands/Command/CommandHandlerConfig.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Commands;
4 |
5 | public class CommandHandlerConfig
6 | {
7 | public bool CaseInsensitiveCommands { get; set; } = false;
8 |
9 | ///
10 | /// Returns a string as prefix if custom prefix is found, else return null if not found.
11 | /// The custom prefixes could be stored in a database, and you can fetch them from this.
12 | ///
13 | public Func GetGuildPrefix { get; set; } = (id) => null;
14 | }
--------------------------------------------------------------------------------
/Anarchy/REST/HTTP/Exceptions/RateLimitException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord
4 | {
5 | public class RateLimitException : Exception
6 | {
7 | public int RetryAfter { get; private set; }
8 |
9 | public RateLimitException(int retryAfter) : base($"Ratelimited for {retryAfter} milliseconds")
10 | {
11 | RetryAfter = retryAfter;
12 | }
13 |
14 | public override string ToString()
15 | {
16 | return RetryAfter.ToString();
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/Anarchy/REST/Message/Message/Properties/MessageFilters.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public class MessageFilters
4 | {
5 | public MessageAttachmentFilter? Has { get; set; }
6 |
7 | public string Content { get; set; }
8 |
9 | public ulong? MentioningUserId { get; set; }
10 |
11 | public ulong? AuthorId { get; set; }
12 |
13 | public ulong? BeforeId { get; set; }
14 |
15 | public ulong? AfterId { get; set; }
16 |
17 | public uint? Limit { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Media/Auth/DiscordSessionDescription.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Media
4 | {
5 | internal class DiscordSessionDescription : MediaCodecSelection
6 | {
7 | [JsonProperty("media_session_id")]
8 | public string SessionId { get; private set; }
9 |
10 | [JsonProperty("mode")]
11 | public string EncryptionMode { get; private set; }
12 |
13 | [JsonProperty("secret_key")]
14 | public byte[] SecretKey { get; private set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # About
2 | Anarchy is an open source Discord API wrapper. It has REST, Gateway and media (although live streaming functionality is limited) support, including user-only functions, making it the most capable wrapper by a long shot.
3 |
4 | # Documentation
5 |
6 | Examples can be found in the `.\Examples` folder.
7 |
8 | Documentation and a tutorial can be found [here](https://ilinked1337.gitbook.io/anarchy/).
9 |
10 | # Source Code
11 |
12 | Source code is available on [github](https://github.com/not-ilinked/Anarchy).
13 |
14 |
--------------------------------------------------------------------------------
/Anarchy/REST/Invite/Models/InviteProperties.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | ///
6 | /// Properties for creating an
7 | ///
8 | public class InviteProperties
9 | {
10 | [JsonProperty("max_age")]
11 | public uint MaxAge { get; set; }
12 |
13 | [JsonProperty("max_uses")]
14 | public uint MaxUses { get; set; }
15 |
16 | [JsonProperty("temporary")]
17 | public bool Temporary { get; set; }
18 | }
19 | }
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Properties/CreationProperties.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | ///
6 | /// Options for creating a
7 | ///
8 | internal class GuildCreationProperties
9 | {
10 | [JsonProperty("name")]
11 | public string Name { get; set; }
12 |
13 | [JsonProperty("region")]
14 | public string Region { get; set; }
15 |
16 | [JsonProperty("icon")]
17 | public DiscordImage Icon { get; set; }
18 | }
19 | }
--------------------------------------------------------------------------------
/Anarchy/WebSockets/DiscordWebSocketMessage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 | using Newtonsoft.Json.Linq;
4 |
5 | namespace Discord.WebSockets
6 | {
7 | public class DiscordWebSocketMessage : DiscordWebSocketRequest where TOpcode : Enum
8 | {
9 | // these members only apply to the Gateway :P
10 | [JsonProperty("t")]
11 | public string EventName { get; private set; }
12 |
13 | [JsonProperty("s")]
14 | public uint? Sequence { get; private set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Media/DiscordMediaCloseCode.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Media
2 | {
3 | public enum DiscordMediaCloseCode
4 | {
5 | UnknownOpcode = 4001,
6 | FailedToDecodePayload,
7 | NotAuthenticated,
8 | AuthenticationFailed,
9 | AlreadyAuthenticated,
10 | InvalidSession,
11 | SessionTimeout = 4009,
12 | ServerNotFound = 4011,
13 | UnknownProtocol,
14 | Disconnected = 4014,
15 | ServerCrashed,
16 | UnknownEncryptionMode
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Anarchy/REST/Embed/Image.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class EmbedImage
6 | {
7 | [JsonProperty("url")]
8 | public string Url { get; internal set; }
9 |
10 | [JsonProperty("width")]
11 | public uint Width { get; private set; }
12 |
13 | [JsonProperty("height")]
14 | public uint Height { get; private set; }
15 |
16 | public override string ToString()
17 | {
18 | return $"W: {Width}, H: {Height}";
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Anarchy/REST/Emoji/Models/EmojiProperties.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | ///
6 | /// Options for creating a
7 | ///
8 | public class EmojiProperties
9 | {
10 | [JsonProperty("name")]
11 | public string Name { get; set; }
12 |
13 | [JsonProperty("image")]
14 | public DiscordImage Image { get; set; }
15 |
16 | public override string ToString()
17 | {
18 | return Name;
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/Examples/MusicBot/MusicBot.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net6.0
4 | Exe
5 | false
6 | ..\..\.bin\$(MSBuildProjectName)
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Anarchy/Commands/SlashCommands/SlashParameterChoiceAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Commands
4 | {
5 | [AttributeUsage(AttributeTargets.Property, AllowMultiple = true)]
6 | public class SlashParameterChoiceAttribute : Attribute
7 | {
8 | public string Name { get; private set; }
9 | public object Value { get; private set; }
10 |
11 | public SlashParameterChoiceAttribute(string name, object value)
12 | {
13 | Name = name;
14 | Value = value;
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Anarchy/REST/Message/Message/MessageAuthor.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public class MessageAuthor : Controllable
4 | {
5 | internal MessageAuthor(DiscordUser user, GuildMember member)
6 | {
7 | User = user;
8 |
9 | Member = member;
10 | }
11 |
12 | public DiscordUser User { get; private set; }
13 | public GuildMember Member { get; private set; }
14 |
15 | public override string ToString()
16 | {
17 | return User.ToString();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/AuditLog/Models/Change.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class AuditLogChange
6 | {
7 | [JsonProperty("new_value")]
8 | public dynamic NewValue { get; private set; }
9 |
10 | [JsonProperty("old_value")]
11 | public dynamic OldValue { get; private set; }
12 |
13 | [JsonProperty("key")]
14 | public string Key { get; private set; }
15 |
16 | public override string ToString()
17 | {
18 | return Key;
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Community/Screening/GuildVerificationForm.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public class GuildVerificationForm
7 | {
8 | [JsonProperty("description")]
9 | public string Description { get; private set; }
10 |
11 | [JsonProperty("version")]
12 | public string Version { get; private set; }
13 |
14 | [JsonProperty("form_fields")]
15 | public IReadOnlyList Fields { get; private set; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Community/WelcomeChannelProperties.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class WelcomeChannelProperties
6 | {
7 | [JsonProperty("channel_id")]
8 | public ulong ChannelId { get; set; }
9 |
10 | [JsonProperty("description")]
11 | public string Description { get; set; }
12 |
13 | [JsonProperty("emoji_id")]
14 | public ulong? EmojiId { get; set; }
15 |
16 | [JsonProperty("emoji_name")]
17 | public string EmojiName { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Channel/Unread/ChannelUnreadMessages.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class ChannelUnreadMessages : Controllable
6 | {
7 | [JsonProperty("id")]
8 | private readonly ulong _channelId;
9 |
10 | public MinimalTextChannel Channel
11 | {
12 | get { return new MinimalTextChannel(_channelId).SetClient(Client); }
13 | }
14 |
15 | [JsonProperty("last_message_id")]
16 | public ulong LastMessageId { get; private set; }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Presence/Presence/ActiveSessionPlatforms.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class ActiveSessionPlatforms
6 | {
7 | [JsonProperty("desktop")]
8 | public UserStatus Desktop { get; private set; } = UserStatus.Offline;
9 |
10 | [JsonProperty("web")]
11 | public UserStatus Website { get; private set; } = UserStatus.Offline;
12 |
13 | [JsonProperty("mobile")]
14 | public UserStatus Mobile { get; private set; } = UserStatus.Offline;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Anarchy/REST/Channel/Channel/CreationProperties.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | ///
6 | /// Options for creating a
7 | ///
8 | public class ChannelCreationProperties
9 | {
10 | [JsonProperty("name")]
11 | public string Name { get; set; }
12 |
13 | [JsonProperty("type")]
14 | public ChannelType Type { get; set; }
15 |
16 | public override string ToString()
17 | {
18 | return Type.ToString();
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Channel/Unread/UnreadMessagesEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace Discord.Gateway
5 | {
6 | public class UnreadMessagesEventArgs : EventArgs
7 | {
8 | public MinimalGuild Guild { get; private set; }
9 | public IReadOnlyList Channels { get; private set; }
10 |
11 | public UnreadMessagesEventArgs(GuildUnreadMessages unread)
12 | {
13 | Guild = unread.Guild;
14 | Channels = unread.Channels;
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Anarchy/REST/User/Connections/ConnectedAccountType.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum ConnectedAccountType
4 | {
5 | BattleNet,
6 | eBay,
7 | EpicGames,
8 | Facebook,
9 | GitHub,
10 | Instagram,
11 | LeagueOfLegends,
12 | PayPal,
13 | PlayStationNetwork,
14 | Reddit,
15 | RiotGames,
16 | Spotify,
17 | Skype,
18 | Steam,
19 | TikTok,
20 | Twitch,
21 | Twitter,
22 | Xbox,
23 | YouTube
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Presence/Activity/User/DiscordActivity.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class DiscordActivity : Controllable
6 | {
7 | [JsonProperty("type")]
8 | public ActivityType Type { get; private set; }
9 |
10 | [JsonProperty("id")]
11 | public string Id { get; private set; }
12 |
13 | [JsonProperty("name")]
14 | public string Name { get; private set; }
15 |
16 | public override string ToString()
17 | {
18 | return Name;
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Anarchy/REST/Embed/Video.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | //as far as i know videos cannot be put into an embed
6 | public class EmbedVideo
7 | {
8 | [JsonProperty("url")]
9 | public string Url { get; private set; }
10 |
11 | [JsonProperty("width")]
12 | public uint Width { get; private set; }
13 |
14 | [JsonProperty("height")]
15 | public uint Height { get; private set; }
16 |
17 | public override string ToString()
18 | {
19 | return $"W: {Width} H: {Height}";
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/General/GatewayCloseCode.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Gateway
2 | {
3 | public enum GatewayCloseCode : ushort
4 | {
5 | ClosedByClient = 3000,
6 | UnknownError = 4000,
7 | UnknownOpcode,
8 | DecodeError,
9 | NotAuthenticated,
10 | AuthenticationFailed,
11 | AlreadyAuthenticated,
12 | InvalidSequence = 4007,
13 | RateLimited,
14 | SessionTimedOut,
15 | InvalidShard,
16 | ShardingRequired,
17 | InvalidAPIVersion,
18 | InvalidIntents,
19 | DisallowedIntents
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Media/Go Live/StartStream.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Media
4 | {
5 | // Opcode: GoLive
6 | internal class StartStream
7 | {
8 | // "guild" for Go Live
9 | [JsonProperty("type")]
10 | public string Type { get; set; }
11 |
12 | [JsonProperty("guild_id")]
13 | public ulong GuildId { get; set; }
14 |
15 | [JsonProperty("channel_id")]
16 | public ulong ChannelId { get; set; }
17 |
18 | [JsonProperty("preferred_region")]
19 | public string PreferredRegion { get; set; }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/General/Opcode.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Gateway
2 | {
3 | public enum GatewayOpcode
4 | {
5 | Event,
6 | Heartbeat,
7 | Identify,
8 | PresenceChange,
9 | VoiceStateUpdate,
10 | Resume = 6,
11 | Reconnect,
12 | RequestGuildMembers,
13 | InvalidSession,
14 | Connected,
15 | HeartbeatAck,
16 | ReportOpenDM = 13, // seems like some data collection bs idk
17 | GuildSubscriptions = 14,
18 | GoLive = 18,
19 | EndGoLive,
20 | WatchGoLive,
21 | GoLiveUpdate = 22
22 | }
23 | }
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Media/Go Live/GoLiveUpdate.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord.Media
5 | {
6 | internal class GoLiveUpdate
7 | {
8 | [JsonProperty("stream_key")]
9 | public string StreamKey { get; private set; }
10 |
11 | [JsonProperty("region")]
12 | public string Region { get; private set; }
13 |
14 | [JsonProperty("paused")]
15 | public bool Paused { get; private set; }
16 |
17 | [JsonProperty("viewer_ids")]
18 | public IReadOnlyList ViewerIds { get; private set; }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Anarchy/REST/Discovery/GuildQueryResult.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public class GuildQueryResult : Controllable
7 | {
8 | public GuildQueryResult()
9 | {
10 | OnClientUpdated += (sender, e) =>
11 | {
12 | Guilds.SetClientsInList(Client);
13 | };
14 | }
15 |
16 | [JsonProperty("total")]
17 | public uint Total { get; private set; }
18 |
19 | [JsonProperty("guilds")]
20 | public IReadOnlyList Guilds { get; private set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Anarchy/REST/Message/Message/Components/Input/SelectMenuOption.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class SelectMenuOption
6 | {
7 | [JsonProperty("label")]
8 | public string Text { get; set; }
9 |
10 | [JsonProperty("value")]
11 | public string Value { get; set; }
12 |
13 | [JsonProperty("description")]
14 | public string Description { get; set; }
15 |
16 | [JsonProperty("emoji")]
17 | public PartialEmoji Emoji { get; set; }
18 |
19 | [JsonProperty("default")]
20 | public bool? Default { get; set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Media/Auth/DiscordMediaIdentify.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Media
4 | {
5 | internal class DiscordMediaIdentify
6 | {
7 | [JsonProperty("server_id")]
8 | public ulong ServerId { get; set; }
9 |
10 | [JsonProperty("user_id")]
11 | public ulong UserId { get; set; }
12 |
13 | [JsonProperty("session_id")]
14 | public string SessionId { get; set; }
15 |
16 | [JsonProperty("token")]
17 | public string Token { get; set; }
18 |
19 | [JsonProperty("video")]
20 | public bool Video { get; set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Anarchy/Commands/SlashCommands/SlashCommandAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Commands
4 | {
5 | [AttributeUsage(AttributeTargets.Class)]
6 | public class SlashCommandAttribute : Attribute
7 | {
8 | public string Name { get; private set; }
9 | public string Description { get; private set; }
10 | public bool Delayed { get; private set; }
11 |
12 | public SlashCommandAttribute(string name, string description, bool delayed = false)
13 | {
14 | Name = name;
15 | Description = description;
16 | Delayed = delayed;
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/DiscordWebSocketRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord.WebSockets
5 | {
6 | public class DiscordWebSocketRequest where TOpcode : Enum
7 | {
8 | public DiscordWebSocketRequest()
9 | { }
10 |
11 | public DiscordWebSocketRequest(TOpcode op, TData data)
12 | {
13 | Opcode = op;
14 | Data = data;
15 | }
16 |
17 | [JsonProperty("op")]
18 | public TOpcode Opcode { get; private set; }
19 |
20 | [JsonProperty("d")]
21 | public TData Data { get; private set; }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Interaction/SlashCommandArgument.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord.Gateway
5 | {
6 | public class SlashCommandArgument
7 | {
8 | [JsonProperty("type")]
9 | public CommandOptionType Type { get; private set; }
10 |
11 | [JsonProperty("name")]
12 | public string Name { get; private set; }
13 |
14 | [JsonProperty("value")]
15 | public string Value { get; private set; }
16 |
17 | [JsonProperty("options")]
18 | public IReadOnlyList Options { get; private set; }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Anarchy/Commands/SlashCommands/SlashParameterAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Commands
4 | {
5 | [AttributeUsage(AttributeTargets.Property)]
6 | public class SlashParameterAttribute : Attribute
7 | {
8 | public string Name { get; private set; }
9 | public string Description { get; private set; }
10 | public bool Required { get; private set; }
11 |
12 | public SlashParameterAttribute(string name, string description, bool required = true)
13 | {
14 | Name = name;
15 | Description = description;
16 | Required = required;
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Community/WelcomeScreen.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public class WelcomeScreen : Controllable
7 | {
8 | public WelcomeScreen()
9 | {
10 | OnClientUpdated += (s, e) =>
11 | {
12 | Channels.SetClientsInList(Client);
13 | };
14 | }
15 |
16 | [JsonProperty("description")]
17 | public string Description { get; private set; }
18 |
19 | [JsonProperty("welcome_channels")]
20 | public IReadOnlyList Channels { get; private set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Session/DiscordSession.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord.Gateway
5 | {
6 | public class DiscordSession
7 | {
8 | [JsonProperty("status")]
9 | public UserStatus Status { get; private set; }
10 |
11 | [JsonProperty("session_id")]
12 | public string Id { get; private set; }
13 |
14 | [JsonProperty("client_info")]
15 | public DiscordSessionClientInfo ClientInfo { get; private set; }
16 |
17 | [JsonProperty("activities")]
18 | public IReadOnlyList Activities { get; private set; }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Anarchy/REST/OAuth2/Models/DiscordBotAuthProperties.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | internal class DiscordBotAuthProperties
6 | {
7 | [JsonProperty("authorize")]
8 | #pragma warning disable IDE0051, CS0414
9 | private readonly bool _auth = true;
10 | #pragma warning restore IDE0051, CS0414
11 |
12 | [JsonProperty("bot_guild_id")]
13 | public ulong GuildId { get; set; }
14 |
15 | [JsonProperty("captcha_key")]
16 | public string CaptchaKey { get; set; }
17 |
18 | [JsonProperty("permissions")]
19 | public DiscordPermission Permissions { get; set; }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Channel/Private/GatewayPrivateChannelExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public static class GatewayPrivateChannelExtensions
6 | {
7 | ///
8 | /// Gets the account's private channels
9 | ///
10 | public static IReadOnlyList GetPrivateChannels(this DiscordSocketClient client)
11 | {
12 | if (client.Config.Cache)
13 | return client.PrivateChannels;
14 | else
15 | return ((DiscordClient) client).GetPrivateChannels();
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Anarchy/Commands/Command/CommandBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Discord.Gateway;
3 |
4 | namespace Discord.Commands
5 | {
6 | public abstract class CommandBase
7 | {
8 | public DiscordSocketClient Client { get; private set; }
9 | public DiscordMessage Message { get; private set; }
10 |
11 | internal void Prepare(DiscordSocketClient client, DiscordMessage message)
12 | {
13 | Client = client;
14 | Message = message;
15 | }
16 |
17 | public abstract void Execute();
18 | public virtual void HandleError(string parameterName, string providedValue, Exception exception) { }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Anarchy/REST/Gifts/PurchaseOptions.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class PurchaseOptions
6 | {
7 | [JsonProperty("expected_amount")]
8 | public int ExpectedAmount { get; set; }
9 |
10 | [JsonProperty("gift")]
11 | #pragma warning disable CS0414
12 | private readonly bool _gift = true; // rn we only have support for gifts kek
13 | #pragma warning restore CS0414
14 |
15 | [JsonProperty("payment_source_id")]
16 | public ulong PaymentMethodId { get; set; }
17 |
18 | [JsonProperty("sku_subscription_plan_id")]
19 | public ulong SkuPlanId { get; set; }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Webhook/Default/DiscordWebhookProfile.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public class DiscordWebhookProfile
4 | {
5 | internal DiscordParameter NameProperty = new DiscordParameter();
6 | public string Username
7 | {
8 | get { return NameProperty; }
9 | set { NameProperty.Value = value; }
10 | }
11 |
12 | internal DiscordParameter AvatarProperty = new DiscordParameter();
13 | public string AvatarUrl
14 | {
15 | get { return AvatarProperty; }
16 | set { AvatarProperty.Value = value; }
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Presence/Activity/User/CustomStatusActivity.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class CustomStatusActivity : DiscordActivity
6 | {
7 | public CustomStatusActivity()
8 | {
9 | OnClientUpdated += (s, e) => Emoji.SetClient(Client);
10 | }
11 |
12 | [JsonProperty("state")]
13 | public string Text { get; private set; }
14 |
15 | [JsonProperty("emoji")]
16 | public PartialEmoji Emoji { get; private set; }
17 |
18 | public override string ToString()
19 | {
20 | return Text;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Anarchy/REST/Billing/CardPaymentMethod.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class CardPaymentMethod : PaymentMethod
6 | {
7 | [JsonProperty("brand")]
8 | public string Brand { get; private set; }
9 |
10 | [JsonProperty("country")]
11 | public string Country { get; private set; }
12 |
13 | [JsonProperty("last_4")]
14 | public int Last4 { get; private set; }
15 |
16 | [JsonProperty("expires_month")]
17 | public int ExpirationMonth { get; private set; }
18 |
19 | [JsonProperty("expires_year")]
20 | public int ExpirationYear { get; private set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Guild/Member/Query/GuildMemberQuery.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Gateway
4 | {
5 | ///
6 | /// Query for getting a list of guild members
7 | ///
8 | public class GuildMemberQuery
9 | {
10 | [JsonProperty("guild_id")]
11 | public ulong GuildId { get; set; }
12 |
13 | [JsonProperty("query")]
14 | private readonly string _query = "";
15 |
16 | [JsonProperty("limit")]
17 | public uint Limit { get; set; }
18 |
19 | public override string ToString()
20 | {
21 | return GuildId.ToString();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Threads/DiscordThreadMember.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public class DiscordThreadMember : Controllable
7 | {
8 | [JsonProperty("id")]
9 | private readonly ulong _threadId;
10 | public MinimalTextChannel Thread => new MinimalTextChannel(_threadId).SetClient(Client);
11 |
12 | [JsonProperty("user_id")]
13 | public ulong UserId { get; private set; }
14 |
15 | [JsonProperty("join_timestamp")]
16 | public DateTime JoinedAt { get; private set; }
17 |
18 | [JsonProperty("flags")]
19 | public int Flags { get; private set; }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Media/Voice/VoiceStateDictionary.cs:
--------------------------------------------------------------------------------
1 | using Anarchy;
2 |
3 | namespace Discord.Gateway
4 | {
5 | internal class VoiceStateDictionary : ConcurrentDictionary
6 | {
7 | public new DiscordVoiceStateContainer this[ulong userId]
8 | {
9 | get
10 | {
11 | if (TryGetValue(userId, out DiscordVoiceStateContainer container))
12 | return container;
13 | else
14 | return this[userId] = new DiscordVoiceStateContainer(userId);
15 | }
16 | set { base[userId] = value; }
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Examples/MusicBot/Commands/SkipCommand.cs:
--------------------------------------------------------------------------------
1 | using Discord.Commands;
2 |
3 | namespace MusicBot
4 | {
5 | [Command("skip")]
6 | public class SkipCommand : CommandBase
7 | {
8 | public override void Execute()
9 | {
10 | if (Program.CanModifyList(Client, Message))
11 | {
12 | var list = Program.TrackLists[Message.Guild.Id];
13 |
14 | var currentSong = list.Tracks[0];
15 | list.Tracks.RemoveAt(0);
16 | currentSong.CancellationTokenSource.Cancel();
17 |
18 | Message.Channel.SendMessage("Skipped the current song.");
19 | }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Anarchy/REST/Message/Message/Components/Input/ButtonComponent.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class ButtonComponent : MessageInputComponent
6 | {
7 | public ButtonComponent()
8 | {
9 | Type = MessageComponentType.Button;
10 | }
11 |
12 | [JsonProperty("style")]
13 | public MessageButtonStyle Style { get; set; }
14 |
15 | [JsonProperty("label")]
16 | public string Text { get; set; }
17 |
18 | [JsonProperty("emoji")]
19 | public PartialEmoji Emoji { get; set; }
20 |
21 | [JsonProperty("url")]
22 | public string RedirectUrl { get; set; }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Anarchy/REST/Message/Message/Components/RowComponent.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public class RowComponent : MessageComponent
7 | {
8 | internal RowComponent()
9 | {
10 | Type = MessageComponentType.Row;
11 | }
12 |
13 | public RowComponent(List children) : this()
14 | {
15 | Components = children;
16 | }
17 |
18 | [JsonProperty("components")]
19 | [JsonConverter(typeof(DeepJsonConverter))]
20 | public List Components { get; private set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Anarchy/REST/HTTP/DiscordHttpError.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using Newtonsoft.Json.Linq;
3 |
4 | namespace Discord
5 | {
6 | public class DiscordHttpError
7 | {
8 | [JsonProperty("code")]
9 | public DiscordError Code { get; private set; }
10 |
11 | [JsonProperty("errors")]
12 | public JObject Fields { get; private set; }
13 |
14 | [JsonProperty("message")]
15 | public string Message { get; private set; }
16 |
17 | public DiscordHttpError() { }
18 |
19 | public DiscordHttpError(DiscordError code, string message)
20 | {
21 | Code = code;
22 | Message = message;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Anarchy/Local/Controllable/Controllable.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public abstract class Controllable : IDisposable
7 | {
8 | protected event EventHandler OnClientUpdated;
9 |
10 | private DiscordClient _client;
11 | [JsonIgnore]
12 | public DiscordClient Client
13 | {
14 | get { return _client; }
15 | set
16 | {
17 | _client = value;
18 |
19 | OnClientUpdated?.Invoke(this, new EventArgs());
20 | }
21 | }
22 |
23 | public void Dispose()
24 | {
25 | _client = null;
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Community/Screening/GuildVerificationFormField.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public class GuildVerificationFormField
7 | {
8 | [JsonProperty("field_type")]
9 | public string FieldType { get; set; }
10 |
11 | [JsonProperty("label")]
12 | public string Label { get; set; }
13 |
14 | [JsonProperty("values")]
15 | public IReadOnlyList Values { get; set; }
16 |
17 | [JsonProperty("required")]
18 | public bool Required { get; set; }
19 |
20 | [JsonProperty("response")]
21 | public object Response { get; set; }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Media/Auth/DiscordMediaReady.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord.Media
5 | {
6 | internal class DiscordMediaReady
7 | {
8 | [JsonProperty("ssrc")]
9 | public uint SSRC { get; private set; }
10 |
11 | [JsonProperty("ip")]
12 | public string IP { get; private set; }
13 |
14 | [JsonProperty("port")]
15 | public int Port { get; private set; }
16 |
17 | [JsonProperty("modes")]
18 | public List EncryptionModes { get; private set; }
19 |
20 | [JsonProperty("streams")]
21 | public List Streams { get; private set; }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Channel/Private/ChannelRecipientEventArgs.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class ChannelRecipientEventArgs : Controllable
6 | {
7 | public ChannelRecipientEventArgs()
8 | {
9 | OnClientUpdated += (sender, e) => User.SetClient(Client);
10 | }
11 |
12 | [JsonProperty("user")]
13 | public DiscordUser User { get; private set; }
14 |
15 | [JsonProperty("channel_id")]
16 | private readonly ulong _channelId;
17 |
18 | public MinimalChannel Channel
19 | {
20 | get { return new MinimalChannel(_channelId).SetClient(Client); }
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Community/WelcomeChannel.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class WelcomeChannel : Controllable
6 | {
7 | [JsonProperty("channel_id")]
8 | private readonly ulong _id;
9 |
10 | public MinimalTextChannel Channel
11 | {
12 | get { return new MinimalTextChannel(_id).SetClient(Client); }
13 | }
14 |
15 | [JsonProperty("description")]
16 | public string Description { get; private set; }
17 |
18 | [JsonProperty("emoji_id")]
19 | public ulong? EmojiId { get; private set; }
20 |
21 | [JsonProperty("emoji_name")]
22 | public string EmojiName { get; private set; }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Anarchy/REST/Message/Reaction/MessageReaction.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class MessageReaction : Controllable
6 | {
7 | public MessageReaction()
8 | {
9 | OnClientUpdated += (sender, e) => Emoji.SetClient(Client);
10 | }
11 |
12 | [JsonProperty("emoji")]
13 | public PartialEmoji Emoji { get; private set; }
14 |
15 | [JsonProperty("count")]
16 | public uint Count { get; private set; }
17 |
18 | [JsonProperty("me")]
19 | public bool ClientHasReacted { get; private set; }
20 |
21 | public override string ToString()
22 | {
23 | return Emoji.ToString();
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/Anarchy/REST/Emoji/Models/EmojiContainer.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord.Gateway
5 | {
6 | internal class EmojiContainer : Controllable
7 | {
8 | public EmojiContainer()
9 | {
10 | OnClientUpdated += (sender, e) =>
11 | {
12 | Emojis.SetClientsInList(Client);
13 |
14 | foreach (var emoji in Emojis)
15 | emoji.GuildId = GuildId;
16 | };
17 | }
18 |
19 | [JsonProperty("guild_id")]
20 | public ulong GuildId { get; private set; }
21 |
22 | [JsonProperty("emojis")]
23 | public IReadOnlyList Emojis { get; private set; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Session/DiscordGatewayIntent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Gateway
4 | {
5 | [Flags]
6 | public enum DiscordGatewayIntent
7 | {
8 | Guilds = 1 << 0,
9 | GuildMembers = 1 << 1,
10 | GuildBans = 1 << 2,
11 | GuildEmojis = 1 << 3,
12 | GuildIntegrations = 1 << 4,
13 | GuildWebhooks = 1 << 5,
14 | GuildInvites = 1 << 6,
15 | GuildVoiceStates = 1 << 7,
16 | GuildPresences = 1 << 8,
17 | GuildMessages = 1 << 9,
18 | GuildMessageReactions = 1 << 10,
19 | GuildMessageTyping = 1 << 11,
20 | DirectMessages = 1 << 12,
21 | DirectMessageReactions = 1 << 13,
22 | DirectMessageTyping = 1 << 14
23 | }
24 | }
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Livestreaming/LivestreamDisconnectEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Media
4 | {
5 | public class LivestreamDisconnectEventArgs : EventArgs
6 | {
7 | public ulong StreamerId { get; }
8 |
9 | public string RawReason { get; }
10 | public DiscordLivestreamError Reason { get; }
11 |
12 | internal LivestreamDisconnectEventArgs(ulong streamerId, GoLiveDelete goLive)
13 | {
14 | StreamerId = streamerId;
15 |
16 | RawReason = goLive.RawReason;
17 |
18 | if (Enum.TryParse(RawReason.Replace("_", ""), true, out DiscordLivestreamError err)) Reason = err;
19 | else Reason = DiscordLivestreamError.Unknown;
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Examples/MusicBot/AudioTrack.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 |
3 | namespace MusicBot
4 | {
5 | public class AudioTrack
6 | {
7 | public string Id { get; private set; }
8 | public string Title { get; private set; }
9 | public string ChannelName { get; private set; }
10 |
11 | public CancellationTokenSource CancellationTokenSource { get; private set; }
12 |
13 | public AudioTrack(string id)
14 | {
15 | Id = id;
16 |
17 | var video = Program.YouTubeClient.Videos.GetAsync(id).Result;
18 | Title = video.Title;
19 | ChannelName = video.Author.ChannelTitle;
20 |
21 | CancellationTokenSource = new CancellationTokenSource();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Anarchy/Local/DiscordParameter.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | /// Type of property
4 | internal class DiscordParameter
5 | {
6 | public bool Set { get; private set; }
7 |
8 | private T _value;
9 | public T Value
10 | {
11 | get { return _value; }
12 | set
13 | {
14 | _value = value;
15 |
16 | Set = true;
17 | }
18 | }
19 |
20 | public static implicit operator T(DiscordParameter instance)
21 | {
22 | return instance.Value;
23 | }
24 |
25 | public override string ToString()
26 | {
27 | return Value.ToString();
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Member/Models/MemberPruneProperties.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public class MemberPruneProperties
7 | {
8 | public MemberPruneProperties()
9 | {
10 | IncludedRoles = new List();
11 | Days = 7;
12 | _computePrunes = true;
13 | }
14 |
15 | [JsonProperty("compute_prune_count")]
16 | #pragma warning disable IDE0052
17 | private readonly bool _computePrunes;
18 | #pragma warning restore
19 |
20 | [JsonProperty("days")]
21 | public uint Days { get; set; }
22 |
23 | [JsonProperty("include_roles")]
24 | public List IncludedRoles { get; set; }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Anarchy/REST/User/Profile/DiscordUserProfileUser.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public class DiscordUserProfileUser
7 | {
8 | [JsonProperty("pronouns")]
9 | public string Pronouns { get; private set; }
10 |
11 | [JsonProperty("theme_colors")]
12 | public List ThemeColors { get; private set; }
13 |
14 | [JsonProperty("popout_animation_particle_type")] // i don't know what the type/value of this is supposed to be so i'll just set it as string for now
15 | public string PopoutAnimationParticleType { get; private set; }
16 |
17 | [JsonProperty("emoji")]
18 | public string Emoji { get; private set; }
19 | }
20 | }
--------------------------------------------------------------------------------
/Anarchy/REST/User/Settings/CustomStatus.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class CustomStatus
6 | {
7 | private readonly DiscordParameter EmojiProperty = new DiscordParameter();
8 | [JsonProperty("emoji_id")]
9 | public ulong? EmojiId
10 | {
11 | get { return EmojiProperty; }
12 | set { EmojiProperty.Value = value; }
13 | }
14 |
15 | public bool ShouldSerializeEmojiId()
16 | {
17 | return EmojiProperty.Set;
18 | }
19 |
20 | [JsonProperty("emoji_name")]
21 | public string EmojiName { get; set; }
22 |
23 | [JsonProperty("text")]
24 | public string Text { get; set; }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Anarchy/REST/Message/Message/Stickers/DiscordSticker.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class DiscordSticker
6 | {
7 | [JsonProperty("id")]
8 | public ulong Id { get; private set; }
9 |
10 | [JsonProperty("pack_id")]
11 | public ulong PackId { get; private set; }
12 |
13 | [JsonProperty("name")]
14 | public string Name { get; private set; }
15 |
16 | [JsonProperty("description")]
17 | public string Description { get; private set; }
18 |
19 | [JsonProperty("asset")]
20 | public string AssetHash { get; private set; }
21 |
22 | [JsonProperty("format_type")]
23 | public StickerFormatType FormatType { get; private set; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Threads/DiscordThreadMetadata.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public class DiscordThreadMetadata
7 | {
8 | [JsonProperty("archived")]
9 | public bool Archived { get; private set; }
10 |
11 | [JsonProperty("archive_timestamp")]
12 | public DateTime? ArchivedAt { get; private set; }
13 |
14 | [JsonProperty("auto_archive_duration")]
15 | private readonly int _duration;
16 | public TimeSpan TTL => new TimeSpan(0, _duration, 0);
17 |
18 | [JsonProperty("locked")]
19 | public bool Locked { get; private set; }
20 |
21 | [JsonProperty("create_timestamp")]
22 | public DateTime? CreatedAt { get; private set; }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Anarchy/REST/Message/Message/Components/Input/SelectMenuComponent.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public class SelectMenuComponent : MessageInputComponent
7 | {
8 | public SelectMenuComponent()
9 | {
10 | Type = MessageComponentType.Select;
11 | }
12 |
13 | [JsonProperty("options")]
14 | public List Options { get; set; }
15 |
16 | [JsonProperty("min_values")]
17 | public uint? MinimumSelected { get; set; }
18 |
19 | [JsonProperty("max_values")]
20 | public uint? MaxSelected { get; set; }
21 |
22 | [JsonProperty("placeholder")]
23 | public string Placeholder { get; set; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Guild/Member/Query/GuildMembersEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using Discord.Gateway;
4 |
5 | namespace Discord
6 | {
7 | public class GuildMembersEventArgs : EventArgs
8 | {
9 | public ulong GuildId { get; private set; }
10 | public IReadOnlyList Members { get; private set; }
11 |
12 | public int Index { get; private set; }
13 | public int Total { get; private set; }
14 |
15 | internal GuildMembersEventArgs(GuildMemberList members)
16 | {
17 | Index = members.ChunkIndex;
18 | Total = members.ChunkCount;
19 | GuildId = members.GuildId;
20 | Members = members.Members;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Role/RoleUpdate.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Gateway
4 | {
5 | internal class RoleUpdate : Controllable
6 | {
7 | public RoleUpdate()
8 | {
9 | OnClientUpdated += (sender, e) => Role.SetClient(Client);
10 | }
11 |
12 | private ulong _guildId;
13 | [JsonProperty("guild_id")]
14 | public ulong GuildId
15 | {
16 | get { return _guildId; }
17 | set { Role.GuildId = _guildId = value; }
18 | }
19 |
20 | [JsonProperty("role")]
21 | public DiscordRole Role { get; private set; }
22 |
23 | public override string ToString()
24 | {
25 | return Role.ToString();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Anarchy/REST/Gifts/DiscordGift.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class DiscordGift : Controllable
6 | {
7 | [JsonProperty("id")]
8 | public ulong Id { get; private set; }
9 |
10 | [JsonProperty("sku_id")]
11 | public ulong SkuId { get; private set; }
12 |
13 | [JsonProperty("application_id")]
14 | public ulong ApplicationId { get; private set; }
15 |
16 | [JsonProperty("user")]
17 | public DiscordUser Gifter { get; private set; }
18 |
19 | [JsonProperty("consumed")]
20 | public bool Consumed { get; private set; }
21 |
22 | [JsonProperty("subscription_plan")]
23 | public SubscriptionPlan SubscriptionPlan { get; private set; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Channel/Unread/GuildUnreadMessages.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord.Gateway
5 | {
6 | public class GuildUnreadMessages : Controllable
7 | {
8 | public GuildUnreadMessages()
9 | {
10 | OnClientUpdated += (s, args) => Channels.SetClientsInList(Client);
11 | }
12 |
13 | [JsonProperty("guild_id")]
14 | private readonly ulong _guildId;
15 |
16 | public MinimalGuild Guild
17 | {
18 | get { return new MinimalGuild(_guildId).SetClient(Client); }
19 | }
20 |
21 | [JsonProperty("channel_unread_updates")]
22 | public IReadOnlyList Channels { get; private set; }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Anarchy/Local/Controllable/Extensions.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace Discord
4 | {
5 | public static class ControllableExtensions
6 | {
7 | public static T SetClient(this T @class, DiscordClient client) where T : Controllable
8 | {
9 | if (@class != null)
10 | @class.Client = client;
11 | return @class;
12 | }
13 |
14 | internal static IReadOnlyList SetClientsInList(this IReadOnlyList classes, DiscordClient client) where T : Controllable
15 | {
16 | if (classes != null)
17 | {
18 | foreach (var @class in classes)
19 | @class.Client = client;
20 | }
21 | return classes;
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/Anarchy/REST/Message/Message/MessageReference.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class MessageReference
6 | {
7 | public MessageReference() { }
8 |
9 | public MessageReference(ulong messageId)
10 | {
11 | MessageId = messageId;
12 | }
13 |
14 | public MessageReference(ulong guildId, ulong messageId) : this(messageId)
15 | {
16 | GuildId = guildId;
17 | }
18 |
19 | [JsonProperty("channel_id")]
20 | public ulong ChannelId { get; internal set; }
21 |
22 | [JsonProperty("guild_id")]
23 | public ulong GuildId { get; private set; }
24 |
25 | [JsonProperty("message_id")]
26 | public ulong MessageId { get; private set; }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Channel/Private/DiscordCall.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord.Gateway
5 | {
6 | public class DiscordCall : Controllable
7 | {
8 | [JsonProperty("channel_id")]
9 | private readonly ulong _channelId;
10 |
11 | public MinimalTextChannel Channel
12 | {
13 | get { return new MinimalTextChannel(_channelId).SetClient(Client); }
14 | }
15 |
16 | [JsonProperty("message_id")]
17 | public ulong MessageId { get; private set; }
18 |
19 | [JsonProperty("region")]
20 | public string Region { get; private set; }
21 |
22 | [JsonProperty("ringing")]
23 | public IReadOnlyList Ringing { get; private set; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Presence/Activity/User/DiscordGameActivity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 | using Newtonsoft.Json.Linq;
4 |
5 | namespace Discord.Gateway
6 | {
7 | public class DiscordGameActivity : DiscordActivity
8 | {
9 | [JsonProperty("application_id")]
10 | public string ApplicationId { get; private set; }
11 |
12 | [JsonProperty("timestamps")]
13 | private readonly JObject _obj;
14 |
15 | public DateTimeOffset? Since
16 | {
17 | get
18 | {
19 | if (_obj != null)
20 | return DateTimeOffset.FromUnixTimeMilliseconds(_obj.Value("start"));
21 | else
22 | return null;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Session/Auth/Resume.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Gateway
4 | {
5 | internal class GatewayResume
6 | {
7 | // This ctor isn't used anywhere, it's just c# generics being autistic /shrug
8 | public GatewayResume() { }
9 |
10 | internal GatewayResume(DiscordSocketClient client)
11 | {
12 | Token = client.Token;
13 | SessionId = client.SessionId;
14 | Sequence = client.Sequence;
15 | }
16 |
17 | [JsonProperty("token")]
18 | public string Token { get; set; }
19 |
20 | [JsonProperty("session_id")]
21 | public string SessionId { get; set; }
22 |
23 | [JsonProperty("seq")]
24 | public uint? Sequence { get; set; }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Anarchy/REST/Embed/Field.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class EmbedField
6 | {
7 | public EmbedField()
8 | {
9 |
10 | }
11 |
12 | internal EmbedField(string name, string content, bool inline)
13 | {
14 | Name = name;
15 | Content = content;
16 | Inline = inline;
17 | }
18 |
19 | [JsonProperty("name")]
20 | public string Name { get; private set; }
21 |
22 | [JsonProperty("value")]
23 | public string Content { get; private set; }
24 |
25 | [JsonProperty("inline")]
26 | public bool Inline { get; private set; }
27 |
28 | public override string ToString()
29 | {
30 | return Name;
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Guild/Member/List/MemberListUpdateOperation.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord.Gateway
5 | {
6 | public class MemberListUpdateOperation : Controllable
7 | {
8 | public MemberListUpdateOperation()
9 | {
10 | OnClientUpdated += (s, e) => Items.SetClientsInList(Client);
11 | }
12 |
13 | [JsonProperty("range")]
14 | public int[] Range { get; private set; }
15 |
16 | [JsonProperty("index")]
17 | public int Index { get; private set; }
18 |
19 | [JsonProperty("op")]
20 | public string Type { get; private set; }
21 |
22 | [JsonProperty("items")]
23 | public IReadOnlyList Items { get; private set; }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/LockedSocketConfig.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Gateway
2 | {
3 | public class LockedSocketConfig : LockedDiscordConfig
4 | {
5 | public bool Cache { get; }
6 | public bool HandleIncomingMediaData { get; }
7 | public DiscordGatewayIntent? Intents { get; }
8 | public uint VoiceChannelConnectTimeout { get; }
9 | public DiscordShard Shard { get; }
10 |
11 | public LockedSocketConfig(DiscordSocketConfig config) : base(config)
12 | {
13 | Cache = config.Cache;
14 | HandleIncomingMediaData = config.HandleIncomingMediaData;
15 | Intents = config.Intents;
16 | VoiceChannelConnectTimeout = config.VoiceChannelConnectTimeout;
17 | Shard = config.Shard;
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Community/Screening/VerificationFormResponse.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public class VerificationFormResponse : Controllable
7 | {
8 | [JsonProperty("created_at")]
9 | public DateTime SubmittedAt { get; private set; }
10 |
11 | [JsonProperty("rejection_reason")]
12 | public string RejectionReason { get; private set; }
13 |
14 | [JsonProperty("application_status")]
15 | public string ApplicationStatus { get; private set; }
16 |
17 | public bool Approved => ApplicationStatus == "APPROVED";
18 |
19 | [JsonProperty("guild_id")]
20 | private readonly ulong _guildId;
21 |
22 | public MinimalGuild Guild => new MinimalGuild(_guildId).SetClient(Client);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Anarchy.Puppeteer/Anarchy.Puppeteer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | Library
4 | Discord
5 |
6 |
7 |
8 |
9 |
10 | net6.0
11 | false
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Anarchy/REST/LockedDiscordConfig.cs:
--------------------------------------------------------------------------------
1 | using System.Net;
2 |
3 | namespace Discord
4 | {
5 | public class LockedDiscordConfig
6 | {
7 | public IWebProxy Proxy { get; private set; }
8 | public SuperProperties SuperProperties { get; private set; }
9 | public uint RestConnectionRetries { get; private set; }
10 | public uint ApiVersion { get; private set; }
11 | public bool RetryOnRateLimit { get; private set; }
12 |
13 | public LockedDiscordConfig(ApiConfig config)
14 | {
15 | Proxy = config.Proxy;
16 | SuperProperties = config.SuperProperties;
17 | RestConnectionRetries = config.RestConnectionRetries;
18 | ApiVersion = config.ApiVersion;
19 | RetryOnRateLimit = config.RetryOnRateLimit;
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Anarchy/REST/Billing/BillingAddress.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class BillingAddress
6 | {
7 | [JsonProperty("name")]
8 | public string Name { get; private set; }
9 |
10 | [JsonProperty("line_1")]
11 | public string Address1 { get; private set; }
12 |
13 | [JsonProperty("line_2")]
14 | public string Address2 { get; private set; }
15 |
16 | [JsonProperty("city")]
17 | public string City { get; private set; }
18 |
19 | [JsonProperty("state")]
20 | public string State { get; private set; }
21 |
22 | [JsonProperty("country")]
23 | public string Country { get; private set; }
24 |
25 | [JsonProperty("postal_code")]
26 | public dynamic PostalCode { get; private set; }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Anarchy/REST/Channel/Guild/Stage/StageChannel.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public class StageChannel : VoiceChannel
7 | {
8 | [JsonProperty("topic")]
9 | public string Topic { get; private set; }
10 |
11 | [JsonProperty("nsfw")]
12 | public string Nsfw { get; private set; }
13 |
14 | public Task CreateInstanceAsync(string topic, StagePrivacyLevel privacyLevel = StagePrivacyLevel.GuildOnly) =>
15 | Client.CreateStageInstanceAsync(Id, topic, privacyLevel);
16 |
17 | public DiscordStageInstance CreateInstance(string topic, StagePrivacyLevel privacyLevel = StagePrivacyLevel.GuildOnly) =>
18 | CreateInstanceAsync(topic, privacyLevel).GetAwaiter().GetResult();
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Anarchy/REST/Interactions/SlashCommands/ApplicationCommandOption.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public class ApplicationCommandOption
7 | {
8 | [JsonProperty("type")]
9 | public CommandOptionType Type { get; set; }
10 |
11 | [JsonProperty("name")]
12 | public string Name { get; set; }
13 |
14 | [JsonProperty("description")]
15 | public string Description { get; set; }
16 |
17 | [JsonProperty("required")]
18 | public bool Required { get; set; }
19 |
20 | [JsonProperty("choices")]
21 | public IReadOnlyList Choices { get; set; }
22 |
23 | [JsonProperty("options")]
24 | public IReadOnlyList Options { get; set; }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Anarchy/REST/Embed/Footer.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class EmbedFooter
6 | {
7 | [JsonProperty("text")]
8 | private string _text;
9 |
10 | public string Text
11 | {
12 | get { return _text; }
13 | set
14 | {
15 | if (value.Length > 2048)
16 | throw new EmbedException(EmbedError.FooterTextTooLong);
17 |
18 | _text = value;
19 | }
20 | }
21 |
22 | [JsonProperty("icon_url")]
23 | public string IconUrl { get; set; }
24 |
25 | [JsonProperty("proxy_icon_url")]
26 | public string IconProxyUrl { get; private set; }
27 |
28 | public override string ToString()
29 | {
30 | return Text;
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Anarchy/REST/Message/Message/MessageType.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum MessageType
4 | {
5 | Default,
6 | RecipientAdd,
7 | RecipientRemove,
8 | Call,
9 | ChannelNameChange,
10 | ChannelIconChange,
11 | ChannelPinnedMessage,
12 | GuildMemberJoin,
13 | GuildBoosted,
14 | GuildBoostedTier1,
15 | GuildBoostedTier2,
16 | GuildBoostedTier3,
17 | ChannelFollowAdd,
18 | GuildDiscoveryDisgualified = 14,
19 | GuildDiscoveryRequalified,
20 | GuildDiscoveryGracePeriodInitialWarning,
21 | GuildDiscoveryGracePeriodFinalWarning,
22 | ThreadCreated,
23 | Reply,
24 | ChatInputCommand,
25 | ThreadStarterMessage,
26 | GuildInviteReminder,
27 | ContextMenuCommand
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Codecs/MediaCodec.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord.Media
5 | {
6 | internal class MediaCodec
7 | {
8 | [JsonProperty("name")]
9 | public string Name { get; set; }
10 |
11 | [JsonProperty("type")]
12 | private string _type;
13 |
14 | public CodecType Type
15 | {
16 | get
17 | {
18 | return (CodecType) Enum.Parse(typeof(CodecType), _type, true);
19 | }
20 | set
21 | {
22 | _type = value.ToString().ToLower();
23 | }
24 | }
25 |
26 | [JsonProperty("priority")]
27 | public int Priority { get; set; } = 1000;
28 |
29 | [JsonProperty("payload_type")]
30 | public byte PayloadType { get; set; }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Media/Voice/DiscordVoiceStateContainer.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Anarchy;
3 |
4 | namespace Discord.Gateway
5 | {
6 | public class DiscordVoiceStateContainer
7 | {
8 | public DiscordVoiceStateContainer(ulong userId)
9 | {
10 | UserId = userId;
11 | GuildStates = new ConcurrentDictionary();
12 | }
13 |
14 | public ulong UserId { get; private set; }
15 | internal ConcurrentDictionary GuildStates { get; private set; }
16 | public Dictionary GuildVoiceStates
17 | {
18 | get { return new Dictionary(GuildStates); }
19 | }
20 | public DiscordVoiceState PrivateChannelVoiceState { get; internal set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Codecs/Opus/OpusConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord.Media
4 | {
5 | internal class OpusConverter
6 | {
7 | protected IntPtr _ptr;
8 |
9 | public const int SamplingRate = 48000;
10 | public const int Channels = 2;
11 | public const int TimeBetweenFrames = 20;
12 |
13 | public const int SampleBytes = sizeof(short) * Channels;
14 |
15 | public const int FrameSamplesPerChannel = SamplingRate / 1000 * TimeBetweenFrames;
16 | public const int FrameSamples = FrameSamplesPerChannel * Channels;
17 | public const int FrameBytes = FrameSamplesPerChannel * SampleBytes;
18 |
19 | protected void CheckError(OpusError error)
20 | {
21 | if (error < OpusError.OK)
22 | throw new OpusException(error);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/AuditLog/Models/ActionType.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public enum AuditLogActionType
4 | {
5 | GuildUpdate = 1,
6 | ChannelCreate = 10,
7 | ChannelUpdate,
8 | ChannelDelete,
9 | ChannelOverwriteCreate,
10 | ChannelOverwriteUpdate,
11 | ChannelOverwriteDelete,
12 | MemberKick = 20,
13 | MemberPrune,
14 | MemberBan,
15 | MemberUnban,
16 | MemberUpdate,
17 | MemberRoleUpdate,
18 | RoleCreate = 30,
19 | RoleUpdate,
20 | RoleDelete,
21 | InviteCreate = 40,
22 | InviteUpdate,
23 | InviteDlete,
24 | WebhookCreate = 50,
25 | WebhookUpdate,
26 | WebhookDelete,
27 | ReactionCreate = 60,
28 | ReactionUpdate,
29 | ReactionDelete,
30 | MessageDelete = 72
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Anarchy/REST/Subscriptions/Nitro/DiscordNitroSubType.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public class DiscordNitroSubType
4 | {
5 | public string Name { get; private set; }
6 | public ulong SkuId { get; private set; }
7 | public ulong SubscriptionPlanId { get; private set; }
8 | public int ExpectedAmount { get; private set; }
9 |
10 | public DiscordNitroSubType(string name, ulong skuId, ulong subPlanId, int expectedAmount)
11 | {
12 | Name = name;
13 | SkuId = skuId;
14 | SubscriptionPlanId = subPlanId;
15 | ExpectedAmount = expectedAmount;
16 | }
17 |
18 | public override string ToString()
19 | {
20 | string priceStr = ExpectedAmount.ToString();
21 |
22 | return $"{Name} {priceStr.Insert(priceStr.Length - 2, ".")}";
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Anarchy/REST/Channel/Channel/MinimalChannel.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public class MinimalChannel : Controllable
7 | {
8 | [JsonProperty("id")]
9 | public ulong Id { get; private set; }
10 |
11 | public MinimalChannel()
12 | { }
13 |
14 | public MinimalChannel(ulong channelId)
15 | {
16 | Id = channelId;
17 | }
18 |
19 | public async Task DeleteAsync()
20 | {
21 | await Client.DeleteChannelAsync(Id);
22 | }
23 |
24 | ///
25 | /// Deletes the channel
26 | ///
27 | /// The deleted
28 | public void Delete()
29 | {
30 | DeleteAsync().GetAwaiter().GetResult();
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Member/Models/PartialGuildMember.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public class PartialGuildMember : Controllable, IDisposable
7 | {
8 | public PartialGuildMember()
9 | {
10 | OnClientUpdated += (sender, e) => User.SetClient(Client);
11 | }
12 |
13 | [JsonProperty("guild_id")]
14 | internal ulong GuildId { get; set; }
15 |
16 | public MinimalGuild Guild
17 | {
18 | get
19 | {
20 | return new MinimalGuild(GuildId).SetClient(Client);
21 | }
22 | }
23 |
24 | [JsonProperty("user")]
25 | public DiscordUser User { get; internal set; }
26 |
27 | public new void Dispose()
28 | {
29 | User = null;
30 | base.Dispose();
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Anarchy/REST/User/Profile/DiscordBadge.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Discord
4 | {
5 | [Flags]
6 | public enum DiscordBadge
7 | {
8 | None,
9 | DiscordEmployeee = 1 << 0,
10 | DiscordPartner = 1 << 1,
11 | HypesquadEvents = 1 << 2,
12 | BugHunter = 1 << 3,
13 | LocalUser = 1 << 5,
14 | HypeBravery = 1 << 6,
15 | HypeBrilliance = 1 << 7,
16 | HypeBalance = 1 << 8,
17 | EarlySupporter = 1 << 9,
18 | TeamUser = 1 << 10,
19 | System = 1 << 12,
20 | BugHunterLevel2 = 1 << 14,
21 | VerifiedBot = 1 << 16,
22 | VerifiedBotDeveloper = 1 << 17,
23 | CertifiedModerator = 1 << 18,
24 | Spammer = 1 << 20, // not a badge however this flag applies if a user is flagged as spammer.
25 | ActiveDeveloper = 1 << 22
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Anarchy/REST/Message/Message/DeletedMessage.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class DeletedMessage : Controllable
6 | {
7 | [JsonProperty("id")]
8 | public ulong Id { get; private set; }
9 |
10 | [JsonProperty("channel_id")]
11 | private readonly ulong _channelId;
12 |
13 | public MinimalTextChannel Channel => new MinimalTextChannel(_channelId).SetClient(Client);
14 |
15 | [JsonProperty("guild_id")]
16 | private readonly ulong _guildId;
17 |
18 | public MinimalGuild Guild
19 | {
20 | get
21 | {
22 | return new MinimalGuild(_guildId).SetClient(Client);
23 | }
24 | }
25 |
26 | public static implicit operator ulong(DeletedMessage instance)
27 | {
28 | return instance.Id;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Anarchy/REST/Subscriptions/Subscriptions/SubscriptionPlan.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class SubscriptionPlan
6 | {
7 | [JsonProperty("sku_id")]
8 | public ulong SkuId { get; private set; }
9 |
10 | [JsonProperty("name")]
11 | public string Name { get; private set; }
12 |
13 | [JsonProperty("currency")]
14 | public string Currency { get; private set; }
15 |
16 | [JsonProperty("price")]
17 | public int Price { get; private set; }
18 |
19 | [JsonProperty("tax_inclusive")]
20 | public bool TaxInclusive { get; private set; }
21 |
22 | [JsonProperty("id")]
23 | public ulong Id { get; private set; }
24 |
25 | public static implicit operator ulong(SubscriptionPlan instance)
26 | {
27 | return instance.Id;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Gifts/GiftCodeUpdatedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using Newtonsoft.Json.Linq;
3 |
4 | namespace Discord.Gateway
5 | {
6 | public class GiftCodeUpdatedEventArgs : GiftCodeCreatedEventArgs
7 | {
8 | public JObject Json { get; internal set; }
9 |
10 | [JsonProperty("uses")]
11 | public uint Uses { get; private set; }
12 |
13 | [JsonProperty("channel_id")]
14 | private readonly ulong _channelId;
15 |
16 | public MinimalTextChannel Channel
17 | {
18 | get { return new MinimalTextChannel(_channelId).SetClient(Client); }
19 | }
20 |
21 | [JsonProperty("guild_id")]
22 | private readonly ulong _guildId;
23 |
24 | public MinimalGuild Guild
25 | {
26 | get { return new MinimalGuild(_guildId).SetClient(Client); }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Session/Extensions.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Gateway
2 | {
3 | public static class GatewayAuthExtensions
4 | {
5 | ///
6 | /// Logs intot he gateway
7 | ///
8 | internal static void LoginToGateway(this DiscordSocketClient client)
9 | {
10 | client.Send(GatewayOpcode.Identify, new GatewayIdentification()
11 | {
12 | Token = client.Token,
13 | Properties = client.Config.SuperProperties,
14 | Intents = client.User.Type == DiscordUserType.Bot ? client.Config.Intents : null,
15 | Shard = client.Config.Shard
16 | });
17 | }
18 |
19 | internal static void Resume(this DiscordSocketClient client)
20 | {
21 | client.Send(GatewayOpcode.Resume, new GatewayResume(client));
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Session/GatewayIntentBundle.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Gateway
2 | {
3 | public static class GatewayIntentBundles
4 | {
5 | public static DiscordGatewayIntent DirectMessages = DiscordGatewayIntent.DirectMessages | DiscordGatewayIntent.DirectMessageReactions | DiscordGatewayIntent.DirectMessageTyping;
6 |
7 | public static DiscordGatewayIntent GuildAdministration = DiscordGatewayIntent.Guilds | DiscordGatewayIntent.GuildWebhooks | DiscordGatewayIntent.GuildInvites | DiscordGatewayIntent.GuildIntegrations | DiscordGatewayIntent.GuildBans;
8 | public static DiscordGatewayIntent GuildMessages = DiscordGatewayIntent.GuildMessageTyping | DiscordGatewayIntent.GuildMessages | DiscordGatewayIntent.GuildMessageReactions;
9 |
10 | public static DiscordGatewayIntent Guilds = GuildAdministration | GuildMessages | DiscordGatewayIntent.GuildVoiceStates;
11 | }
12 | }
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Guild/Member/BanUpdateEventArgs.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class BanUpdateEventArgs : Controllable
6 | {
7 | public BanUpdateEventArgs()
8 | {
9 | OnClientUpdated += (sender, e) =>
10 | {
11 | User.SetClient(Client);
12 | };
13 | }
14 |
15 | [JsonProperty("guild_id")]
16 | private readonly ulong _guildId;
17 |
18 | public MinimalGuild Guild
19 | {
20 | get
21 | {
22 | return new MinimalGuild(_guildId).SetClient(Client);
23 | }
24 | }
25 |
26 | [JsonProperty("user")]
27 | public DiscordUser User { get; private set; }
28 |
29 | public override string ToString()
30 | {
31 | return User.ToString();
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Anarchy/REST/HTTP/DiscordAttachmentFile.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.Maui.Graphics;
3 |
4 | namespace Discord
5 | {
6 | public class DiscordAttachmentFile
7 | {
8 | public DiscordAttachmentFile(byte[] bytes, ImageFormat imageFormat)
9 | : this(bytes, imageFormat.ToMediaType()) { }
10 |
11 | public DiscordAttachmentFile(byte[] bytes, string mediaType = null)
12 | {
13 | if (bytes == null || bytes.Length == 0)
14 | throw new ArgumentException("May not be null and Length must be > 0.", nameof(bytes));
15 |
16 | Bytes = bytes;
17 | MediaType = mediaType;
18 | }
19 |
20 | public bool IsImage()
21 | {
22 | return DiscordImageMediaType.IsSupportedImageFormat(MediaType);
23 | }
24 |
25 | public byte[] Bytes { get; }
26 | public string MediaType { get; }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Anarchy/REST/OAuth2/Client/DiscordOAuth2Authorization.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | internal class DiscordOAuth2Authorization
7 | {
8 | [JsonProperty("token_type")]
9 | public string TokenType { get; private set; }
10 |
11 | [JsonProperty("access_token")]
12 | public string AccessToken { get; private set; }
13 |
14 | [JsonProperty("expires_in")]
15 | private int _expiresIn
16 | {
17 | set => ExpiresAt = DateTimeOffset.UtcNow.AddSeconds(value);
18 | }
19 |
20 | public DateTimeOffset ExpiresAt { get; private set; }
21 |
22 | [JsonProperty("refresh_token")]
23 | public string RefreshToken { get; private set; }
24 |
25 | [JsonProperty("scope")]
26 | private readonly string _scope;
27 | public string[] Scopes => _scope.Split(' ');
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Guild/BaseGuild.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class BaseGuild : MinimalGuild
6 | {
7 | [JsonProperty("name")]
8 | public string Name { get; private set; }
9 |
10 | [JsonProperty("icon")]
11 | private string _iconHash;
12 |
13 | public DiscordCDNImage Icon
14 | {
15 | get
16 | {
17 | if (_iconHash == null)
18 | return null;
19 | else
20 | return new DiscordCDNImage(CDNEndpoints.GuildIcon, Id, _iconHash);
21 | }
22 | }
23 |
24 | protected void Update(BaseGuild guild)
25 | {
26 | Name = guild.Name;
27 | _iconHash = guild._iconHash;
28 | }
29 |
30 | public override string ToString()
31 | {
32 | return Name;
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Anarchy/REST/Embed/Author.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class EmbedAuthor
6 | {
7 | [JsonProperty("name")]
8 | private string _name;
9 |
10 | public string Name
11 | {
12 | get { return _name; }
13 | set
14 | {
15 | if (value.Length > 256)
16 | throw new EmbedException(EmbedError.AuthorNameToolong);
17 |
18 | _name = value;
19 | }
20 | }
21 |
22 | [JsonProperty("url")]
23 | public string Url { get; set; }
24 |
25 | [JsonProperty("icon_url")]
26 | public string IconUrl { get; set; }
27 |
28 | [JsonProperty("proxy_icon_url")]
29 | public string IconProxyUrl { get; private set; }
30 |
31 | public override string ToString()
32 | {
33 | return Name;
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Media/Payloads/MediaProtocolSelection.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord.Media
5 | {
6 | internal class MediaProtocolSelection
7 | {
8 | [JsonProperty("protocol")]
9 | public string Protocol { get; set; }
10 |
11 | [JsonProperty("data")]
12 | public MediaProtocolData ProtocolData { get; set; }
13 |
14 | [JsonProperty("rtc_connection_id")]
15 | public string RtcConnectionId { get; set; }
16 |
17 | [JsonProperty("codecs")]
18 | public List Codecs { get; set; }
19 |
20 | [JsonProperty("address")]
21 | public string Host
22 | {
23 | get { return ProtocolData.Host; }
24 | }
25 |
26 | [JsonProperty("port")]
27 | public int Port
28 | {
29 | get { return ProtocolData.Port; }
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Anarchy/Commands/SlashCommands/SlashCommand.cs:
--------------------------------------------------------------------------------
1 | using Discord.Gateway;
2 |
3 | namespace Discord.Commands
4 | {
5 | public abstract class SlashCommand
6 | {
7 | public DiscordSocketClient Client { get; private set; }
8 |
9 | public DiscordUser Caller { get; private set; }
10 | public GuildMember CallerMember { get; private set; }
11 |
12 | public MinimalTextChannel Channel { get; private set; }
13 | public MinimalGuild Guild { get; private set; }
14 |
15 | internal void Prepare(DiscordInteraction interaction)
16 | {
17 | Client = (DiscordSocketClient) interaction.Client;
18 |
19 | Caller = interaction.User;
20 | CallerMember = interaction.Member;
21 |
22 | Channel = interaction.Channel;
23 | Guild = interaction.Guild;
24 | }
25 |
26 | public abstract InteractionResponseProperties Handle();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Media/Voice/VoiceDisconnectEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Discord.Media;
3 | using Discord.WebSockets;
4 |
5 | namespace Discord.Gateway
6 | {
7 | public class VoiceDisconnectEventArgs : EventArgs
8 | {
9 | public MinimalGuild Guild { get; }
10 |
11 | public MinimalChannel Channel { get; }
12 |
13 | public DiscordMediaCloseCode Code { get; private set; }
14 | public string Reason { get; private set; }
15 |
16 | internal VoiceDisconnectEventArgs(DiscordSocketClient client, ulong? guildId, ulong channelId, DiscordWebSocketCloseEventArgs close)
17 | {
18 | if (guildId.HasValue) Guild = new MinimalGuild(guildId.Value).SetClient(client);
19 | Channel = new MinimalChannel(channelId).SetClient(client);
20 |
21 | Code = (DiscordMediaCloseCode) close.Code;
22 | Reason = close.Reason;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Anarchy/REST/Interactions/SlashCommands/ApplicationCommandProperties.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public class ApplicationCommandProperties
7 | {
8 | [JsonProperty("name")]
9 | public string Name { get; set; }
10 |
11 | public bool ShouldSerializeName() => Name != null;
12 |
13 | [JsonProperty("description")]
14 | public string Description { get; set; }
15 |
16 | public bool ShouldSerializeDescription() => Description != null;
17 |
18 | [JsonProperty("options")]
19 | public List Options { get; set; }
20 |
21 | public bool ShouldSerializeOptions() => Options != null;
22 |
23 | [JsonProperty("flags")]
24 | private int Flags => 64;
25 |
26 | public bool Ephemeral { get; set; }
27 | public bool ShouldSerializeFlags() => Ephemeral;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Anarchy/REST/Message/Message/DiscordAttachment.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class DiscordAttachment
6 | {
7 | [JsonProperty("id")]
8 | public ulong Id { get; private set; }
9 |
10 | [JsonProperty("filename")]
11 | public string FileName { get; private set; }
12 |
13 | [JsonProperty("description")]
14 | public string Description { get; private set; }
15 |
16 | [JsonProperty("content_type")]
17 | public string ContentType { get; private set; }
18 |
19 | [JsonProperty("url")]
20 | public string Url { get; private set; }
21 |
22 | [JsonProperty("proxy_url")]
23 | public string ProxyUrl { get; private set; }
24 |
25 | [JsonProperty("size")]
26 | public uint FileSize { get; private set; }
27 |
28 | public override string ToString()
29 | {
30 | return Url;
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Invite/InviteDeletedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class InviteDeletedEventArgs : Controllable
6 | {
7 | [JsonProperty("code")]
8 | public string Code { get; private set; }
9 |
10 | [JsonProperty("guild_id")]
11 | private readonly ulong? _guildId;
12 |
13 | public MinimalGuild Guild
14 | {
15 | get
16 | {
17 | if (_guildId.HasValue)
18 | return new MinimalGuild(_guildId.Value).SetClient(Client);
19 | else
20 | return null;
21 | }
22 | }
23 |
24 | [JsonProperty("channel_id")]
25 | private readonly ulong _channelId;
26 |
27 | public MinimalTextChannel Channel
28 | {
29 | get { return new MinimalTextChannel(_channelId).SetClient(Client); }
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Guild/PartialGuild.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Threading.Tasks;
3 | using Newtonsoft.Json;
4 |
5 | namespace Discord
6 | {
7 | public class PartialGuild : BaseGuild
8 | {
9 | [JsonProperty("owner")]
10 | public bool Owner { get; private set; }
11 |
12 | [JsonProperty("permissions")]
13 | public DiscordPermission Permissions { get; private set; }
14 |
15 | [JsonProperty("features")]
16 | public IReadOnlyList Features { get; private set; }
17 |
18 | public async Task GetGuildAsync()
19 | {
20 | return await Client.GetGuildAsync(Id);
21 | }
22 |
23 | ///
24 | /// Gets the full guild ()
25 | ///
26 | public DiscordGuild GetGuild()
27 | {
28 | return GetGuildAsync().GetAwaiter().GetResult();
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Anarchy/REST/Voice/VoiceRegion.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class VoiceRegion
6 | {
7 | [JsonProperty("id")]
8 | public string Id { get; private set; }
9 |
10 | [JsonProperty("name")]
11 | public string Name { get; private set; }
12 |
13 | [JsonProperty("optimal")]
14 | public bool Optimal { get; private set; }
15 |
16 | [JsonProperty("vip")]
17 | public bool Premium { get; private set; }
18 |
19 | [JsonProperty("custom")]
20 | public bool Custom { get; private set; }
21 |
22 | [JsonProperty("deprecated")]
23 | public bool Depcrecated { get; private set; }
24 |
25 | public override string ToString()
26 | {
27 | return Name;
28 | }
29 |
30 | public static implicit operator string(VoiceRegion instance)
31 | {
32 | return instance.Id;
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Media/Livestreaming/StreamKey.cs:
--------------------------------------------------------------------------------
1 | namespace Discord.Media
2 | {
3 | internal class StreamKey
4 | {
5 | internal StreamKey(string key)
6 | {
7 | string[] parts = key.Split(':');
8 |
9 | Location = parts[0];
10 | GuildId = ulong.Parse(parts[1]);
11 | ChannelId = ulong.Parse(parts[2]);
12 | UserId = ulong.Parse(parts[3]);
13 | }
14 |
15 | internal StreamKey(ulong guildId, ulong channelId, ulong userId)
16 | {
17 | Location = "guild";
18 | GuildId = guildId;
19 | ChannelId = channelId;
20 | UserId = userId;
21 | }
22 |
23 | public string Location { get; }
24 | public ulong GuildId { get; }
25 | public ulong ChannelId { get; }
26 | public ulong UserId { get; }
27 |
28 | public string Serialize() => $"{Location}:{GuildId}:{ChannelId}:{UserId}";
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Anarchy/REST/OAuth2/Models/AuthorizedApp.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Threading.Tasks;
3 | using Newtonsoft.Json;
4 |
5 | namespace Discord
6 | {
7 | public class AuthorizedApp : Controllable
8 | {
9 | [JsonProperty("id")]
10 | public ulong Id { get; private set; }
11 |
12 | [JsonProperty("scopes")]
13 | public IReadOnlyList Scopes { get; private set; }
14 |
15 | [JsonProperty("application")]
16 | public OAuth2Application Application { get; private set; }
17 |
18 | public async Task DeauthorizeAsync()
19 | {
20 | await Client.DeauthorizeAppAsync(Id);
21 | }
22 |
23 | public void Deauthorize()
24 | {
25 | DeauthorizeAsync().GetAwaiter().GetResult();
26 | }
27 |
28 | public static implicit operator ulong(AuthorizedApp instance)
29 | {
30 | return instance.Id;
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Anarchy/REST/Subscriptions/Nitro/DiscordBoostSlot.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public class DiscordBoostSlot : Controllable
7 | {
8 | public DiscordBoostSlot()
9 | {
10 | OnClientUpdated += (sender, e) => GuildSubscription.SetClient(Client);
11 | }
12 |
13 | [JsonProperty("id")]
14 | public ulong Id { get; private set; }
15 |
16 | [JsonProperty("subscription_id")]
17 | public ulong ActiveSubscriptionId { get; private set; }
18 |
19 | [JsonProperty("premium_guild_subscription")]
20 | public DiscordGuildSubscription GuildSubscription { get; private set; }
21 |
22 | [JsonProperty("canceled")]
23 | public bool Canceled { get; private set; }
24 |
25 | [JsonProperty("cooldown_ends_at")]
26 | public DateTime? Cooldown { get; private set; }
27 |
28 | // TODO: Get an endpoint for cancelling
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Anarchy/REST/HTTP/DiscordHttpResponse.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json.Linq;
3 |
4 | namespace Discord
5 | {
6 | public class DiscordHttpResponse
7 | {
8 | public int StatusCode { get; private set; }
9 | public JToken Body { get; private set; }
10 |
11 | public DiscordHttpResponse(int statusCode, string content)
12 | {
13 | StatusCode = statusCode;
14 | if (content != null && content.Length != 0)
15 | Body = JToken.Parse(content);
16 | }
17 |
18 | public T Deserialize()
19 | {
20 | return Body.ToObject();
21 | }
22 |
23 | public T ParseDeterministic()
24 | {
25 | return ((JObject) Body).ParseDeterministic();
26 | }
27 |
28 | public List MultipleDeterministic()
29 | {
30 | return ((JArray) Body).MultipleDeterministic();
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Anarchy/REST/User/Profile/DiscordProfileUser.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class DiscordProfileUser : DiscordUser
6 | {
7 | [JsonProperty("global_name")]
8 | public string GlobalName { get; private set; }
9 |
10 | [JsonProperty("bio")]
11 | public string Biography { get; private set; }
12 |
13 | [JsonProperty("banner_color")]
14 | public int? BannerColor { get; private set; }
15 |
16 | [JsonProperty("accent_color")]
17 | public int? AccentColor { get; private set; }
18 |
19 | [JsonProperty("avatar_decoration")]
20 | public int? AvatarDecoration { get; private set; } // unsure of the type here assuming int
21 |
22 | [JsonProperty("banner")]
23 | private readonly string _bannerHash;
24 | public DiscordCDNImage Banner => _bannerHash == null ? null : new DiscordCDNImage(CDNEndpoints.Banner, Id, _bannerHash);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Presence/Activity/Properties/GameActivityProperties.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord.Gateway
5 | {
6 | public class GameActivityProperties : ActivityProperties
7 | {
8 | public GameActivityProperties()
9 | {
10 | _timestamps = new TimestampProperties();
11 | }
12 |
13 | [JsonProperty("type")]
14 | public new ActivityType Type
15 | {
16 | get { return ActivityType.Game; }
17 | }
18 |
19 | [JsonProperty("details")]
20 | public string Details { get; set; }
21 |
22 | [JsonProperty("state")]
23 | public string State { get; set; }
24 |
25 | [JsonProperty("timestamps")]
26 | private readonly TimestampProperties _timestamps;
27 |
28 | public TimeSpan Elapsed
29 | {
30 | get { return _timestamps.Start; }
31 | set { _timestamps.Start = value; }
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Anarchy/Commands/Command/DiscordCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Reflection;
4 |
5 | namespace Discord.Commands
6 | {
7 | public class DiscordCommand : CommandAttribute
8 | {
9 | public DiscordCommand(Type type, CommandAttribute attr) : base(attr.Name, attr.Description)
10 | {
11 | List parameters = new List();
12 | foreach (var property in type.GetProperties(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance))
13 | {
14 | if (CommandHandler.TryGetAttribute(property.GetCustomAttributes(), out ParameterAttribute pAttr))
15 | parameters.Add(new CommandParameter(pAttr, property));
16 | }
17 | Parameters = parameters;
18 | Type = type;
19 | }
20 |
21 | public Type Type { get; private set; }
22 | public IReadOnlyList Parameters { get; private set; }
23 | }
24 | }
--------------------------------------------------------------------------------
/Anarchy/REST/User/Profile/UserProfileUpdate.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | ///
6 | /// Options for changing the account's profile
7 | ///
8 | public class UserProfileUpdate
9 | {
10 | private readonly DiscordParameter _bioParam = new DiscordParameter();
11 | [JsonProperty("bio")]
12 | public string Biography
13 | {
14 | get { return _bioParam; }
15 | set { _bioParam.Value = value; }
16 | }
17 |
18 | public bool ShouldSerializeBiography() => _bioParam.Set;
19 |
20 | private readonly DiscordParameter _proParam = new DiscordParameter();
21 | [JsonProperty("pronouns")]
22 | public string Pronouns
23 | {
24 | get { return _proParam; }
25 | set { _proParam.Value = value; }
26 | }
27 |
28 | public bool ShouldSerializePronouns() => _proParam.Set;
29 | }
30 | }
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Community/Screening/VerificationFormProperties.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace Discord
4 | {
5 | public class VerificationFormProperties
6 | {
7 | private readonly DiscordParameter _descParam = new DiscordParameter();
8 | public string Description
9 | {
10 | get { return _descParam; }
11 | set { _descParam.Value = value; }
12 | }
13 |
14 | public bool ShouldSerializeDescription() => _descParam.Set;
15 |
16 | public List Fields { get; set; }
17 | public bool ShouldSerializeFields() => Fields != null;
18 |
19 | private readonly DiscordParameter _enabledParam = new DiscordParameter();
20 | public bool Enabled
21 | {
22 | get { return _enabledParam; }
23 | set { _enabledParam.Value = value; }
24 | }
25 |
26 | public bool ShouldSerializeEnabled() => _enabledParam.Set;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Presence/Activity/TimestampProperties.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord.Gateway
5 | {
6 | public class TimestampProperties
7 | {
8 | private readonly DiscordParameter _startParam = new DiscordParameter();
9 | [JsonProperty("start")]
10 | private long _startValue
11 | {
12 | get { return _startParam; }
13 | set { _startParam.Value = value; }
14 | }
15 |
16 | private TimeSpan _start;
17 | public TimeSpan Start
18 | {
19 | get { return _start; }
20 | set
21 | {
22 | _start = new TimeSpan(value.Hours > 14 ? 14 : value.Hours, value.Minutes, 0);
23 | _startValue = (DateTimeOffset.UtcNow - _start).ToUnixTimeMilliseconds();
24 | }
25 | }
26 |
27 | public bool ShouldSerialize_startValue()
28 | {
29 | return _startParam.Set;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Permissions/DiscordPermissionOverwrite.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class DiscordPermissionOverwrite
6 | {
7 | [JsonProperty("id")]
8 | public ulong AffectedId { get; internal set; }
9 |
10 | [JsonProperty("type")]
11 | public PermissionOverwriteType Type { get; internal set; }
12 |
13 | [JsonProperty("allow")]
14 | public DiscordPermission Allow { get; internal set; }
15 |
16 | [JsonProperty("deny")]
17 | public DiscordPermission Deny { get; internal set; }
18 |
19 | public OverwrittenPermissionState GetPermissionState(DiscordPermission permission)
20 | {
21 | if (Allow.HasFlag(permission))
22 | return OverwrittenPermissionState.Allow;
23 | else if (Deny.HasFlag(permission))
24 | return OverwrittenPermissionState.Deny;
25 | else
26 | return OverwrittenPermissionState.Inherit;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Guild/Threads/ThreadMembersEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord.Gateway
5 | {
6 | public class ThreadMembersEventArgs : Controllable
7 | {
8 | public ThreadMembersEventArgs()
9 | {
10 | OnClientUpdated += (s, e) => AddedMembers.SetClientsInList(Client);
11 | }
12 |
13 | [JsonProperty("id")]
14 | public ulong Id { get; private set; }
15 |
16 | [JsonProperty("guild_id")]
17 | private readonly ulong _guildId;
18 | public MinimalGuild Guild => new MinimalGuild(_guildId).SetClient(Client);
19 |
20 | [JsonProperty("member_count")]
21 | public int MemberCount { get; private set; }
22 |
23 | [JsonProperty("added_members")]
24 | public IReadOnlyList AddedMembers { get; private set; }
25 |
26 | [JsonProperty("removed_member_ids")]
27 | public IReadOnlyList RemovedMembers { get; private set; }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Guild/Member/List/DiscordMemberListUpdate.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord.Gateway
5 | {
6 | public class DiscordMemberListUpdate : Controllable
7 | {
8 | public DiscordMemberListUpdate()
9 | {
10 | OnClientUpdated += (s, e) => Operations.SetClientsInList(Client);
11 | }
12 |
13 | [JsonProperty("ops")]
14 | public IReadOnlyList Operations { get; private set; }
15 |
16 | [JsonProperty("online_count")]
17 | public uint OnlineMembers { get; private set; }
18 |
19 | [JsonProperty("member_count")]
20 | public uint Members { get; private set; }
21 |
22 | [JsonProperty("guild_id")]
23 | private readonly ulong _guildId;
24 |
25 | public MinimalGuild Guild => new MinimalGuild(_guildId).SetClient(Client);
26 |
27 | [JsonProperty("groups")]
28 | public IReadOnlyList Groups { get; private set; }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Guild/SystemChannelInformation.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public class SystemChannelInformation : Controllable
4 | {
5 | private readonly ulong? _channelId;
6 |
7 | public MinimalTextChannel Channel
8 | {
9 | get
10 | {
11 | if (_channelId.HasValue)
12 | return new MinimalTextChannel(_channelId.Value).SetClient(Client);
13 | else
14 | return null;
15 | }
16 | }
17 |
18 | private readonly int _flags;
19 |
20 | public bool SupressJoinNotifications
21 | {
22 | get { return (_flags & 1 << 0) == 1 << 0; }
23 | }
24 |
25 | public bool SupressBoostNotifications
26 | {
27 | get { return (_flags & 1 << 1) == 1 << 1; }
28 | }
29 |
30 | public SystemChannelInformation(ulong? channelId, int flags)
31 | {
32 | _channelId = channelId;
33 | _flags = flags;
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Anarchy/REST/User/Connections/ConnectedAccount.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public class ConnectedAccount : Controllable
7 | {
8 | [JsonProperty("id")]
9 | public string Id { get; private set; }
10 |
11 | [JsonProperty("type")]
12 | private readonly string _type;
13 | public ConnectedAccountType Type
14 | {
15 | get
16 | {
17 | return (ConnectedAccountType) Enum.Parse(typeof(ConnectedAccountType), _type, true);
18 | }
19 | }
20 |
21 | [JsonProperty("name")]
22 | public string Name { get; protected set; }
23 |
24 | [JsonProperty("verified")]
25 | public bool Verified { get; protected set; }
26 |
27 | [JsonProperty("metadata")]
28 | public ConnectedAccountMetadata Metadata { get; protected set; }
29 |
30 | public override string ToString()
31 | {
32 | return Name;
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Anarchy/REST/User/Connections/ConnectionProperties.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class ConnectionProperties
6 | {
7 | private readonly DiscordParameter _visibleParameter = new DiscordParameter();
8 | [JsonProperty("visibility")]
9 | public bool Visible
10 | {
11 | get { return _visibleParameter; }
12 | set { _visibleParameter.Value = value; }
13 | }
14 |
15 | public bool ShouldSerializeVisible()
16 | {
17 | return _visibleParameter.Set;
18 | }
19 |
20 | private readonly DiscordParameter _showParameter = new DiscordParameter();
21 | [JsonProperty("show_activity")]
22 | public bool ShowAsActivity
23 | {
24 | get { return _showParameter; }
25 | set { _showParameter.Value = value; }
26 | }
27 |
28 | public bool ShouldSerializeShowAsActivity()
29 | {
30 | return _showParameter.Set;
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/AuditLog/Models/Entry.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public class AuditLogEntry
7 | {
8 | [JsonProperty("id")]
9 | public ulong Id { get; private set; }
10 |
11 | [JsonProperty("target_id")]
12 | public ulong? TargetId { get; private set; }
13 |
14 | [JsonProperty("changes")]
15 | public IReadOnlyList Changes { get; private set; }
16 |
17 | [JsonProperty("user_id")]
18 | public ulong ChangerId { get; private set; }
19 |
20 | [JsonProperty("action_type")]
21 | public AuditLogActionType Type { get; private set; }
22 |
23 | [JsonProperty("reason")]
24 | public string Reason { get; private set; }
25 |
26 | public override string ToString()
27 | {
28 | return Type.ToString();
29 | }
30 |
31 | public static implicit operator ulong(AuditLogEntry instance)
32 | {
33 | return instance.Id;
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Member/Models/DiscordBan.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class DiscordBan : Controllable
6 | {
7 | public DiscordBan()
8 | {
9 | OnClientUpdated += (sender, e) => User.SetClient(Client);
10 | }
11 |
12 | [JsonProperty("reason")]
13 | public string Reason { get; private set; }
14 |
15 | [JsonProperty("user")]
16 | public DiscordUser User { get; private set; }
17 |
18 | internal ulong GuildId { get; set; }
19 |
20 | public MinimalGuild Guild
21 | {
22 | get
23 | {
24 | return new MinimalGuild(GuildId).SetClient(Client);
25 | }
26 | }
27 |
28 | ///
29 | /// Unbans the user
30 | ///
31 | public void Unban()
32 | {
33 | Client.UnbanGuildMember(GuildId, User.Id);
34 | }
35 |
36 | public override string ToString()
37 | {
38 | return User.ToString();
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Guild/Member/Query/GuildMemberList.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord.Gateway
5 | {
6 | public class GuildMemberList : Controllable
7 | {
8 | public GuildMemberList()
9 | {
10 | OnClientUpdated += (sender, e) => Members.SetClientsInList(Client);
11 | }
12 |
13 | private ulong _guildId;
14 | [JsonProperty("guild_id")]
15 | public ulong GuildId
16 | {
17 | get { return _guildId; }
18 | set
19 | {
20 | _guildId = value;
21 | foreach (var member in Members)
22 | member.GuildId = _guildId;
23 | }
24 | }
25 |
26 | [JsonProperty("members")]
27 | public IReadOnlyList Members { get; private set; }
28 |
29 | [JsonProperty("chunk_index")]
30 | public int ChunkIndex { get; private set; }
31 |
32 | [JsonProperty("chunk_count")]
33 | public int ChunkCount { get; private set; }
34 | }
35 | }
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Interaction/Forms/ComponentFormSelectMenu.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Threading.Tasks;
3 |
4 | namespace Discord.Gateway
5 | {
6 | public class ComponentFormSelectMenu : ComponentFormInput
7 | {
8 | public delegate void SelectHandler(object sender, FormSelectMenuEventArgs args);
9 | public event SelectHandler OnSelect;
10 |
11 | public List Options { get; }
12 | public string Placeholder { get; set; }
13 | public uint? MinimumSelected { get; set; }
14 | public uint? MaxSelected { get; set; }
15 | public bool Disabled { get; set; }
16 |
17 | public ComponentFormSelectMenu(List options)
18 | {
19 | Options = options;
20 | }
21 |
22 | internal override void Handle(DiscordSocketClient client, DiscordInteraction interaction)
23 | {
24 | if (OnSelect != null)
25 | Task.Run(() => OnSelect.Invoke(this, new FormSelectMenuEventArgs(client, interaction)));
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Anarchy/REST/Invite/Models/GuildInvite.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | public class GuildInvite : DiscordInvite
6 | {
7 | public GuildInvite()
8 | {
9 | OnClientUpdated += (s, e) =>
10 | {
11 | if (_guild != null)
12 | {
13 | ((GuildChannel) Channel).GuildId = _guild.Id;
14 | _guild.SetClient(Client);
15 | }
16 | };
17 | }
18 |
19 | public InviteGuild Guild => _guild;
20 |
21 | [JsonProperty("temporary")]
22 | public bool Temporary { get; private set; }
23 |
24 | [JsonProperty("uses")]
25 | public uint Uses { get; private set; }
26 |
27 | [JsonProperty("max_uses")]
28 | public uint MaxUses { get; private set; }
29 |
30 | [JsonProperty("approximate_presence_count")]
31 | public uint OnlineMembers { get; private set; }
32 |
33 | [JsonProperty("approximate_member_count")]
34 | public uint TotalMembers { get; private set; }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Anarchy/REST/Relationships/Models/DiscordRelationship.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public class DiscordRelationship : Controllable
7 | {
8 | public DiscordRelationship()
9 | {
10 | OnClientUpdated += (sender, e) => User.SetClient(Client);
11 | }
12 |
13 | [JsonProperty("user")]
14 | public DiscordUser User { get; private set; }
15 |
16 | [JsonProperty("type")]
17 | public RelationshipType Type { get; internal set; }
18 |
19 | public async Task RemoveAsync()
20 | {
21 | await Client.RemoveRelationshipAsync(User.Id);
22 | }
23 |
24 | public void Remove()
25 | {
26 | RemoveAsync().GetAwaiter().GetResult();
27 | }
28 |
29 | public override string ToString()
30 | {
31 | return $"{Type} {User}";
32 | }
33 |
34 | public static implicit operator ulong(DiscordRelationship instance)
35 | {
36 | return instance.User.Id;
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/Examples/TicTacToe/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Threading;
4 | using Discord.Gateway;
5 |
6 | namespace TicTacToe
7 | {
8 | internal class Program
9 | {
10 | public static Dictionary Games = new Dictionary();
11 |
12 | private static void Main(string[] args)
13 | {
14 | Console.Write("Bot token: ");
15 | string token = Console.ReadLine();
16 |
17 | // this bot does not actually require any intents, but we have to add at least one :/
18 | DiscordSocketClient client = new DiscordSocketClient(new DiscordSocketConfig() { Intents = DiscordGatewayIntent.Guilds });
19 | client.OnLoggedIn += Client_OnLoggedIn;
20 | client.Login("Bot " + token);
21 |
22 | Thread.Sleep(-1);
23 | }
24 |
25 | private static void Client_OnLoggedIn(DiscordSocketClient client, LoginEventArgs args)
26 | {
27 | Console.WriteLine("Logged in");
28 |
29 | client.RegisterSlashCommands();
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Anarchy/REST/Channel/Private/Group/GroupProperties.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | ///
6 | /// Options for modifying a
7 | ///
8 | public class GroupProperties
9 | {
10 | private readonly DiscordParameter NameProperty = new DiscordParameter();
11 | [JsonProperty("name")]
12 | public string Name
13 | {
14 | get { return NameProperty; }
15 | set { NameProperty.Value = value; }
16 | }
17 |
18 | public bool ShouldSerializeName()
19 | {
20 | return NameProperty.Set;
21 | }
22 |
23 | internal readonly DiscordParameter IconProperty = new DiscordParameter();
24 | [JsonProperty("icon")]
25 | public DiscordImage Icon
26 | {
27 | get { return IconProperty; }
28 | set { IconProperty.Value = value; }
29 | }
30 |
31 | public bool ShouldSerializeIcon()
32 | {
33 | return IconProperty.Set;
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Anarchy/REST/Subscriptions/Nitro/DiscordGuildSubscription.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public class DiscordGuildSubscription : Controllable
7 | {
8 | [JsonProperty("id")]
9 | public ulong Id { get; private set; }
10 |
11 | [JsonProperty("user_id")]
12 | public ulong UserId { get; private set; }
13 |
14 | [JsonProperty("guild_id")]
15 | #pragma warning disable CS0649
16 | private readonly ulong _guildId;
17 | #pragma warning restore CS0649
18 |
19 | public MinimalGuild Guild
20 | {
21 | get
22 | {
23 | return new MinimalGuild(_guildId).SetClient(Client);
24 | }
25 | }
26 |
27 | [JsonProperty("ended")]
28 | public bool Ended { get; private set; }
29 |
30 | public async Task RemoveAsync()
31 | {
32 | await Client.RemoveGuildBoostAsync(_guildId, Id);
33 | }
34 |
35 | public void Remove()
36 | {
37 | RemoveAsync().GetAwaiter().GetResult();
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Media/DiscordMediaServer.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class DiscordMediaServer : Controllable
6 | {
7 | [JsonProperty("token")]
8 | public string Token { get; private set; }
9 |
10 | [JsonProperty("guild_id")]
11 | internal ulong? GuildId { get; set; }
12 |
13 | public MinimalGuild Guild
14 | {
15 | get
16 | {
17 | if (GuildId.HasValue)
18 | return new MinimalGuild(GuildId.Value).SetClient(Client);
19 | else
20 | return null;
21 | }
22 | }
23 |
24 | private string _endpoint;
25 | [JsonProperty("endpoint")]
26 | public string Endpoint
27 | {
28 | get { return _endpoint; }
29 | set
30 | {
31 | if (value != null)
32 | _endpoint = value.Split(':')[0];
33 | }
34 | }
35 |
36 | [JsonProperty("stream_key")]
37 | internal string StreamKey { get; private set; }
38 | }
39 | }
--------------------------------------------------------------------------------
/Anarchy/REST/Interactions/InteractionExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace Discord
4 | {
5 | public static class InteractionExtensions
6 | {
7 | public static Task RespondToInteractionAsync(this DiscordClient client, ulong interactionId, string interactionToken, InteractionCallbackType callbackType, InteractionResponseProperties properties = null) =>
8 | client.HttpClient.PostAsync($"/interactions/{interactionId}/{interactionToken}/callback", new InteractionResponse() { Type = callbackType, Data = properties });
9 |
10 | public static void RespondToInteraction(this DiscordClient client, ulong interactionId, string interactionToken, InteractionCallbackType callbackType, InteractionResponseProperties properties = null) =>
11 | client.RespondToInteractionAsync(interactionId, interactionToken, callbackType, properties);
12 |
13 | public static Task ModifyInteractionResponseAsync(this DiscordClient client, ulong appId, string interactionToken, InteractionResponseProperties changes) =>
14 | client.HttpClient.PatchAsync($"/webhooks/{appId}/{interactionToken}/messages/@original", changes);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Interaction/DiscordInteractionData.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord.Gateway
5 | {
6 | public class DiscordInteractionData : Controllable
7 | {
8 | public DiscordInteractionData()
9 | {
10 | OnClientUpdated += (s, e) => Resolved.SetClient(Client);
11 | }
12 |
13 | [JsonProperty("id")]
14 | public ulong CommandId { get; private set; }
15 |
16 | [JsonProperty("name")]
17 | public string CommandName { get; private set; }
18 |
19 | [JsonProperty("options")]
20 | public IReadOnlyList CommandArguments { get; private set; }
21 |
22 | [JsonProperty("resolved")]
23 | public ResolvedInteractionData Resolved { get; private set; }
24 |
25 | [JsonProperty("custom_id")]
26 | public string ComponentId { get; private set; }
27 |
28 | [JsonProperty("component_type")]
29 | public MessageComponentType ComponentType { get; private set; }
30 |
31 | [JsonProperty("values")]
32 | public string[] SelectMenuValues { get; private set; }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Anarchy/REST/Channel/Guild/Voice/VoiceChannelProperties.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord
4 | {
5 | ///
6 | /// Options for modifying a
7 | ///
8 | public class VoiceChannelProperties : GuildChannelProperties
9 | {
10 | private readonly DiscordParameter BitrateProperty = new DiscordParameter();
11 | [JsonProperty("bitrate")]
12 | public uint Bitrate
13 | {
14 | get { return BitrateProperty; }
15 | set { BitrateProperty.Value = value; }
16 | }
17 |
18 | public bool ShouldSerializeBitrate()
19 | {
20 | return BitrateProperty.Set;
21 | }
22 |
23 | private readonly DiscordParameter UserLimitProperty = new DiscordParameter();
24 | [JsonProperty("user_limit")]
25 | public uint UserLimit
26 | {
27 | get { return UserLimitProperty; }
28 | set { UserLimitProperty.Value = value; }
29 | }
30 |
31 | public bool ShouldSerializeUserLimit()
32 | {
33 | return UserLimitProperty.Set;
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/AuditLog/Models/Filters.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public class AuditLogFilters
4 | {
5 | internal DiscordParameter UserIdProperty = new DiscordParameter();
6 | public long UserId
7 | {
8 | get { return UserIdProperty; }
9 | set { UserIdProperty.Value = value; }
10 | }
11 |
12 | internal DiscordParameter ActionTypeProperty = new DiscordParameter();
13 | public AuditLogActionType ActionType
14 | {
15 | get { return ActionTypeProperty; }
16 | set { ActionTypeProperty.Value = value; }
17 | }
18 |
19 | internal DiscordParameter BeforeIdProperty = new DiscordParameter();
20 | public ulong BeforeId
21 | {
22 | get { return BeforeIdProperty; }
23 | set { BeforeIdProperty.Value = value; }
24 | }
25 |
26 | internal DiscordParameter LimitProperty = new DiscordParameter();
27 | public uint Limit
28 | {
29 | get { return LimitProperty; }
30 | set { LimitProperty.Value = value; }
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/Anarchy/REST/Subscriptions/Nitro/DiscordNitroSubTypes.cs:
--------------------------------------------------------------------------------
1 | namespace Discord
2 | {
3 | public static class DiscordNitroSubTypes
4 | {
5 | public static DiscordNitroSubType ClassicMonthly = new DiscordNitroSubType("Nitro Classic Monthly", 521846918637420545, 511651871736201216, 499);
6 | public static DiscordNitroSubType ClassicYearly = new DiscordNitroSubType("Nitro Classic Yearly", 521846918637420545, 511651876987469824, 4999);
7 |
8 | public static DiscordNitroSubType NitroMonthly = new DiscordNitroSubType("Nitro Monthly", 521847234246082599, 511651880837840896, 999);
9 | public static DiscordNitroSubType NitroYearly = new DiscordNitroSubType("Nitro Yearly", 521847234246082599, 511651885459963904, 9999);
10 |
11 | public static DiscordNitroSubType BasicMonthly = new DiscordNitroSubType("Nitro Basic Monthly", 978380684370378762, 978380692553465866, 299);
12 | public static DiscordNitroSubType BasicYearly = new DiscordNitroSubType("Nitro Basic Yearly", 978380684370378762, 1024422698568122368, 2999);
13 |
14 | public static DiscordNitroSubType GuildBoost = new DiscordNitroSubType("Guild Boost", 628379151761408000, 590665532894740483, 499);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Anarchy.Tests/Accounts.cs:
--------------------------------------------------------------------------------
1 | namespace Anarchy;
2 |
3 | using System.Text.Json;
4 | using Anarchy.Options;
5 |
6 | internal static class Accounts
7 | {
8 | static Accounts()
9 | {
10 | var options = GetOptions();
11 |
12 | Bot = new Account(options.Bot);
13 | User = new Account(options.User);
14 | }
15 |
16 | public static Account Bot { get; set; }
17 | public static Account User { get; set; }
18 |
19 | private static TestOptions GetOptions()
20 | {
21 | const string exampleFilename = @".\appsettings.Example.json";
22 | const string optionsFilename = @".\appsettings.Tests.json";
23 |
24 | var filePath = Path.Combine(Directory.GetCurrentDirectory(), optionsFilename);
25 | if (!File.Exists(filePath))
26 | throw new FileNotFoundException($"The file {optionsFilename} was not found. Create one using {exampleFilename} as a template.", filePath);
27 |
28 | var options = JsonSerializer.Deserialize(File.ReadAllText(filePath));
29 | if (options is null)
30 | throw new FormatException($"The file {optionsFilename} was incomplete or formatted incorrectly.");
31 |
32 | return options;
33 | }
34 | }
--------------------------------------------------------------------------------
/Anarchy/REST/Subscriptions/Subscriptions/DiscordActiveSubscription.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using Newtonsoft.Json;
4 |
5 | namespace Discord
6 | {
7 | public class DiscordActiveSubscription
8 | {
9 | [JsonProperty("id")]
10 | public ulong Id { get; private set; }
11 |
12 | [JsonProperty("type")]
13 | public int Type { get; private set; }
14 |
15 | [JsonProperty("created_at")]
16 | public DateTime CreatedAt { get; private set; }
17 |
18 | [JsonProperty("currency")]
19 | public string Currency { get; private set; }
20 |
21 | [JsonProperty("status")]
22 | public DiscordSubscriptionStatus Status { get; private set; }
23 |
24 | [JsonProperty("payment_source_id")]
25 | public ulong? PaymentMethodId { get; private set; }
26 |
27 | [JsonProperty("payment_gateway_plan_id")]
28 | public string SubscriptionTier { get; private set; }
29 |
30 | [JsonProperty("plan_id")]
31 | public ulong PrimaryPlanId { get; private set; }
32 |
33 | [JsonProperty("items")]
34 | public IReadOnlyList Subscriptions { get; private set; }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Presence/Presence/PresenceProperties.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class PresenceProperties
6 | {
7 | private readonly DiscordParameter _statusParam = new DiscordParameter();
8 | [JsonProperty("status")]
9 | public UserStatus Status
10 | {
11 | get { return _statusParam; }
12 | set { _statusParam.Value = value; }
13 | }
14 |
15 | private readonly DiscordParameter _activityParam = new DiscordParameter();
16 | [JsonProperty("game")]
17 | public ActivityProperties Activity
18 | {
19 | get { return _activityParam; }
20 | set { _activityParam.Value = value; }
21 | }
22 |
23 | [JsonProperty("since")]
24 | #pragma warning disable CS0169, IDE0051
25 | private readonly long _since;
26 | #pragma warning restore CS0169, IDE0051
27 |
28 | [JsonProperty("afk")]
29 | private readonly bool _afk = true;
30 |
31 | public override string ToString()
32 | {
33 | return Status.ToString();
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Anarchy/WebSockets/Gateway/Interaction/Forms/ComponentFormButton.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace Discord.Gateway
4 | {
5 | public class ComponentFormButton : ComponentFormInput
6 | {
7 | public delegate void ClickHandler(object sender, FormInteractionEventArgs args);
8 | public event ClickHandler OnClick;
9 |
10 | public ComponentFormButton(MessageButtonStyle style, string text)
11 | {
12 | Style = style;
13 | Text = text;
14 | }
15 |
16 | public ComponentFormButton(MessageButtonStyle style, PartialEmoji emoji)
17 | {
18 | Style = style;
19 | Emoji = emoji;
20 | }
21 |
22 | public MessageButtonStyle Style { get; }
23 | public string Text { get; }
24 | public PartialEmoji Emoji { get; }
25 | public string RedirectUrl { get; set; }
26 | public bool Disabled { get; set; }
27 |
28 | internal override void Handle(DiscordSocketClient client, DiscordInteraction interaction)
29 | {
30 | if (OnClick != null)
31 | Task.Run(() => OnClick.Invoke(this, new FormInteractionEventArgs(client, interaction)));
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Anarchy/REST/Billing/DiscordPayment.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public class DiscordPayment : Controllable
7 | {
8 | public DiscordPayment()
9 | {
10 | OnClientUpdated += (sender, e) => PaymentMethod.SetClient(Client);
11 | }
12 |
13 | [JsonProperty("id")]
14 | public ulong Id { get; private set; }
15 |
16 | [JsonProperty("created_at")]
17 | public DateTime Timestamp { get; private set; }
18 |
19 | [JsonProperty("currency")]
20 | public string Currency { get; private set; }
21 |
22 | [JsonProperty("amount")]
23 | public string Amount { get; private set; }
24 |
25 | [JsonProperty("status")]
26 | public DiscordPaymentStatus Status { get; private set; }
27 |
28 | [JsonProperty("description")]
29 | public string Description { get; private set; }
30 |
31 | [JsonProperty("flags")]
32 | public DiscordPaymentFlags Flags { get; private set; }
33 |
34 | [JsonProperty("payment_source")]
35 | [JsonConverter(typeof(DeepJsonConverter))]
36 | public PaymentMethod PaymentMethod { get; private set; }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Anarchy/REST/Guild/Settings/ClientGuildSettings.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Newtonsoft.Json;
3 |
4 | namespace Discord
5 | {
6 | public class ClientGuildSettings : Controllable
7 | {
8 | [JsonProperty("guild_id")]
9 | internal ulong? GuildId { get; private set; }
10 |
11 | public MinimalGuild Guild
12 | {
13 | get
14 | {
15 | return new MinimalGuild(GuildId.Value).SetClient(Client);
16 | }
17 | }
18 |
19 | [JsonProperty("muted")]
20 | public bool Muted { get; private set; }
21 |
22 | [JsonProperty("message_notifications")]
23 | public ClientNotificationLevel Notifications { get; private set; }
24 |
25 | [JsonProperty("supress_everyone")]
26 | public bool SupressEveryone { get; private set; }
27 |
28 | [JsonProperty("supress_roles")]
29 | public bool SupressRoles { get; private set; }
30 |
31 | [JsonProperty("mobile_push")]
32 | public bool MobilePushNotifications { get; private set; }
33 |
34 | [JsonProperty("channel_overrides")]
35 | public IReadOnlyList ChannelOverrides { get; private set; }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Anarchy/Local/DiscordImageMediaTypes.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.Maui.Graphics;
3 |
4 | namespace Discord
5 | {
6 | public static class DiscordImageMediaType
7 | {
8 | public static string ToMediaType(this ImageFormat _this)
9 | {
10 | return _this switch
11 | {
12 | ImageFormat.Jpeg => MediaTypeNames.Image.Jpeg,
13 | ImageFormat.Png => "image/png",
14 | ImageFormat.Gif => MediaTypeNames.Image.Gif,
15 | _ => throw new NotSupportedException("ImageFormat not supported.")
16 | };
17 | }
18 |
19 | public static ImageFormat ToImageFormat(string mediaType)
20 | {
21 | return Enum.Parse(mediaType.Replace("image/", string.Empty), true);
22 | }
23 |
24 | public static bool IsSupportedImageFormat(string mediaType)
25 | {
26 | string[] supportedImageTypes = { MediaTypeNames.Image.Png, MediaTypeNames.Image.Jpeg, MediaTypeNames.Image.Gif };
27 |
28 | foreach (var sit in supportedImageTypes)
29 | if (mediaType == sit)
30 | return true;
31 |
32 | return false;
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------