├── .github
├── dependabot.yml
└── workflows
│ ├── test-java-prs.yml
│ ├── test-java.yml
│ └── update-docs.yml
├── .gitignore
├── .idea
├── .name
├── codeStyles
│ ├── Project.xml
│ └── codeStyleConfig.xml
└── inspectionProfiles
│ ├── Real.xml
│ └── profiles_settings.xml
├── .mvn
└── wrapper
│ ├── maven-wrapper.jar
│ └── maven-wrapper.properties
├── LICENSE
├── README.md
├── docs.sh
├── jitpack.yml
├── lombok.config
├── mvnw
├── mvnw.cmd
├── pom.xml
└── src
├── main
├── example
│ ├── basic
│ │ ├── GroovyExample.groovy
│ │ ├── JavaExample.java
│ │ ├── KotlinExample.kt
│ │ └── ScalaExample.scala
│ └── slash
│ │ └── JavaExample.java
├── java-templates
│ └── com
│ │ └── mewna
│ │ └── catnip
│ │ └── util
│ │ └── CatnipMeta.java
└── java
│ └── com
│ └── mewna
│ └── catnip
│ ├── Catnip.java
│ ├── CatnipOptions.java
│ ├── cache
│ ├── CustomizableEntityCache.java
│ ├── EntityCache.java
│ ├── EntityCacheWorker.java
│ ├── MemoryEntityCache.java
│ ├── NoopEntityCache.java
│ ├── SplitMemoryEntityCache.java
│ ├── UnifiedMemoryEntityCache.java
│ └── view
│ │ ├── CacheView.java
│ │ ├── CompositeCacheView.java
│ │ ├── CompositeNamedCacheView.java
│ │ ├── DefaultCacheView.java
│ │ ├── DefaultNamedCacheView.java
│ │ ├── KolobokeLongEntityMap.java
│ │ ├── LongEntityMap.java
│ │ ├── MutableCacheView.java
│ │ ├── MutableNamedCacheView.java
│ │ ├── NamedCacheView.java
│ │ └── NoopCacheView.java
│ ├── entity
│ ├── Entity.java
│ ├── RequiresCatnip.java
│ ├── builder
│ │ ├── EmbedBuilder.java
│ │ ├── PresenceBuilder.java
│ │ ├── command
│ │ │ ├── CommandOptionBuilder.java
│ │ │ ├── CommandOptionChoiceBuilder.java
│ │ │ ├── InteractionApplicationCommandCallbackDataBuilder.java
│ │ │ └── InteractionResponseBuilder.java
│ │ └── component
│ │ │ ├── ActionRowBuilder.java
│ │ │ ├── ButtonBuilder.java
│ │ │ └── SelectBuilder.java
│ ├── channel
│ │ ├── Category.java
│ │ ├── Channel.java
│ │ ├── ChannelMention.java
│ │ ├── ChannelPinsUpdate.java
│ │ ├── DMChannel.java
│ │ ├── DeletedThread.java
│ │ ├── GroupDMChannel.java
│ │ ├── GuildChannel.java
│ │ ├── MessageChannel.java
│ │ ├── NewsChannel.java
│ │ ├── StageChannel.java
│ │ ├── StoreChannel.java
│ │ ├── TextChannel.java
│ │ ├── ThreadChannel.java
│ │ ├── ThreadListSync.java
│ │ ├── ThreadMembersUpdate.java
│ │ ├── UserDMChannel.java
│ │ ├── VoiceChannel.java
│ │ ├── Webhook.java
│ │ └── WebhooksUpdate.java
│ ├── delegate
│ │ ├── DefaultEntityDelegator.java
│ │ └── EntityDelegator.java
│ ├── guild
│ │ ├── DeletedInvite.java
│ │ ├── EmojiUpdate.java
│ │ ├── GatewayGuildBan.java
│ │ ├── Guild.java
│ │ ├── GuildBan.java
│ │ ├── GuildEmbed.java
│ │ ├── GuildFeature.java
│ │ ├── Invite.java
│ │ ├── Member.java
│ │ ├── PartialGuild.java
│ │ ├── PartialMember.java
│ │ ├── PartialRole.java
│ │ ├── PermissionOverride.java
│ │ ├── Role.java
│ │ ├── RoleTags.java
│ │ ├── Template.java
│ │ ├── UnavailableGuild.java
│ │ └── audit
│ │ │ ├── ActionType.java
│ │ │ ├── AuditLogChange.java
│ │ │ ├── AuditLogEntry.java
│ │ │ ├── MemberDisconnectInfo.java
│ │ │ ├── MemberMoveInfo.java
│ │ │ ├── MemberPruneInfo.java
│ │ │ ├── MessageBulkDeleteInfo.java
│ │ │ ├── MessageDeleteInfo.java
│ │ │ ├── MessagePinInfo.java
│ │ │ ├── OptionalEntryInfo.java
│ │ │ └── OverrideUpdateInfo.java
│ ├── impl
│ │ ├── EntityBuilder.java
│ │ ├── channel
│ │ │ ├── CategoryImpl.java
│ │ │ ├── ChannelMentionImpl.java
│ │ │ ├── ChannelPinsUpdateImpl.java
│ │ │ ├── DeletedThreadImpl.java
│ │ │ ├── GroupDMChannelImpl.java
│ │ │ ├── NewsChannelImpl.java
│ │ │ ├── StageChannelImpl.java
│ │ │ ├── StoreChannelImpl.java
│ │ │ ├── TextChannelImpl.java
│ │ │ ├── ThreadChannelImpl.java
│ │ │ ├── ThreadListSyncImpl.java
│ │ │ ├── ThreadMembersUpdateImpl.java
│ │ │ ├── UserDMChannelImpl.java
│ │ │ ├── VoiceChannelImpl.java
│ │ │ ├── WebhookImpl.java
│ │ │ └── WebhooksUpdateImpl.java
│ │ ├── guild
│ │ │ ├── DeletedInviteImpl.java
│ │ │ ├── EmojiUpdateImpl.java
│ │ │ ├── GatewayGuildBanImpl.java
│ │ │ ├── GuildBanImpl.java
│ │ │ ├── GuildEmbedImpl.java
│ │ │ ├── GuildImpl.java
│ │ │ ├── InviteImpl.java
│ │ │ ├── MemberImpl.java
│ │ │ ├── PartialGuildImpl.java
│ │ │ ├── PartialMemberImpl.java
│ │ │ ├── PartialRoleImpl.java
│ │ │ ├── PermissionOverrideImpl.java
│ │ │ ├── RoleImpl.java
│ │ │ ├── RoleTagsImpl.java
│ │ │ ├── TemplateImpl.java
│ │ │ ├── UnavailableGuildImpl.java
│ │ │ └── audit
│ │ │ │ ├── AuditLogChangeImpl.java
│ │ │ │ ├── AuditLogEntryImpl.java
│ │ │ │ ├── MemberDisconnectInfoImpl.java
│ │ │ │ ├── MemberMoveInfoImpl.java
│ │ │ │ ├── MemberPruneInfoImpl.java
│ │ │ │ ├── MessageBulkDeleteInfoImpl.java
│ │ │ │ ├── MessageDeleteInfoImpl.java
│ │ │ │ ├── MessagePinInfoImpl.java
│ │ │ │ └── OverrideUpdateInfoImpl.java
│ │ ├── interaction
│ │ │ ├── CustomIdInteractionDataImpl.java
│ │ │ ├── InteractionMemberImpl.java
│ │ │ ├── command
│ │ │ │ ├── ApplicationCommandImpl.java
│ │ │ │ ├── ApplicationCommandInteractionDataImpl.java
│ │ │ │ ├── ApplicationCommandInteractionDataOptionImpl.java
│ │ │ │ ├── ApplicationCommandInteractionImpl.java
│ │ │ │ ├── ApplicationCommandOptionDoubleChoiceImpl.java
│ │ │ │ ├── ApplicationCommandOptionImpl.java
│ │ │ │ ├── ApplicationCommandOptionIntegerChoiceImpl.java
│ │ │ │ ├── ApplicationCommandOptionStringChoiceImpl.java
│ │ │ │ └── InteractionApplicationCommandCallbackDataImpl.java
│ │ │ └── component
│ │ │ │ ├── ButtonInteractionImpl.java
│ │ │ │ ├── InteractionResponseImpl.java
│ │ │ │ └── SelectInteractionImpl.java
│ │ ├── lifecycle
│ │ │ ├── ChunkingDoneImpl.java
│ │ │ ├── GatewayClosedImpl.java
│ │ │ ├── GatewayConnectionFailedImpl.java
│ │ │ ├── HighWebsocketLatencyImpl.java
│ │ │ ├── MemberChunkRerequestImpl.java
│ │ │ └── RestRatelimitHitImpl.java
│ │ ├── message
│ │ │ ├── AttachmentImpl.java
│ │ │ ├── BulkDeletedMessagesImpl.java
│ │ │ ├── BulkRemovedReactionsImpl.java
│ │ │ ├── DeletedMessageImpl.java
│ │ │ ├── EmbedImpl.java
│ │ │ ├── MessageActivityImpl.java
│ │ │ ├── MessageApplicationImpl.java
│ │ │ ├── MessageEmbedUpdateImpl.java
│ │ │ ├── MessageImpl.java
│ │ │ ├── MessageReferenceImpl.java
│ │ │ ├── ReactionImpl.java
│ │ │ ├── ReactionUpdateImpl.java
│ │ │ └── component
│ │ │ │ ├── ActionRowImpl.java
│ │ │ │ ├── ButtonImpl.java
│ │ │ │ └── SelectImpl.java
│ │ ├── misc
│ │ │ ├── ActivityEmojiImpl.java
│ │ │ ├── ApplicationInfoImpl.java
│ │ │ ├── ApplicationOwnerImpl.java
│ │ │ ├── CreatedInviteImpl.java
│ │ │ ├── CustomEmojiImpl.java
│ │ │ ├── GatewayInfoImpl.java
│ │ │ ├── ReadyImpl.java
│ │ │ ├── ResumedImpl.java
│ │ │ ├── TeamImpl.java
│ │ │ ├── TeamMemberImpl.java
│ │ │ └── UnicodeEmojiImpl.java
│ │ ├── sticker
│ │ │ └── StickerImpl.java
│ │ ├── user
│ │ │ ├── PresenceImpl.java
│ │ │ ├── PresenceUpdateImpl.java
│ │ │ ├── TypingUserImpl.java
│ │ │ ├── UserImpl.java
│ │ │ └── VoiceStateImpl.java
│ │ └── voice
│ │ │ ├── VoiceRegionImpl.java
│ │ │ └── VoiceServerUpdateImpl.java
│ ├── interaction
│ │ ├── CustomIdInteractionData.java
│ │ ├── Interaction.java
│ │ ├── InteractionMember.java
│ │ ├── InteractionResponse.java
│ │ ├── InteractionResponseType.java
│ │ ├── InteractionType.java
│ │ ├── command
│ │ │ ├── ApplicationCommand.java
│ │ │ ├── ApplicationCommandInteraction.java
│ │ │ ├── ApplicationCommandInteractionData.java
│ │ │ ├── ApplicationCommandInteractionDataOption.java
│ │ │ ├── ApplicationCommandOption.java
│ │ │ ├── ApplicationCommandOptionChoice.java
│ │ │ ├── ApplicationCommandOptionDoubleChoice.java
│ │ │ ├── ApplicationCommandOptionIntegerChoice.java
│ │ │ ├── ApplicationCommandOptionStringChoice.java
│ │ │ ├── ApplicationCommandOptionType.java
│ │ │ ├── ApplicationCommandType.java
│ │ │ └── InteractionApplicationCommandCallbackData.java
│ │ └── component
│ │ │ ├── ButtonInteraction.java
│ │ │ ├── SelectInteraction.java
│ │ │ └── SelectInteractionData.java
│ ├── lifecycle
│ │ ├── ChunkingDone.java
│ │ ├── GatewayClosed.java
│ │ ├── GatewayConnectionFailed.java
│ │ ├── HighWebsocketLatency.java
│ │ ├── MemberChunkRerequest.java
│ │ └── RestRatelimitHit.java
│ ├── message
│ │ ├── BulkDeletedMessages.java
│ │ ├── BulkRemovedReactions.java
│ │ ├── DeletedMessage.java
│ │ ├── Embed.java
│ │ ├── MentionParseFlag.java
│ │ ├── Message.java
│ │ ├── MessageActivityType.java
│ │ ├── MessageEmbedUpdate.java
│ │ ├── MessageFlag.java
│ │ ├── MessageOptions.java
│ │ ├── MessageReference.java
│ │ ├── MessageType.java
│ │ ├── ReactionUpdate.java
│ │ └── component
│ │ │ ├── ActionRow.java
│ │ │ ├── Button.java
│ │ │ ├── MessageComponent.java
│ │ │ └── Select.java
│ ├── misc
│ │ ├── ApplicationFlag.java
│ │ ├── ApplicationInfo.java
│ │ ├── ApplicationOwner.java
│ │ ├── CreatedInvite.java
│ │ ├── Emoji.java
│ │ ├── GatewayInfo.java
│ │ ├── Ready.java
│ │ ├── Resumed.java
│ │ ├── Team.java
│ │ └── TeamMember.java
│ ├── partials
│ │ ├── GuildEntity.java
│ │ ├── HasApplication.java
│ │ ├── HasChannel.java
│ │ ├── HasCreatedAt.java
│ │ ├── HasCustomId.java
│ │ ├── HasDescription.java
│ │ ├── HasGuild.java
│ │ ├── HasIcon.java
│ │ ├── HasJoinedAt.java
│ │ ├── HasName.java
│ │ ├── HasNullableDescription.java
│ │ ├── HasNullableName.java
│ │ ├── HasOwner.java
│ │ ├── HasParentChannel.java
│ │ ├── HasUpdatedAt.java
│ │ ├── HasUser.java
│ │ ├── Mentionable.java
│ │ ├── Permissable.java
│ │ ├── Snowflake.java
│ │ └── Timestamped.java
│ ├── serialization
│ │ ├── DefaultEntitySerializer.java
│ │ └── EntitySerializer.java
│ ├── sticker
│ │ ├── Sticker.java
│ │ └── StickerFormatType.java
│ ├── user
│ │ ├── Presence.java
│ │ ├── PresenceUpdate.java
│ │ ├── TypingUser.java
│ │ ├── User.java
│ │ ├── UserFlag.java
│ │ └── VoiceState.java
│ ├── util
│ │ ├── ImageOptions.java
│ │ ├── ImageType.java
│ │ └── Permission.java
│ └── voice
│ │ ├── VoiceRegion.java
│ │ └── VoiceServerUpdate.java
│ ├── extension
│ ├── AbstractExtension.java
│ ├── Extension.java
│ ├── hook
│ │ └── CatnipHook.java
│ └── manager
│ │ ├── DefaultExtensionManager.java
│ │ └── ExtensionManager.java
│ ├── internal
│ └── CatnipImpl.java
│ ├── rest
│ ├── JsonErrorCode.java
│ ├── MultipartBodyPublisher.java
│ ├── ResponseException.java
│ ├── ResponsePayload.java
│ ├── Rest.java
│ ├── RestPayloadException.java
│ ├── Routes.java
│ ├── guild
│ │ ├── ChannelData.java
│ │ ├── GuildData.java
│ │ ├── MemberAddOptions.java
│ │ ├── MemberData.java
│ │ ├── PermissionOverrideData.java
│ │ ├── PositionUpdater.java
│ │ └── RoleData.java
│ ├── handler
│ │ ├── RestChannel.java
│ │ ├── RestEmoji.java
│ │ ├── RestGuild.java
│ │ ├── RestHandler.java
│ │ ├── RestInteraction.java
│ │ ├── RestInvite.java
│ │ ├── RestUser.java
│ │ ├── RestVoice.java
│ │ └── RestWebhook.java
│ ├── invite
│ │ └── InviteCreateOptions.java
│ ├── ratelimit
│ │ ├── DefaultRateLimiter.java
│ │ └── RateLimiter.java
│ └── requester
│ │ ├── AbstractRequester.java
│ │ ├── BurstRequester.java
│ │ ├── Requester.java
│ │ └── SerialRequester.java
│ ├── shard
│ ├── CatnipShard.java
│ ├── CatnipShardImpl.java
│ ├── CompressionMode.java
│ ├── DiscordEvent.java
│ ├── DispatchEmitter.java
│ ├── GatewayCloseCode.java
│ ├── GatewayIntent.java
│ ├── GatewayOp.java
│ ├── LifecycleEvent.java
│ ├── LifecycleState.java
│ ├── ShardConnectState.java
│ ├── ShardInfo.java
│ ├── buffer
│ │ ├── AbstractBuffer.java
│ │ ├── CachingBuffer.java
│ │ ├── EventBuffer.java
│ │ └── NoopBuffer.java
│ ├── event
│ │ ├── AbstractDispatchManager.java
│ │ ├── DefaultDispatchManager.java
│ │ ├── DispatchManager.java
│ │ ├── DoubleEventType.java
│ │ ├── DoubleEventTypeImpl.java
│ │ ├── EventType.java
│ │ ├── EventTypeImpl.java
│ │ └── MessageConsumer.java
│ ├── manager
│ │ ├── AbstractShardManager.java
│ │ ├── DefaultShardManager.java
│ │ ├── ShardCondition.java
│ │ └── ShardManager.java
│ ├── ratelimit
│ │ ├── MemoryRatelimiter.java
│ │ └── Ratelimiter.java
│ └── session
│ │ ├── DefaultSessionManager.java
│ │ └── SessionManager.java
│ └── util
│ ├── CDNFormat.java
│ ├── CatnipOptionsView.java
│ ├── HierarchyException.java
│ ├── JsonConvertible.java
│ ├── JsonUtil.java
│ ├── MissingPermissionException.java
│ ├── PermissionUtil.java
│ ├── QueryStringBuilder.java
│ ├── ReentrantLockWebSocket.java
│ ├── UnitHelper.java
│ ├── Utils.java
│ ├── Validators.java
│ ├── logging
│ ├── DefaultLogAdapter.java
│ └── LogAdapter.java
│ ├── pagination
│ ├── ArrayOfObjectPaginator.java
│ ├── AuditLogPaginator.java
│ ├── BasePaginator.java
│ ├── GuildPaginator.java
│ ├── MemberPaginator.java
│ ├── MessagePaginator.java
│ ├── PaginationCallback.java
│ └── ReactionPaginator.java
│ ├── rx
│ └── RxHelpers.java
│ ├── scheduler
│ ├── AbstractTaskScheduler.java
│ ├── RxTaskScheduler.java
│ └── TaskScheduler.java
│ └── task
│ ├── GatewayTask.java
│ ├── QueueTask.java
│ └── ShardConnectTask.java
└── test
├── java
└── com
│ └── mewna
│ └── catnip
│ ├── CatnipTest.java
│ ├── Env.java
│ ├── UniverseTest.java
│ ├── cache
│ └── view
│ │ ├── CompositeCacheViewTests.java
│ │ ├── DefaultCacheViewTests.java
│ │ └── DefaultNamedCacheViewTests.java
│ ├── entity
│ └── ChannelTest.java
│ ├── permission
│ └── BitwiseTest.java
│ ├── rest
│ └── handler
│ │ ├── RestChannelTest.java
│ │ ├── RestEmojiTest.java
│ │ ├── RestGuildTest.java
│ │ ├── RestInviteTest.java
│ │ ├── RestUserTest.java
│ │ ├── RestVoiceTest.java
│ │ └── RestWebhookTest.java
│ ├── shard
│ ├── event
│ │ └── DefaultDispatchManagerTest.java
│ └── ratelimit
│ │ └── MemoryRatelimiterTest.java
│ └── util
│ └── scheduler
│ └── RxTaskSchedulerTest.java
└── resources
└── logback-test.xml
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: maven
4 | directory: "/"
5 | schedule:
6 | interval: daily
7 | open-pull-requests-limit: 10
8 | ignore:
9 | - dependency-name: com.cedarsoftware:java-util
10 | versions:
11 | - "> 1.34.0"
12 | - dependency-name: com.squareup.okhttp3:okhttp
13 | versions:
14 | - "> 3.14.2"
15 | - dependency-name: io.vertx:vertx-core
16 | versions:
17 | - "> 3.8.0"
18 | - dependency-name: io.vertx:vertx-rx-java2
19 | versions:
20 | - "> 3.8.0"
21 | - dependency-name: org.projectlombok:lombok-maven-plugin
22 | versions:
23 | - 1.18.18.0
24 | - 1.18.18.0.0
25 | - 1.18.20.0
26 | - 1.18.20.0.0
27 | - dependency-name: org.projectlombok:lombok
28 | versions:
29 | - 1.18.18
30 | - 1.18.18.0
31 | - 1.18.20
32 | - 1.18.20.0
33 |
--------------------------------------------------------------------------------
/.github/workflows/test-java-prs.yml:
--------------------------------------------------------------------------------
1 | name: Run all tests on PRs
2 | on:
3 | pull_request:
4 | branches:
5 | - mistress
6 |
7 | jobs:
8 | run-tests:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - uses: actions/checkout@v2
12 | - uses: actions/setup-java@v1
13 | with:
14 | java-version: "17"
15 | - run: ./mvnw clean test -DrestTests=false
16 | env:
17 | DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
18 | TEST_GUILD: ${{ secrets.TEST_GUILD }}
19 | TEST_CHANNEL: ${{ secrets.TEST_CHANNEL }}
20 | TEST_GUILD_NAME: ${{ secrets.TEST_GUILD_NAME }}
21 | TEST_USER: ${{ secrets.TEST_USER }}
22 | TEST_USER_NAME: ${{ secrets.TEST_USER_NAME }}
23 | - run: bash <(curl -s https://codecov.io/bash)
--------------------------------------------------------------------------------
/.github/workflows/test-java.yml:
--------------------------------------------------------------------------------
1 | name: Run all tests
2 | on:
3 | push:
4 | branches:
5 | - mistress
6 |
7 | jobs:
8 | run-tests:
9 | if: github.actor != 'dependabot'
10 | runs-on: ubuntu-latest
11 | steps:
12 | - uses: actions/checkout@v2
13 | - uses: actions/setup-java@v1
14 | with:
15 | java-version: "17"
16 | - run: ./mvnw clean test
17 | env:
18 | DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
19 | TEST_GUILD: ${{ secrets.TEST_GUILD }}
20 | TEST_CHANNEL: ${{ secrets.TEST_CHANNEL }}
21 | TEST_GUILD_NAME: ${{ secrets.TEST_GUILD_NAME }}
22 | TEST_USER: ${{ secrets.TEST_USER }}
23 | TEST_USER_NAME: ${{ secrets.TEST_USER_NAME }}
24 | - run: bash <(curl -s https://codecov.io/bash)
--------------------------------------------------------------------------------
/.github/workflows/update-docs.yml:
--------------------------------------------------------------------------------
1 | name: Build docs
2 | on:
3 | push:
4 | branches:
5 | - mistress
6 |
7 | jobs:
8 | update-docs:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - uses: actions/checkout@v2.3.1
12 | with:
13 | persist-credentials: false
14 | - uses: actions/setup-java@v1
15 | with:
16 | java-version: "17"
17 | - run: bash docs.sh
18 | - uses: JamesIves/github-pages-deploy-action@3.6.2
19 | with:
20 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21 | BRANCH: gh-pages
22 | FOLDER: docs
23 | CLEAN: true
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/*.xml
2 | .idea/markdown-navigator
3 | .idea/copyright/*.xml
4 | .idea/dictionaries/*.xml
5 | .idea/libraries
6 | .idea/sonarlint
7 | target/
8 | *.iml
9 | .ceylon
10 | .vertx/
11 | modules/
12 | delombok/
13 | *_pid*.log
14 | /*.java
15 | /src/main/java/*.java
16 | /src/main/resources/logback.xml
17 | /*.sh
18 | !/docs.sh
19 |
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | catnip
--------------------------------------------------------------------------------
/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mewna/catnip/650ea162ac0c51ae055c7ead9b765ab138467ffc/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2018 amy, All rights reserved.
2 |
3 | Redistribution and use in source and binary forms, with or without
4 | modification, are permitted provided that the following conditions are met:
5 |
6 | 1. Redistributions of source code must retain the above copyright notice, this
7 | list of conditions and the following disclaimer.
8 | 2. Redistributions in binary form must reproduce the above copyright notice,
9 | this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | 3. Neither the name of the copyright holder nor the names of its contributors
12 | may be used to endorse or promote products derived from this software without
13 | specific prior written permission.
14 |
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
/docs.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | rm -rf docs
4 | ./mvnw clean compile javadoc:javadoc
5 | cp -r target/site/apidocs ./docs
--------------------------------------------------------------------------------
/jitpack.yml:
--------------------------------------------------------------------------------
1 | before_install:
2 | - wget https://github.com/sormuras/bach/raw/master/install-jdk.sh
3 | - source install-jdk.sh --feature 17
4 | install:
5 | - bash -c "mvn clean install -DskipTests -Dlombok.delombok.skip=true"
--------------------------------------------------------------------------------
/lombok.config:
--------------------------------------------------------------------------------
1 | lombok.accessors.fluent = true
--------------------------------------------------------------------------------
/src/main/example/basic/GroovyExample.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package basic
29 |
30 | import com.mewna.catnip.Catnip
31 | import com.mewna.catnip.shard.DiscordEvent
32 |
33 | /**
34 | * @author Nik
35 | * @since 1/1/19.
36 | */
37 | class GroovyExample {
38 | static void main(args) {
39 | def catnip = Catnip.catnip("your token here")
40 |
41 | catnip.observable(DiscordEvent.MESSAGE_CREATE)
42 | .filter(msg -> msg.content() == "!ping")
43 | .subscribe({ msg ->
44 | msg.respond("!ping")
45 | })
46 | catnip.connect()
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/example/basic/JavaExample.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package basic;
29 |
30 | import com.mewna.catnip.Catnip;
31 | import com.mewna.catnip.shard.DiscordEvent;
32 |
33 | /**
34 | * @author amy
35 | * @since 12/8/18.
36 | */
37 | public class JavaExample {
38 | public static void main(String[] args) {
39 | Catnip catnip = Catnip.catnip("your token goes here");
40 | catnip.observable(DiscordEvent.MESSAGE_CREATE)
41 | .filter(msg -> msg.content().equals("!ping"))
42 | .subscribe(msg -> {
43 | msg.respond("pong!");
44 | });
45 | catnip.connect();
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/example/basic/KotlinExample.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package basic
29 |
30 | import com.mewna.catnip.Catnip
31 | import com.mewna.catnip.entity.message.Message
32 | import com.mewna.catnip.shard.DiscordEvent
33 |
34 | /**
35 | * @author amy
36 | * @since 12/8/18.
37 | */
38 |
39 | fun main(args: Array) {
40 | val catnip: com.mewna.catnip.Catnip = Catnip.catnip("your token here")
41 | catnip.observable(DiscordEvent.MessageCreate)
42 | .filter({ msg -> msg.content() == "!ping" })
43 | .subscribe({ msg ->
44 | msg.respond("pong!")
45 | })
46 | catnip.connect()
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/example/basic/ScalaExample.scala:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package basic
29 |
30 | import com.mewna.catnip.Catnip
31 | import com.mewna.catnip.entity.message.Message
32 | import com.mewna.catnip.shard.DiscordEvent
33 |
34 | object ScalaExample extends App {
35 | private val catnip = Catnip.catnip("your token here")
36 | catnip.observable(DiscordEvent.MESSAGE_CREATE)
37 | .filter((msg: Message) => msg.content() == "!ping")
38 | .subscribe((msg: Message) => {
39 | msg.respond("pong!")
40 | })
41 | catnip.connect()
42 | }
--------------------------------------------------------------------------------
/src/main/example/slash/JavaExample.java:
--------------------------------------------------------------------------------
1 | package slash;
2 |
3 | import com.mewna.catnip.Catnip;
4 | import com.mewna.catnip.entity.builder.command.CommandOptionBuilder;
5 | import com.mewna.catnip.entity.interaction.InteractionResponseType;
6 | import com.mewna.catnip.entity.interaction.command.ApplicationCommandInteraction;
7 | import com.mewna.catnip.entity.interaction.command.ApplicationCommandOptionType;
8 | import com.mewna.catnip.entity.interaction.command.ApplicationCommandType;
9 | import com.mewna.catnip.entity.message.MessageOptions;
10 | import com.mewna.catnip.shard.DiscordEvent;
11 |
12 | import java.util.List;
13 |
14 | public class JavaExample {
15 | public static void main(String[] args) {
16 | Catnip catnip = Catnip.catnip("your token goes here");
17 |
18 | catnip.rest().interaction().createGlobalApplicationCommand(
19 | ApplicationCommandType.CHAT_INPUT, "test", "my cool command",
20 | List.of(
21 | new CommandOptionBuilder()
22 | .name("option")
23 | .description("my cool option")
24 | .type(ApplicationCommandOptionType.STRING)
25 | .required(false)
26 | .build()
27 | )
28 | ).subscribe();
29 |
30 | catnip.observable(DiscordEvent.INTERACTION_CREATE).subscribe(interaction -> {
31 | if(interaction instanceof ApplicationCommandInteraction command) {
32 | if(command.data().name().equals("test")) {
33 | catnip.rest().interaction().createInteractionInitialResponse(
34 | InteractionResponseType.CHANNEL_MESSAGE_WITH_SOURCE,
35 | command.id(), command.token(),
36 | new MessageOptions().content("test response!")
37 | );
38 | }
39 | }
40 | });
41 |
42 | catnip.connect();
43 | }
44 | }
--------------------------------------------------------------------------------
/src/main/java-templates/com/mewna/catnip/util/CatnipMeta.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.util;
29 |
30 | public final class CatnipMeta {
31 | public static final String VERSION = "${project.version}";
32 | public static final String COMMIT = "${git.commit.id}";
33 | public static final String COMMIT_SHORT = "${git.commit.id.abbrev}";
34 | public static final String COMMIT_MESSAGE = "${git.commit.message.short}";
35 |
36 | private CatnipMeta() {
37 | }
38 | }
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/cache/NoopEntityCache.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.cache;
29 |
30 | import javax.annotation.Nonnull;
31 |
32 | /**
33 | * @author amy
34 | * @since 9/13/18.
35 | */
36 | public final class NoopEntityCache extends CustomizableEntityCache {
37 | @Override
38 | public boolean canProvidePreviousState(@Nonnull final CachedEntityState state) {
39 | return false;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/cache/view/MutableNamedCacheView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.cache.view;
29 |
30 | /**
31 | * Mutable {@link NamedCacheView named cache view}, which allows modifications to
32 | * the storage. Used by {@link com.mewna.catnip.cache.MemoryEntityCache MemoryEntityCache}
33 | * to allow custom implementations.
34 | *
35 | * @param Type of the entity held by this cache.
36 | *
37 | * @author natanbc
38 | * @since 12/23/18
39 | */
40 | public interface MutableNamedCacheView extends MutableCacheView, NamedCacheView {}
41 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/RequiresCatnip.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity;
29 |
30 | import com.mewna.catnip.Catnip;
31 |
32 | import javax.annotation.Nonnull;
33 |
34 | public interface RequiresCatnip extends Entity {
35 | void catnip(@Nonnull Catnip catnip);
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/channel/Category.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.channel;
29 |
30 | import javax.annotation.CheckReturnValue;
31 |
32 | /**
33 | * A category that contains channels in a guild.
34 | *
35 | * @author natanbc
36 | * @since 9/12/18
37 | */
38 | public interface Category extends GuildChannel {
39 | @Override
40 | @CheckReturnValue
41 | default boolean isText() {
42 | return false;
43 | }
44 |
45 | @Override
46 | @CheckReturnValue
47 | default boolean isVoice() {
48 | return false;
49 | }
50 |
51 | @Override
52 | @CheckReturnValue
53 | default boolean isCategory() {
54 | return true;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/channel/DeletedThread.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.channel;
29 |
30 | import com.mewna.catnip.entity.channel.Channel.ChannelType;
31 | import com.mewna.catnip.entity.partials.HasGuild;
32 | import com.mewna.catnip.entity.partials.HasParentChannel;
33 | import com.mewna.catnip.entity.partials.Snowflake;
34 |
35 | import javax.annotation.Nonnull;
36 |
37 | /**
38 | * @author amy
39 | * @since 5/9/21.
40 | */
41 | public interface DeletedThread extends Snowflake, HasGuild, HasParentChannel {
42 | @Nonnull
43 | ChannelType type();
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/channel/NewsChannel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.channel;
29 |
30 | /**
31 | * A news channel in a guild is effectively a reskinned text channel, but with
32 | * two important differences:
33 | *
34 | *
The channel type is {@link ChannelType#NEWS}.
35 | *
There is no ratelimit.
36 | *
37 | *
38 | * @author amy
39 | * @since 3/10/19.
40 | */
41 | public interface NewsChannel extends TextChannel {
42 | @Override
43 | default int rateLimitPerUser() {
44 | return 0;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/channel/StageChannel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.channel;
29 |
30 | import javax.annotation.Nonnull;
31 |
32 | /**
33 | * @author amy
34 | * @since 11/26/21.
35 | */
36 | public interface StageChannel extends VoiceChannel {
37 | @Nonnull
38 | @Override
39 | default ChannelType type() {
40 | return ChannelType.STAGE;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/channel/StoreChannel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.channel;
29 |
30 | import javax.annotation.Nonnull;
31 |
32 | /**
33 | * @author amy
34 | * @since 3/14/19.
35 | */
36 | public interface StoreChannel extends GuildChannel {
37 | @Nonnull
38 | @Override
39 | default ChannelType type() {
40 | return ChannelType.STORE;
41 | }
42 |
43 | boolean nsfw();
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/channel/ThreadListSync.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.channel;
29 |
30 | import com.mewna.catnip.entity.channel.ThreadChannel.ThreadMember;
31 | import com.mewna.catnip.entity.partials.HasGuild;
32 |
33 | import java.util.List;
34 |
35 | /**
36 | * @author amy
37 | * @since 5/9/21.
38 | */
39 | public interface ThreadListSync extends HasGuild {
40 | List channelIds();
41 |
42 | List threads();
43 |
44 | List members();
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/channel/ThreadMembersUpdate.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.channel;
29 |
30 | import com.mewna.catnip.entity.channel.ThreadChannel.ThreadMember;
31 | import com.mewna.catnip.entity.partials.HasGuild;
32 | import com.mewna.catnip.entity.partials.Snowflake;
33 |
34 | import java.util.List;
35 |
36 | /**
37 | * @author amy
38 | * @since 5/9/21.
39 | */
40 | public interface ThreadMembersUpdate extends Snowflake, HasGuild {
41 | int memberCount();
42 |
43 | List addedMembers();
44 |
45 | List removedMembers();
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/channel/WebhooksUpdate.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.channel;
29 |
30 | import com.mewna.catnip.entity.partials.GuildEntity;
31 | import com.mewna.catnip.entity.partials.HasChannel;
32 |
33 | /**
34 | * Fired over the event bus when a webhook update event is received.
35 | *
36 | * @author amy
37 | * @since 11/10/18.
38 | */
39 | public interface WebhooksUpdate extends GuildEntity, HasChannel {
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/delegate/DefaultEntityDelegator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.delegate;
29 |
30 | import javax.annotation.Nonnull;
31 |
32 | /**
33 | * @author amy
34 | * @since 2/13/20.
35 | */
36 | public final class DefaultEntityDelegator implements EntityDelegator {
37 | @Override
38 | @SuppressWarnings("unchecked")
39 | public R delegate(@Nonnull final Class type, @Nonnull final T data) {
40 | return (R) data;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/guild/DeletedInvite.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.guild;
29 |
30 | import com.mewna.catnip.entity.partials.HasChannel;
31 |
32 | import javax.annotation.CheckReturnValue;
33 | import javax.annotation.Nonnull;
34 |
35 | /**
36 | * Sent when an invite is deleted.
37 | *
38 | * @author amy
39 | * @since 4/24/20.
40 | */
41 | public interface DeletedInvite extends HasChannel {
42 | /**
43 | * @return The code of the invite that was deleted.
44 | */
45 | @Nonnull
46 | @CheckReturnValue
47 | String code();
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/guild/EmojiUpdate.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.guild;
29 |
30 | import com.mewna.catnip.entity.misc.Emoji.CustomEmoji;
31 | import com.mewna.catnip.entity.partials.GuildEntity;
32 |
33 | import javax.annotation.CheckReturnValue;
34 | import javax.annotation.Nonnull;
35 | import java.util.List;
36 |
37 | /**
38 | * Fired over the event bus when a guild's emojis are updated.
39 | *
40 | * @author amy
41 | * @since 10/9/18.
42 | */
43 | public interface EmojiUpdate extends GuildEntity {
44 | /**
45 | * @return A non-{@code null}, possibly-empty list of the guild's emojis.
46 | */
47 | @Nonnull
48 | @CheckReturnValue
49 | List emojis();
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/guild/GatewayGuildBan.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.guild;
29 |
30 | import com.mewna.catnip.entity.partials.GuildEntity;
31 | import com.mewna.catnip.entity.user.User;
32 |
33 | import javax.annotation.CheckReturnValue;
34 | import javax.annotation.Nonnull;
35 |
36 | /**
37 | * Fired over the event bus when a user is banned in a guild.
38 | *
39 | * @author amy
40 | * @since 10/6/18.
41 | */
42 | public interface GatewayGuildBan extends GuildEntity {
43 |
44 | /**
45 | * @return The user who was banned.
46 | */
47 | @Nonnull
48 | @CheckReturnValue
49 | User user();
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/guild/GuildBan.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.guild;
29 |
30 | import com.mewna.catnip.entity.Entity;
31 | import com.mewna.catnip.entity.user.User;
32 |
33 | import javax.annotation.CheckReturnValue;
34 | import javax.annotation.Nonnull;
35 | import javax.annotation.Nullable;
36 |
37 | /**
38 | * A single guild ban.
39 | *
40 | * @author amy
41 | * @since 10/6/18.
42 | */
43 | public interface GuildBan extends Entity {
44 | /**
45 | * @return The user who was banned.
46 | */
47 | @Nonnull
48 | @CheckReturnValue
49 | User user();
50 |
51 | /**
52 | * @return The reason for the ban, if provided.
53 | */
54 | @Nullable
55 | @CheckReturnValue
56 | String reason();
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/guild/GuildEmbed.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.guild;
29 |
30 | import com.mewna.catnip.entity.RequiresCatnip;
31 | import com.mewna.catnip.entity.partials.HasChannel;
32 |
33 | import javax.annotation.CheckReturnValue;
34 |
35 | /**
36 | * A guild's embed.
37 | *
38 | * @author SamOphis
39 | * @since 10/18/2018
40 | */
41 | @SuppressWarnings("unused")
42 | public interface GuildEmbed extends RequiresCatnip, HasChannel {
43 | /**
44 | * @return Whether the embed is enabled.
45 | */
46 | @CheckReturnValue
47 | boolean enabled();
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/guild/PartialGuild.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.guild;
29 |
30 | import com.mewna.catnip.entity.partials.HasIcon;
31 | import com.mewna.catnip.entity.partials.HasName;
32 | import com.mewna.catnip.entity.partials.Snowflake;
33 | import com.mewna.catnip.entity.util.Permission;
34 |
35 | import javax.annotation.CheckReturnValue;
36 | import javax.annotation.Nonnull;
37 | import java.util.Set;
38 |
39 | /**
40 | * @author natanbc
41 | * @since 10/10/18.
42 | */
43 | public interface PartialGuild extends Snowflake, HasIcon, HasName {
44 | @CheckReturnValue
45 | boolean owned();
46 |
47 | @Nonnull
48 | @CheckReturnValue
49 | Set permissions();
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/guild/PartialRole.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.guild;
29 |
30 | import com.mewna.catnip.entity.partials.GuildEntity;
31 | import com.mewna.catnip.entity.partials.Snowflake;
32 |
33 | /**
34 | * @author amy
35 | * @since 10/4/18.
36 | */
37 | public interface PartialRole extends GuildEntity, Snowflake {
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/guild/UnavailableGuild.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.guild;
29 |
30 | import com.mewna.catnip.entity.partials.Snowflake;
31 |
32 | import javax.annotation.CheckReturnValue;
33 |
34 | /**
35 | * An unavailable guild.
36 | *
37 | * @author amy
38 | * @since 10/4/18.
39 | */
40 | public interface UnavailableGuild extends Snowflake {
41 | /**
42 | * @return Whether the guild is unavailable.
43 | */
44 | @CheckReturnValue
45 | boolean unavailable();
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/guild/audit/AuditLogChange.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.guild.audit;
29 |
30 | import com.mewna.catnip.entity.Entity;
31 |
32 | import javax.annotation.CheckReturnValue;
33 | import javax.annotation.Nonnull;
34 | import javax.annotation.Nullable;
35 |
36 | /**
37 | * @author SamOphis
38 | * @since 10/07/18
39 | */
40 | @SuppressWarnings("unused")
41 | public interface AuditLogChange extends Entity {
42 | @Nullable
43 | @CheckReturnValue
44 | T newValue();
45 |
46 | @Nullable
47 | @CheckReturnValue
48 | T oldValue();
49 |
50 | @Nonnull
51 | @CheckReturnValue
52 | String key();
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/guild/audit/MemberDisconnectInfo.java:
--------------------------------------------------------------------------------
1 | package com.mewna.catnip.entity.guild.audit;
2 |
3 | import javax.annotation.CheckReturnValue;
4 |
5 | /**
6 | * @author kjp12
7 | * @since March 18th, 2020
8 | */
9 | public interface MemberDisconnectInfo extends OptionalEntryInfo {
10 | @CheckReturnValue
11 | int membersDisconnectedCount();
12 | }
13 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/guild/audit/MemberMoveInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.guild.audit;
29 |
30 | import com.mewna.catnip.entity.partials.HasChannel;
31 |
32 | import javax.annotation.CheckReturnValue;
33 |
34 | /**
35 | * @author kjp12
36 | * @since March 18th, 2020
37 | */
38 | public interface MemberMoveInfo extends OptionalEntryInfo, HasChannel {
39 | @CheckReturnValue
40 | int membersMovedCount();
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/guild/audit/MemberPruneInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.guild.audit;
29 |
30 | import javax.annotation.CheckReturnValue;
31 |
32 | /**
33 | * @author SamOphis
34 | * @since 10/07/18
35 | */
36 | @SuppressWarnings("unused")
37 | public interface MemberPruneInfo extends OptionalEntryInfo {
38 | @CheckReturnValue
39 | int deleteMemberDays();
40 |
41 | @CheckReturnValue
42 | int removedMembersCount();
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/guild/audit/MessageBulkDeleteInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.guild.audit;
29 |
30 | import javax.annotation.CheckReturnValue;
31 |
32 | /**
33 | * The data returned for MESSAGE_BULK_DELETE doesn't actually follow the API documentation.
34 | * If you're looking for the channel ID that's normally returned from here like in {@link MessageDeleteInfo},
35 | * use {@link AuditLogEntry#targetId()} or {@link AuditLogEntry#targetIdAsLong()}.
36 | *
37 | * @author kjp12
38 | * @since March 18th, 2020
39 | */
40 | public interface MessageBulkDeleteInfo extends OptionalEntryInfo {
41 | @CheckReturnValue
42 | int deletedMessagesCount();
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/guild/audit/MessageDeleteInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.guild.audit;
29 |
30 | import javax.annotation.CheckReturnValue;
31 | import javax.annotation.Nonnull;
32 |
33 | /**
34 | * @author SamOphis
35 | * @since 10/07/18
36 | */
37 | @SuppressWarnings("unused")
38 | public interface MessageDeleteInfo extends OptionalEntryInfo {
39 | @Nonnull
40 | @CheckReturnValue
41 | default String channelId() {
42 | return Long.toUnsignedString(channelIdAsLong());
43 | }
44 |
45 | @CheckReturnValue
46 | long channelIdAsLong();
47 |
48 | @CheckReturnValue
49 | int deletedMessagesCount();
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/guild/audit/MessagePinInfo.java:
--------------------------------------------------------------------------------
1 | package com.mewna.catnip.entity.guild.audit;
2 |
3 | import javax.annotation.CheckReturnValue;
4 | import javax.annotation.Nonnull;
5 |
6 | /**
7 | * @author kjp12
8 | * @since March 18th, 2020
9 | */
10 | public interface MessagePinInfo extends OptionalEntryInfo {
11 | @Nonnull
12 | @CheckReturnValue
13 | default String channelId() {
14 | return Long.toUnsignedString(channelIdAsLong());
15 | }
16 |
17 | @CheckReturnValue
18 | long channelIdAsLong();
19 |
20 | @Nonnull
21 | @CheckReturnValue
22 | default String messageId() {
23 | return Long.toUnsignedString(messageIdAsLong());
24 | }
25 |
26 | @CheckReturnValue
27 | long messageIdAsLong();
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/guild/audit/OptionalEntryInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.guild.audit;
29 |
30 | import com.mewna.catnip.entity.Entity;
31 |
32 | /**
33 | * @author SamOphis
34 | * @since 10/07/18
35 | */
36 | @SuppressWarnings({"WeakerAccess", "InterfaceMayBeAnnotatedFunctional"})
37 | public interface OptionalEntryInfo extends Entity {
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/impl/guild/RoleTagsImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.impl.guild;
29 |
30 | import com.mewna.catnip.entity.guild.RoleTags;
31 | import lombok.*;
32 | import lombok.experimental.Accessors;
33 |
34 | /**
35 | * @author amy
36 | * @since 8/20/20.
37 | */
38 | @Getter
39 | @Setter
40 | @Builder
41 | @Accessors(fluent = true)
42 | @NoArgsConstructor
43 | @AllArgsConstructor
44 | public class RoleTagsImpl implements RoleTags {
45 | private String botId;
46 | private boolean premiumSubscriber;
47 | private String integrationId;
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/impl/guild/audit/MemberDisconnectInfoImpl.java:
--------------------------------------------------------------------------------
1 | package com.mewna.catnip.entity.impl.guild.audit;
2 |
3 | import com.mewna.catnip.Catnip;
4 | import com.mewna.catnip.entity.RequiresCatnip;
5 | import com.mewna.catnip.entity.guild.audit.MemberDisconnectInfo;
6 | import lombok.*;
7 | import lombok.experimental.Accessors;
8 |
9 | import javax.annotation.Nonnull;
10 |
11 | /**
12 | * @author kjp12
13 | * @since March 18th, 2020
14 | */
15 | @Getter
16 | @Setter
17 | @Builder
18 | @NoArgsConstructor
19 | @AllArgsConstructor
20 | @Accessors(fluent = true)
21 | public class MemberDisconnectInfoImpl implements MemberDisconnectInfo, RequiresCatnip {
22 | private transient Catnip catnip;
23 |
24 | private int membersDisconnectedCount;
25 |
26 | @Override
27 | public void catnip(@Nonnull final Catnip catnip) {
28 | this.catnip = catnip;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/impl/guild/audit/MessagePinInfoImpl.java:
--------------------------------------------------------------------------------
1 | package com.mewna.catnip.entity.impl.guild.audit;
2 |
3 | import com.mewna.catnip.Catnip;
4 | import com.mewna.catnip.entity.RequiresCatnip;
5 | import com.mewna.catnip.entity.guild.audit.MessagePinInfo;
6 | import lombok.*;
7 | import lombok.experimental.Accessors;
8 |
9 | import javax.annotation.Nonnull;
10 |
11 | /**
12 | * @author kjp12
13 | * @since March 18th, 2020
14 | */
15 | @Getter
16 | @Setter
17 | @Builder
18 | @NoArgsConstructor
19 | @AllArgsConstructor
20 | @Accessors(fluent = true)
21 | public class MessagePinInfoImpl implements MessagePinInfo, RequiresCatnip {
22 | private transient Catnip catnip;
23 |
24 | private long channelIdAsLong;
25 | private long messageIdAsLong;
26 |
27 | @Override
28 | public void catnip(@Nonnull final Catnip catnip) {
29 | this.catnip = catnip;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/impl/interaction/CustomIdInteractionDataImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.impl.interaction;
29 |
30 | import com.mewna.catnip.entity.interaction.CustomIdInteractionData;
31 | import com.mewna.catnip.entity.message.component.MessageComponent.MessageComponentType;
32 | import lombok.*;
33 | import lombok.experimental.Accessors;
34 |
35 | /**
36 | * @author amy
37 | * @since 5/30/21.
38 | */
39 | @Getter
40 | @Setter
41 | @Builder
42 | @Accessors(fluent = true)
43 | @NoArgsConstructor
44 | @AllArgsConstructor
45 | public class CustomIdInteractionDataImpl implements CustomIdInteractionData {
46 | private MessageComponentType componentType;
47 | private String customId;
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/impl/interaction/command/ApplicationCommandOptionStringChoiceImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.impl.interaction.command;
29 |
30 | import com.mewna.catnip.entity.interaction.command.ApplicationCommandOptionStringChoice;
31 | import lombok.*;
32 | import lombok.experimental.Accessors;
33 |
34 | /**
35 | * @author amy
36 | * @since 12/10/20.
37 | */
38 | @Getter
39 | @Setter
40 | @Builder
41 | @Accessors(fluent = true)
42 | @NoArgsConstructor
43 | @AllArgsConstructor
44 | public class ApplicationCommandOptionStringChoiceImpl implements ApplicationCommandOptionStringChoice {
45 | private String name;
46 | private String value;
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/impl/message/MessageActivityImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.impl.message;
29 |
30 | import com.mewna.catnip.entity.message.Message.MessageActivity;
31 | import com.mewna.catnip.entity.message.MessageActivityType;
32 | import lombok.*;
33 | import lombok.experimental.Accessors;
34 |
35 | /**
36 | * @author amy
37 | * @since 8/5/19.
38 | */
39 | @Getter
40 | @Setter
41 | @Builder
42 | @Accessors(fluent = true)
43 | @NoArgsConstructor
44 | @AllArgsConstructor
45 | public class MessageActivityImpl implements MessageActivity {
46 | private MessageActivityType type;
47 | private String partyId;
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/impl/message/component/ActionRowImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.impl.message.component;
29 |
30 | import com.mewna.catnip.entity.message.component.ActionRow;
31 | import com.mewna.catnip.entity.message.component.MessageComponent;
32 | import lombok.*;
33 | import lombok.experimental.Accessors;
34 |
35 | import java.util.List;
36 |
37 | /**
38 | * @author amy
39 | * @since 5/30/21.
40 | */
41 | @Getter
42 | @Setter
43 | @Accessors(fluent = true)
44 | @Builder
45 | @NoArgsConstructor
46 | @AllArgsConstructor
47 | public class ActionRowImpl implements ActionRow {
48 | private List components;
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/impl/message/component/ButtonImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.impl.message.component;
29 |
30 | import com.mewna.catnip.entity.message.component.Button;
31 | import com.mewna.catnip.entity.misc.Emoji;
32 | import lombok.*;
33 | import lombok.experimental.Accessors;
34 |
35 | /**
36 | * @author amy
37 | * @since 5/30/21.
38 | */
39 | @Getter
40 | @Setter
41 | @Accessors(fluent = true)
42 | @Builder
43 | @NoArgsConstructor
44 | @AllArgsConstructor
45 | public class ButtonImpl implements Button {
46 | private ButtonStyle style;
47 | private String label;
48 | private Emoji emoji;
49 | private String customId;
50 | private String url;
51 | private boolean disabled;
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/interaction/CustomIdInteractionData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.interaction;
29 |
30 | import com.mewna.catnip.entity.message.component.MessageComponent.MessageComponentType;
31 |
32 | import javax.annotation.CheckReturnValue;
33 | import javax.annotation.Nonnull;
34 |
35 | /**
36 | * @author amy
37 | * @since 5/30/21.
38 | */
39 | public interface CustomIdInteractionData {
40 | @Nonnull
41 | @CheckReturnValue
42 | MessageComponentType componentType();
43 |
44 | @Nonnull
45 | @CheckReturnValue
46 | String customId();
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/interaction/InteractionMember.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.interaction;
29 |
30 | import com.mewna.catnip.entity.guild.Member;
31 | import com.mewna.catnip.entity.util.Permission;
32 |
33 | import java.util.Set;
34 |
35 | /**
36 | * @author amy
37 | * @since 12/23/20.
38 | */
39 | public interface InteractionMember extends Member {
40 | @Override
41 | Set permissions();
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/interaction/command/ApplicationCommand.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.interaction.command;
29 |
30 | import com.mewna.catnip.entity.partials.*;
31 |
32 | import javax.annotation.Nonnull;
33 | import java.util.List;
34 |
35 | /**
36 | * @author amy
37 | * @since 12/10/20.
38 | */
39 | public interface ApplicationCommand extends Snowflake, HasName, HasDescription, HasApplication, HasGuild {
40 | @Nonnull
41 | List options();
42 |
43 | @Nonnull
44 | default String version() {
45 | return Long.toUnsignedString(versionAsLong());
46 | }
47 |
48 | long versionAsLong();
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/interaction/command/ApplicationCommandInteraction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.interaction.command;
29 |
30 | import com.mewna.catnip.entity.interaction.Interaction;
31 |
32 | /**
33 | * @author amy
34 | * @since 5/30/21.
35 | */
36 | public interface ApplicationCommandInteraction extends Interaction {
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/interaction/command/ApplicationCommandInteractionData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.interaction.command;
29 |
30 | import com.mewna.catnip.entity.partials.HasName;
31 | import com.mewna.catnip.entity.partials.Snowflake;
32 |
33 | import java.util.List;
34 |
35 | /**
36 | * @author amy
37 | * @since 12/10/20.
38 | */
39 | public interface ApplicationCommandInteractionData extends Snowflake, HasName {
40 | List options();
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/interaction/command/ApplicationCommandInteractionDataOption.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.interaction.command;
29 |
30 | import com.mewna.catnip.entity.partials.HasName;
31 |
32 | import java.util.List;
33 |
34 | /**
35 | * @author amy
36 | * @since 12/10/20.
37 | */
38 | public interface ApplicationCommandInteractionDataOption extends HasName {
39 | ApplicationCommandOptionType type();
40 | ApplicationCommandOptionChoice> value();
41 |
42 | List options();
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/interaction/command/ApplicationCommandOptionChoice.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.interaction.command;
29 |
30 | import com.grack.nanojson.JsonObject;
31 | import com.mewna.catnip.entity.partials.HasName;
32 |
33 | /**
34 | * @author amy
35 | * @since 12/10/20.
36 | */
37 | public interface ApplicationCommandOptionChoice extends HasName {
38 | T value();
39 |
40 | default JsonObject toJson() {
41 | final var builder = JsonObject.builder();
42 | builder.value("name", name());
43 | builder.value("value", value());
44 | return builder.done();
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/interaction/command/ApplicationCommandOptionDoubleChoice.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.interaction.command;
29 |
30 | /**
31 | * @author amy
32 | * @since 11/27/21.
33 | */
34 | public interface ApplicationCommandOptionDoubleChoice extends ApplicationCommandOptionChoice {
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/interaction/command/ApplicationCommandOptionIntegerChoice.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.interaction.command;
29 |
30 | /**
31 | * @author amy
32 | * @since 12/10/20.
33 | */
34 | public interface ApplicationCommandOptionIntegerChoice extends ApplicationCommandOptionChoice {
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/interaction/command/ApplicationCommandOptionStringChoice.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.interaction.command;
29 |
30 | /**
31 | * @author amy
32 | * @since 12/10/20.
33 | */
34 | public interface ApplicationCommandOptionStringChoice extends ApplicationCommandOptionChoice {
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/interaction/command/ApplicationCommandType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.interaction.command;
29 |
30 | import lombok.Getter;
31 | import lombok.experimental.Accessors;
32 |
33 | /**
34 | * @author amy
35 | * @since 10/10/21.
36 | */
37 | @Accessors(fluent = true)
38 | public enum ApplicationCommandType {
39 | CHAT_INPUT(1),
40 | USER(2),
41 | MESSAGE(3),
42 | ;
43 |
44 | @Getter
45 | private final int id;
46 |
47 | ApplicationCommandType(final int id) {
48 | this.id = id;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/interaction/component/ButtonInteraction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.interaction.component;
29 |
30 | import com.mewna.catnip.entity.interaction.CustomIdInteractionData;
31 | import com.mewna.catnip.entity.interaction.Interaction;
32 | import lombok.*;
33 | import lombok.experimental.Accessors;
34 |
35 | /**
36 | * @author amy
37 | * @since 5/30/21.
38 | */
39 | public interface ButtonInteraction extends Interaction {
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/interaction/component/SelectInteraction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.interaction.component;
29 |
30 | import com.mewna.catnip.entity.interaction.Interaction;
31 |
32 | /**
33 | * @author amy
34 | * @since 7/12/21.
35 | */
36 | public interface SelectInteraction extends Interaction {
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/interaction/component/SelectInteractionData.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.interaction.component;
29 |
30 | import com.mewna.catnip.entity.interaction.CustomIdInteractionData;
31 |
32 | import javax.annotation.Nonnull;
33 | import java.util.List;
34 |
35 | /**
36 | * @author amy
37 | * @since 7/12/21.
38 | */
39 | public interface SelectInteractionData extends CustomIdInteractionData {
40 | @Nonnull
41 | List values();
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/lifecycle/ChunkingDone.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.lifecycle;
29 |
30 | import com.mewna.catnip.entity.Entity;
31 | import com.mewna.catnip.shard.buffer.NoopBuffer;
32 |
33 | /**
34 | * Fired when all guilds are finished chunking. For a no-op event buffer (such
35 | * as {@link NoopBuffer}), this event should just be fired immediately.
36 | *
37 | * @author amy
38 | * @since 5/16/19.
39 | */
40 | @SuppressWarnings("InterfaceMayBeAnnotatedFunctional")
41 | public interface ChunkingDone extends Entity {
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/lifecycle/GatewayConnectionFailed.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.lifecycle;
29 |
30 | import com.mewna.catnip.entity.Entity;
31 | import com.mewna.catnip.shard.ShardInfo;
32 |
33 | /**
34 | * Fired when connecting to Discord's websocket gateway fails.
35 | *
36 | * @author amy
37 | * @since 7/26/19.
38 | */
39 | public interface GatewayConnectionFailed extends Entity {
40 | /**
41 | * @return Information about the shard whose gateway websocket connection
42 | * failed.
43 | */
44 | ShardInfo shardInfo();
45 |
46 | /**
47 | * @return The error thrown during connection failure.
48 | */
49 | Throwable error();
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/lifecycle/MemberChunkRerequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.lifecycle;
29 |
30 | import com.mewna.catnip.entity.Entity;
31 | import com.mewna.catnip.shard.ShardInfo;
32 |
33 | /**
34 | * Fired when a guild needs its member chunks re-requested, if and only if
35 | * {@link com.mewna.catnip.CatnipOptions#manualChunkRerequesting()} is
36 | * {@code true}.
37 | *
38 | * @author amy
39 | * @since 7/4/19.
40 | */
41 | public interface MemberChunkRerequest extends Entity {
42 | ShardInfo shardInfo();
43 |
44 | String guildId();
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/lifecycle/RestRatelimitHit.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.lifecycle;
29 |
30 | import com.mewna.catnip.entity.Entity;
31 |
32 | import javax.annotation.Nonnull;
33 |
34 | /**
35 | * Fired whenever a REST ratelimit is hit.
36 | *
37 | * @author amy
38 | * @since 7/26/19.
39 | */
40 | public interface RestRatelimitHit extends Entity {
41 | /**
42 | * @return The route that was ratelimited. Never {@code null}.
43 | */
44 | @Nonnull
45 | String route();
46 |
47 | /**
48 | * @return Whether or not the ratelimit was global.
49 | */
50 | boolean global();
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/message/MentionParseFlag.java:
--------------------------------------------------------------------------------
1 | package com.mewna.catnip.entity.message;
2 |
3 | import lombok.Getter;
4 |
5 | import javax.annotation.CheckReturnValue;
6 | import javax.annotation.Nonnull;
7 |
8 | /**
9 | * @author kjp12
10 | * @see MessageOptions#parseFlags()
11 | * @since March 07, 2020
12 | */
13 | public enum MentionParseFlag {
14 | ROLES("roles"),
15 | USERS("users"),
16 | EVERYONE("everyone"),
17 | ;
18 | @Getter
19 | private final String flagName;
20 |
21 | MentionParseFlag(final String flagName) {
22 | this.flagName = flagName;
23 | }
24 |
25 | @Nonnull
26 | @CheckReturnValue
27 | public static MentionParseFlag byName(final String flagName) {
28 | for(final MentionParseFlag m : values()) {
29 | if(m.flagName.equals(flagName)) {
30 | return m;
31 | }
32 | }
33 | throw new IllegalArgumentException("No such MentionParseFlag: " + flagName);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/misc/ApplicationOwner.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.misc;
29 |
30 | import com.mewna.catnip.entity.user.User;
31 |
32 | /**
33 | * This may be changed if discord changes the format for teams in the returned response.
34 | */
35 | public interface ApplicationOwner extends User {
36 | boolean isTeam();
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/misc/CreatedInvite.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.misc;
29 |
30 | import com.mewna.catnip.entity.guild.Invite;
31 | import com.mewna.catnip.entity.partials.HasCreatedAt;
32 |
33 | import javax.annotation.Nonnegative;
34 | import javax.annotation.Nonnull;
35 | import java.time.OffsetDateTime;
36 |
37 | /**
38 | * @author natanbc
39 | * @since 9/14/18
40 | */
41 | public interface CreatedInvite extends Invite, HasCreatedAt {
42 | @Nonnegative
43 | int uses();
44 |
45 | @Nonnegative
46 | int maxUses();
47 |
48 | int maxAge();
49 |
50 | boolean temporary();
51 |
52 | boolean revoked();
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/misc/GatewayInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.misc;
29 |
30 | import com.mewna.catnip.entity.Entity;
31 |
32 | import javax.annotation.Nonnegative;
33 | import javax.annotation.Nonnull;
34 |
35 | /**
36 | * @author amy
37 | * @since 12/10/18.
38 | */
39 | public interface GatewayInfo extends Entity {
40 | boolean valid();
41 |
42 | @Nonnull
43 | String url();
44 |
45 | @Nonnegative
46 | int shards();
47 |
48 | @Nonnegative
49 | int totalSessions();
50 |
51 | @Nonnegative
52 | int remainingSessions();
53 |
54 | @Nonnegative
55 | long resetAfter();
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/misc/Resumed.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.misc;
29 |
30 | import com.mewna.catnip.entity.Entity;
31 |
32 | /**
33 | * Fired when a shard resumes successfully.
34 | *
35 | * @author amy
36 | * @since 11/10/18.
37 | */
38 | @SuppressWarnings("InterfaceMayBeAnnotatedFunctional")
39 | public interface Resumed extends Entity {
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/misc/Team.java:
--------------------------------------------------------------------------------
1 | package com.mewna.catnip.entity.misc;
2 |
3 | import com.mewna.catnip.entity.partials.HasIcon;
4 | import com.mewna.catnip.entity.partials.HasName;
5 | import com.mewna.catnip.entity.partials.Snowflake;
6 |
7 | import javax.annotation.CheckReturnValue;
8 | import javax.annotation.Nonnull;
9 | import java.util.List;
10 |
11 | /**
12 | * Information about a team.
13 | *
14 | * @author Bowser65
15 | * @since 06/24/19.
16 | */
17 | public interface Team extends Snowflake, HasName, HasIcon {
18 | /**
19 | * The ID of the team owner
20 | *
21 | * @return String representing their ID.
22 | */
23 | @CheckReturnValue
24 | default String ownerId() {
25 | return Long.toUnsignedString(ownerIdAsLong());
26 | }
27 |
28 | /**
29 | * The ID of the team owner, as a long.
30 | *
31 | * @return Long representing their ID.
32 | */
33 | @CheckReturnValue
34 | long ownerIdAsLong();
35 |
36 | /**
37 | * @return The members of the team
38 | */
39 | @Nonnull
40 | List members();
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/misc/TeamMember.java:
--------------------------------------------------------------------------------
1 | package com.mewna.catnip.entity.misc;
2 |
3 | import com.mewna.catnip.entity.user.User;
4 |
5 | import javax.annotation.CheckReturnValue;
6 | import javax.annotation.Nonnull;
7 | import java.util.List;
8 |
9 | /**
10 | * Information about a team member.
11 | *
12 | * @author Bowser65
13 | * @since 06/24/19.
14 | */
15 | public interface TeamMember {
16 | /**
17 | * @return The membership state. Either 1 for pending, 2 for accepted.
18 | */
19 | int membershipState();
20 |
21 | /**
22 | * @return The permissions of the member. Will always be ["*"] as teams doesn't have permissions yet.
23 | */
24 | @Nonnull
25 | List permissions();
26 |
27 | /**
28 | * @return The ID of the parent team they are member of.
29 | */
30 | @CheckReturnValue
31 | default String teamId() {
32 | return Long.toUnsignedString(teamIdAsLong());
33 | }
34 |
35 | /**
36 | * @return The ID of the parent team they are member of, as a long.
37 | */
38 | @CheckReturnValue
39 | long teamIdAsLong();
40 |
41 | /**
42 | * @return The user.
43 | */
44 | @Nonnull
45 | @CheckReturnValue
46 | User user();
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/partials/HasChannel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.partials;
29 |
30 | /**
31 | * @author amy
32 | * @since 12/10/20.
33 | */
34 | @SuppressWarnings("InterfaceMayBeAnnotatedFunctional")
35 | public interface HasChannel {
36 | long channelIdAsLong();
37 |
38 | default String channelId() {
39 | return Long.toUnsignedString(channelIdAsLong());
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/partials/HasCreatedAt.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.partials;
29 |
30 | import javax.annotation.Nonnull;
31 | import java.time.OffsetDateTime;
32 |
33 | /**
34 | * @author amy
35 | * @since 12/31/20.
36 | */
37 | @FunctionalInterface
38 | public interface HasCreatedAt extends Timestamped {
39 | @Nonnull
40 | String createdAtString();
41 |
42 | @Nonnull
43 | default OffsetDateTime createdAt() {
44 | return OffsetDateTime.parse(createdAtString());
45 | }
46 |
47 | @Nonnull
48 | default String createdAtTimestamp(@Nonnull final TimestampStyle style) {
49 | return asDiscordTimestamp(createdAt(), style);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/partials/HasCustomId.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.partials;
29 |
30 | /**
31 | * Used for message components.
32 | *
33 | * @author amy
34 | * @since 7/12/21.
35 | */
36 | public interface HasCustomId {
37 | String customId();
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/partials/HasDescription.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.partials;
29 |
30 | import javax.annotation.CheckReturnValue;
31 | import javax.annotation.Nonnull;
32 |
33 | /**
34 | * An entity that has a description. Description must not be null.
35 | *
36 | * @author amy
37 | * @since 10/15/20.
38 | */
39 | @SuppressWarnings("InterfaceMayBeAnnotatedFunctional")
40 | public interface HasDescription {
41 | @Nonnull
42 | @CheckReturnValue
43 | String description();
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/partials/HasGuild.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.partials;
29 |
30 | import javax.annotation.CheckReturnValue;
31 |
32 | /**
33 | * @author amy
34 | * @since 12/23/20.
35 | */
36 | public interface HasGuild {
37 | /**
38 | * The id of the guild this entity is from.
39 | *
40 | * @return String representing the guild ID.
41 | */
42 | @CheckReturnValue
43 | default String guildId() {
44 | return Long.toUnsignedString(guildIdAsLong());
45 | }
46 |
47 | /**
48 | * The id of the guild this entity is from.
49 | *
50 | * @return Long representing the guild ID.
51 | */
52 | @CheckReturnValue
53 | long guildIdAsLong();
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/partials/HasJoinedAt.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.partials;
29 |
30 | import javax.annotation.CheckReturnValue;
31 | import javax.annotation.Nullable;
32 | import java.time.OffsetDateTime;
33 |
34 | /**
35 | * @author amy
36 | * @since 5/1/21.
37 | */
38 | @FunctionalInterface
39 | public interface HasJoinedAt {
40 | @Nullable
41 | @CheckReturnValue
42 | OffsetDateTime joinedAt();
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/partials/HasName.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.partials;
29 |
30 | import javax.annotation.CheckReturnValue;
31 | import javax.annotation.Nonnull;
32 |
33 | /**
34 | * An entity that has a name. Name must not be null.
35 | *
36 | * @author amy
37 | * @since 10/15/20.
38 | */
39 | @SuppressWarnings("InterfaceMayBeAnnotatedFunctional")
40 | public interface HasName {
41 | @Nonnull
42 | @CheckReturnValue
43 | String name();
44 | }
45 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/partials/HasNullableDescription.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.partials;
29 |
30 | import javax.annotation.CheckReturnValue;
31 | import javax.annotation.Nullable;
32 |
33 | /**
34 | * An entity with a nullable description.
35 | *
36 | * @author amy
37 | * @since 10/15/20.
38 | */
39 | @SuppressWarnings("InterfaceMayBeAnnotatedFunctional")
40 | public interface HasNullableDescription {
41 | /**
42 | * @return The entity's description. May be null.
43 | */
44 | @Nullable
45 | @CheckReturnValue
46 | String description();
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/partials/HasNullableName.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.partials;
29 |
30 | import javax.annotation.CheckReturnValue;
31 | import javax.annotation.Nullable;
32 |
33 | /**
34 | * An entity with a potentially-null name.
35 | *
36 | * @author amy
37 | * @since 10/15/20.
38 | */
39 | @SuppressWarnings("InterfaceMayBeAnnotatedFunctional")
40 | public interface HasNullableName {
41 | /**
42 | * @return The entity's name. May be null.
43 | */
44 | @Nullable
45 | @CheckReturnValue
46 | String name();
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/partials/HasUpdatedAt.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.partials;
29 |
30 | import javax.annotation.Nonnull;
31 | import java.time.OffsetDateTime;
32 |
33 | /**
34 | * @author amy
35 | * @since 12/31/20.
36 | */
37 | @FunctionalInterface
38 | public interface HasUpdatedAt extends Timestamped {
39 | @Nonnull
40 | String updatedAtString();
41 |
42 | @Nonnull
43 | default OffsetDateTime updatedAt() {
44 | return OffsetDateTime.parse(updatedAtString());
45 | }
46 |
47 | @Nonnull
48 | default String updatedAtTimestamp(@Nonnull final TimestampStyle style) {
49 | return asDiscordTimestamp(updatedAt(), style);
50 | }
51 | }
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/entity/user/TypingUser.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.entity.user;
29 |
30 | import com.mewna.catnip.entity.partials.GuildEntity;
31 | import com.mewna.catnip.entity.partials.HasChannel;
32 | import com.mewna.catnip.entity.partials.Snowflake;
33 |
34 | import javax.annotation.CheckReturnValue;
35 | import javax.annotation.Nonnegative;
36 |
37 | /**
38 | * Fired when a user starts typing in a channel.
39 | *
40 | * @author amy
41 | * @since 10/6/18.
42 | */
43 | public interface TypingUser extends GuildEntity, Snowflake, HasChannel {
44 | /**
45 | * @return The time the typing started at.
46 | */
47 | @Nonnegative
48 | @CheckReturnValue
49 | long timestamp();
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/rest/RestPayloadException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.rest;
29 |
30 | import lombok.Getter;
31 |
32 | import javax.annotation.Nonnull;
33 | import java.util.Map;
34 |
35 | /**
36 | * @author amy
37 | * @since 1/17/19.
38 | */
39 | @Getter
40 | public class RestPayloadException extends Exception {
41 | @Nonnull
42 | private final JsonErrorCode code;
43 | @Nonnull
44 | private final Map errorInfo;
45 |
46 | public RestPayloadException(@Nonnull final JsonErrorCode code, @Nonnull final Map errorInfo) {
47 | super((String) null);
48 | this.code = code;
49 | this.errorInfo = Map.copyOf(errorInfo);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/rest/guild/MemberAddOptions.java:
--------------------------------------------------------------------------------
1 | package com.mewna.catnip.rest.guild;
2 |
3 | import com.grack.nanojson.JsonArray;
4 | import com.grack.nanojson.JsonObject;
5 | import com.mewna.catnip.util.JsonConvertible;
6 | import lombok.Getter;
7 | import lombok.Setter;
8 | import lombok.experimental.Accessors;
9 |
10 | import javax.annotation.CheckReturnValue;
11 | import javax.annotation.Nonnull;
12 | import java.util.List;
13 |
14 | @Accessors(fluent = true)
15 | @Getter
16 | @Setter
17 | public class MemberAddOptions implements JsonConvertible {
18 |
19 | private String accessToken;
20 | private String nickname;
21 | private List roles;
22 | private Boolean mute;
23 | private Boolean deaf;
24 |
25 | @Nonnull
26 | @CheckReturnValue
27 | public static MemberAddOptions create() {
28 | return new MemberAddOptions();
29 | }
30 |
31 | @Nonnull
32 | @Override
33 | public JsonObject toJson() {
34 | final JsonObject object = new JsonObject();
35 | object.put("access_token", accessToken);
36 | if(roles != null) {
37 | final JsonArray array = new JsonArray();
38 | array.addAll(roles);
39 | object.put("roles", array);
40 | }
41 | if(nickname != null) {
42 | object.put("nick", nickname);
43 | }
44 | if(mute != null) {
45 | object.put("mute", mute);
46 | }
47 | if(deaf != null) {
48 | object.put("deaf", deaf);
49 | }
50 | return object;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/shard/CompressionMode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.shard;
29 |
30 | import javax.annotation.Nonnull;
31 |
32 | /**
33 | * How catnip handles gateway compression.
34 | *
35 | * @author amy
36 | * @since 8/5/19.
37 | */
38 | public enum CompressionMode {
39 | /**
40 | * No compression. Uses more bandwidth but less CPU.
41 | */
42 | NONE(""),
43 | /**
44 | * Zlib compression. Uses less bandwidth but more CPU.
45 | */
46 | ZLIB("zlib-stream"),
47 | ;
48 |
49 | private final String discord;
50 |
51 | CompressionMode(final String discord) {
52 | this.discord = discord;
53 | }
54 |
55 | @Nonnull
56 | public String asDiscord() {
57 | return discord;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/shard/LifecycleState.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.shard;
29 |
30 | /**
31 | * @author amy
32 | * @since 3/7/19.
33 | */
34 | public enum LifecycleState {
35 | CREATED,
36 | CONNECTING,
37 | CONNECTED,
38 | IDENTIFYING,
39 | RESUMING,
40 | LOGGED_IN,
41 | DISCONNECTED,
42 | DEAD,
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/shard/ShardConnectState.java:
--------------------------------------------------------------------------------
1 | package com.mewna.catnip.shard;
2 |
3 | public enum ShardConnectState {
4 | FAILED,
5 | READY,
6 | RESUMED,
7 | INVALID,
8 | CANCEL,
9 | }
10 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/shard/ShardInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.shard;
29 |
30 | import lombok.AllArgsConstructor;
31 | import lombok.Getter;
32 |
33 | /**
34 | * @author amy
35 | * @since 10/17/18.
36 | */
37 | @Getter
38 | @AllArgsConstructor
39 | public class ShardInfo {
40 | private final int id;
41 | private final int limit;
42 |
43 | public String toString() {
44 | return id + "/" + limit;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/shard/buffer/AbstractBuffer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.shard.buffer;
29 |
30 | import com.mewna.catnip.Catnip;
31 | import com.mewna.catnip.shard.DispatchEmitter;
32 | import lombok.AccessLevel;
33 | import lombok.Getter;
34 | import lombok.experimental.Accessors;
35 |
36 | /**
37 | * @author amy
38 | * @since 9/9/18.
39 | */
40 | @Accessors(fluent = true)
41 | public abstract class AbstractBuffer implements EventBuffer {
42 | @Getter(AccessLevel.PROTECTED)
43 | private Catnip catnip;
44 | @Getter(AccessLevel.PROTECTED)
45 | private DispatchEmitter emitter;
46 |
47 | @Override
48 | public void catnip(final Catnip catnip) {
49 | this.catnip = catnip;
50 | emitter = new DispatchEmitter(catnip);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/shard/buffer/EventBuffer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.shard.buffer;
29 |
30 | import com.grack.nanojson.JsonObject;
31 | import com.mewna.catnip.Catnip;
32 |
33 | /**
34 | * Used for buffering events for things like caching.
35 | *
36 | * @author amy
37 | * @since 9/9/18.
38 | */
39 | public interface EventBuffer {
40 | /**
41 | * Buffers a single event.
42 | *
43 | * @param event The event to buffer.
44 | */
45 | void buffer(JsonObject event);
46 |
47 | void catnip(Catnip catnip);
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/shard/event/AbstractDispatchManager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.shard.event;
29 |
30 | import com.mewna.catnip.Catnip;
31 | import lombok.Getter;
32 | import lombok.experimental.Accessors;
33 |
34 | public abstract class AbstractDispatchManager implements DispatchManager {
35 | @Getter
36 | @Accessors(fluent = true)
37 | private Catnip catnip;
38 |
39 | @Override
40 | public void catnip(final Catnip catnip) {
41 | this.catnip = catnip;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/shard/event/MessageConsumer.java:
--------------------------------------------------------------------------------
1 | package com.mewna.catnip.shard.event;
2 |
3 | import io.reactivex.rxjava3.core.BackpressureStrategy;
4 | import io.reactivex.rxjava3.core.Flowable;
5 | import io.reactivex.rxjava3.core.Observable;
6 |
7 | import java.io.Closeable;
8 | import java.util.function.Consumer;
9 |
10 | public interface MessageConsumer extends Closeable {
11 | String address();
12 |
13 | // This method is specific to Catnip#on and can be safely removed if wanted.
14 | MessageConsumer handler(Consumer handler);
15 |
16 | Observable asObservable();
17 |
18 | Flowable asFlowable(BackpressureStrategy backpressureStrategy);
19 |
20 | default Flowable asFlowable() {
21 | return asFlowable(BackpressureStrategy.BUFFER);
22 | }
23 |
24 | @Override
25 | void close();
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/shard/session/SessionManager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.shard.session;
29 |
30 | import javax.annotation.Nonnegative;
31 | import javax.annotation.Nonnull;
32 | import javax.annotation.Nullable;
33 |
34 | /**
35 | * @author amy
36 | * @since 8/16/18.
37 | */
38 | public interface SessionManager {
39 | void session(@Nonnegative int shardId, @Nonnull String session);
40 |
41 | @Nullable
42 | String session(@Nonnegative int shardId);
43 |
44 | void seqnum(@Nonnegative int shardId, int seqnum);
45 |
46 | int seqnum(@Nonnegative int shardId);
47 |
48 | void clearSession(@Nonnegative int shardId);
49 |
50 | void clearSeqnum(@Nonnegative int shardId);
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/util/HierarchyException.java:
--------------------------------------------------------------------------------
1 | package com.mewna.catnip.util;
2 |
3 | import com.mewna.catnip.entity.partials.Permissable;
4 | import lombok.Getter;
5 | import lombok.experimental.Accessors;
6 |
7 | @Getter
8 | @Accessors(fluent = true)
9 | public class HierarchyException extends RuntimeException {
10 |
11 | private final Permissable actor;
12 | private final Permissable target;
13 |
14 | public HierarchyException(final Permissable actor, final Permissable target) {
15 | super(message(actor, target));
16 | this.actor = actor;
17 | this.target = target;
18 | }
19 |
20 | private static String message(final Permissable actor, final Permissable target) {
21 | return "Could not interact with " + target;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/util/JsonConvertible.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.util;
29 |
30 | import com.grack.nanojson.JsonObject;
31 |
32 | import javax.annotation.CheckReturnValue;
33 | import javax.annotation.Nonnull;
34 |
35 | @FunctionalInterface
36 | public interface JsonConvertible {
37 | @Nonnull
38 | @CheckReturnValue
39 | JsonObject toJson();
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/util/pagination/GuildPaginator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.util.pagination;
29 |
30 | import com.mewna.catnip.entity.guild.PartialGuild;
31 | import com.mewna.catnip.entity.impl.EntityBuilder;
32 |
33 | import javax.annotation.Nonnull;
34 |
35 | public abstract class GuildPaginator extends ArrayOfObjectPaginator {
36 | public GuildPaginator(@Nonnull final EntityBuilder builder) {
37 | super(PartialGuild::id, builder::createPartialGuild, 100);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/util/pagination/MemberPaginator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.util.pagination;
29 |
30 | import com.mewna.catnip.entity.guild.Member;
31 | import com.mewna.catnip.entity.impl.EntityBuilder;
32 |
33 | import javax.annotation.Nonnull;
34 |
35 | public abstract class MemberPaginator extends ArrayOfObjectPaginator {
36 | public MemberPaginator(@Nonnull final EntityBuilder builder, @Nonnull final String guildId) {
37 | super(Member::id, json -> builder.createMember(guildId, json), 100);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/util/pagination/MessagePaginator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.util.pagination;
29 |
30 | import com.mewna.catnip.entity.impl.EntityBuilder;
31 | import com.mewna.catnip.entity.message.Message;
32 |
33 | import javax.annotation.Nonnull;
34 |
35 | /**
36 | * @author natanbc
37 | * @since 10/9/18.
38 | */
39 | public abstract class MessagePaginator extends ArrayOfObjectPaginator {
40 | protected MessagePaginator(@Nonnull final EntityBuilder builder) {
41 | super(Message::id, builder::createMessage, 100);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/util/pagination/PaginationCallback.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.util.pagination;
29 |
30 | /**
31 | * @author natanbc
32 | * @since 10/10/18
33 | */
34 | @FunctionalInterface
35 | @SuppressWarnings("WeakerAccess")
36 | public interface PaginationCallback {
37 | /**
38 | * Accepts a fetched entity. Pagination stops if this method returns false.
39 | *
40 | * @param entity Entity fetched.
41 | *
42 | * @return True, if more entities should be paginated.
43 | */
44 | @SuppressWarnings("BooleanMethodIsAlwaysInverted")
45 | boolean accept(T entity);
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/util/pagination/ReactionPaginator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.util.pagination;
29 |
30 | import com.mewna.catnip.entity.impl.EntityBuilder;
31 | import com.mewna.catnip.entity.user.User;
32 |
33 | import javax.annotation.Nonnull;
34 |
35 | /**
36 | * @author natanbc
37 | * @since 10/9/18.
38 | */
39 | public abstract class ReactionPaginator extends ArrayOfObjectPaginator {
40 | protected ReactionPaginator(@Nonnull final EntityBuilder builder) {
41 | super(User::id, builder::createUser, 100);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/util/scheduler/AbstractTaskScheduler.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.util.scheduler;
29 |
30 | import com.mewna.catnip.Catnip;
31 | import lombok.Getter;
32 | import lombok.experimental.Accessors;
33 |
34 | import javax.annotation.Nonnull;
35 |
36 | public abstract class AbstractTaskScheduler implements TaskScheduler {
37 | @Getter
38 | @Accessors(fluent = true)
39 | private Catnip catnip;
40 |
41 | @Override
42 | public void catnip(@Nonnull final Catnip catnip) {
43 | this.catnip = catnip;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/com/mewna/catnip/util/task/ShardConnectTask.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.util.task;
29 |
30 | import javax.annotation.Nonnull;
31 | import java.util.concurrent.ConcurrentLinkedQueue;
32 | import java.util.function.Consumer;
33 |
34 | public class ShardConnectTask extends QueueTask {
35 | public ShardConnectTask(@Nonnull final Consumer action) {
36 | super(new ConcurrentLinkedQueue<>(), action);
37 | }
38 |
39 | @Override
40 | public void run() {
41 | if(queue.isEmpty()) {
42 | return;
43 | }
44 | action.accept(queue.poll());
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/test/java/com/mewna/catnip/Env.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip;
29 |
30 | /**
31 | * @author amy
32 | * @since 10/15/20.
33 | */
34 | public interface Env {
35 | String DISCORD_TOKEN = System.getenv("DISCORD_TOKEN");
36 | String TEST_GUILD = System.getenv("TEST_GUILD");
37 | String TEST_CHANNEL = System.getenv("TEST_CHANNEL");
38 | String TEST_GUILD_NAME = System.getenv("TEST_GUILD_NAME");
39 | String TEST_USER = System.getenv("TEST_USER");
40 | String TEST_USER_NAME = System.getenv("TEST_USER_NAME");
41 | }
42 |
--------------------------------------------------------------------------------
/src/test/java/com/mewna/catnip/UniverseTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip;
29 |
30 | import org.junit.jupiter.api.Test;
31 |
32 | import static org.junit.jupiter.api.Assertions.assertEquals;
33 |
34 | /**
35 | * @author amy
36 | * @since 8/16/18.
37 | */
38 | @SuppressWarnings("WeakerAccess")
39 | public class UniverseTest {
40 | @Test
41 | public void testTheUniverse() {
42 | assertEquals(2, 1 + 1);
43 | assertEquals(4, 2 + 2);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/test/java/com/mewna/catnip/entity/ChannelTest.java:
--------------------------------------------------------------------------------
1 | package com.mewna.catnip.entity;
2 |
3 | import com.mewna.catnip.entity.channel.Channel.ChannelType;
4 | import com.mewna.catnip.entity.impl.channel.*;
5 | import org.junit.jupiter.api.Test;
6 |
7 | import static org.junit.jupiter.api.Assertions.assertFalse;
8 | import static org.junit.jupiter.api.Assertions.assertTrue;
9 |
10 | public class ChannelTest {
11 | @Test
12 | public void testIsGuildMessageChannel() {
13 | // These five are all expected to be true
14 | assertTrue(new TextChannelImpl().isGuildMessageChannel());
15 | assertTrue(new NewsChannelImpl().isGuildMessageChannel());
16 | assertTrue(new ThreadChannelImpl().type(ChannelType.NEWS_THREAD).isGuildMessageChannel());
17 | assertTrue(new ThreadChannelImpl().type(ChannelType.PUBLIC_THREAD).isGuildMessageChannel());
18 | assertTrue(new ThreadChannelImpl().type(ChannelType.PRIVATE_THREAD).isGuildMessageChannel());
19 | assertTrue(new VoiceChannelImpl().isGuildMessageChannel());
20 |
21 | // These are guild channels but not message channels
22 | assertFalse(new StageChannelImpl().isGuildMessageChannel());
23 |
24 | // These are message channels but not guild channels
25 | assertFalse(new UserDMChannelImpl().isGuildMessageChannel());
26 | assertFalse(new GroupDMChannelImpl().isGuildMessageChannel());
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/test/java/com/mewna/catnip/rest/handler/RestEmojiTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.rest.handler;
29 |
30 | import com.mewna.catnip.Catnip;
31 | import com.mewna.catnip.Env;
32 | import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
33 |
34 | /**
35 | * @author amy
36 | * @since 10/15/20.
37 | */
38 | @DisabledIfSystemProperty(named = "restTests", matches = "false")
39 | public class RestEmojiTest {
40 | private static final Catnip catnip = Catnip.catnip(Env.DISCORD_TOKEN);
41 | // TODO: Implement
42 | }
43 |
--------------------------------------------------------------------------------
/src/test/java/com/mewna/catnip/rest/handler/RestInviteTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.rest.handler;
29 |
30 | import com.mewna.catnip.Catnip;
31 | import com.mewna.catnip.Env;
32 | import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
33 |
34 | /**
35 | * @author amy
36 | * @since 10/15/20.
37 | */
38 | @DisabledIfSystemProperty(named = "restTests", matches = "false")
39 | public class RestInviteTest {
40 | private static final Catnip catnip = Catnip.catnip(Env.DISCORD_TOKEN);
41 | // TODO: Implement
42 | }
43 |
--------------------------------------------------------------------------------
/src/test/java/com/mewna/catnip/rest/handler/RestWebhookTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020 amy, All rights reserved.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are met:
6 | *
7 | * 1. Redistributions of source code must retain the above copyright notice, this
8 | * list of conditions and the following disclaimer.
9 | * 2. Redistributions in binary form must reproduce the above copyright notice,
10 | * this list of conditions and the following disclaimer in the
11 | * documentation and/or other materials provided with the distribution.
12 | * 3. Neither the name of the copyright holder nor the names of its contributors
13 | * may be used to endorse or promote products derived from this software without
14 | * specific prior written permission.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | package com.mewna.catnip.rest.handler;
29 |
30 | import com.mewna.catnip.Catnip;
31 | import com.mewna.catnip.Env;
32 |
33 | /**
34 | * @author amy
35 | * @since 10/15/20.
36 | */
37 | public class RestWebhookTest {
38 | private static final Catnip catnip = Catnip.catnip(Env.DISCORD_TOKEN);
39 | // TODO: Implement
40 | }
41 |
--------------------------------------------------------------------------------
/src/test/resources/logback-test.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------