Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge back main into next #714

Merged
merged 108 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
dbf39f8
Update PULL_REQUEST_TEMPLATE.md
l7ssha Sep 12, 2023
4ec02a3
Merge pull request #568 from nyxx-discord/next
l7ssha Oct 16, 2023
11c026e
Merge pull request #569 from nyxx-discord/main
l7ssha Oct 16, 2023
9728833
fix: incorrect "description_localizations" key's value build for Comm…
priyanuj-gogoi Oct 22, 2023
31ab26d
fix: ButtonBuilder constructor not including customId (#570)
hexaclue Oct 23, 2023
758648c
Fix voice states not being cached correctly in GUILD_CREATE event (#575)
abitofevrything Oct 29, 2023
a78b1f8
Fix parsing scheduled events without channels (#576)
abitofevrything Oct 29, 2023
2afc142
Fix using ephemeral responses with message component interactions (#577)
abitofevrything Oct 29, 2023
1919613
Fix parsing message component label when it is null (#578)
abitofevrything Oct 29, 2023
08a14be
fix text input value not being present in built json (#579)
MCausc78 Oct 29, 2023
ab35012
Improve caching and reduce incorrect ID use (#580)
abitofevrything Nov 1, 2023
5dac578
Release 6.0.1 (#581)
abitofevrything Nov 1, 2023
55a8c76
Fix autocompletion interaction responses (#585)
abitofevrything Nov 6, 2023
f7abb73
Correct assertions in interaction.respond (#584)
abitofevrything Nov 6, 2023
752ea45
Release 6.0.2 (#588)
abitofevrything Nov 16, 2023
d30e9b5
add permissions (#590)
MCausc78 Nov 19, 2023
573c9bc
Correctly build autocompletion responses (#591)
abitofevrything Nov 26, 2023
46f128c
Try to fix invalid sessions received when reconnecting to the Gateway…
abitofevrything Nov 26, 2023
43df51b
Release 6.0.3 (#593)
abitofevrything Nov 26, 2023
a81ee15
Fix incorrect snowflake serialization (#595)
MCausc78 Dec 1, 2023
c1eab88
Fix incorrect GuildUpdateBuilder & overwrites serialization (#596)
MCausc78 Dec 2, 2023
3ba7e7e
add automod message types (#597)
MCausc78 Dec 4, 2023
d04db1a
Fix unused `listBans` params (#598)
MCausc78 Dec 7, 2023
3cd4f53
Add test validating ApiOptions.nyxxVersion (#605)
abitofevrything Dec 9, 2023
f23cfd2
Export Credentials from package:oauth2 (#604)
abitofevrything Dec 9, 2023
c12ba89
Provide guild ID when parsing message interactions (#603)
abitofevrything Dec 9, 2023
7a0f346
Add entitlement delete payload (#599)
abitofevrything Dec 9, 2023
74bf507
Add SKU flags field (#602)
abitofevrything Dec 9, 2023
5a833f3
Add select menu default values (#601)
abitofevrything Dec 9, 2023
57ce193
Enable dartdoc link to source (#607)
abitofevrything Dec 9, 2023
73c813a
Release 6.1.0 (#608)
abitofevrything Dec 9, 2023
b082750
Update README.md (#606)
abitofevrything Dec 9, 2023
6ed9657
Implement gdm control endpoints (#600)
MCausc78 Dec 11, 2023
982e0d9
Implement `username`/`avatarUrl` params for `WebhookManager#execute` …
MCausc78 Dec 31, 2023
896004a
Update locale.dart (#610)
MCausc78 Dec 31, 2023
bb54de1
Prevent events from being dropped during the connection process (#612)
abitofevrything Dec 31, 2023
1a4ed82
Handle missing command permissions error (#613)
abitofevrything Dec 31, 2023
f6ef61b
Rate limit outgoing gateway events (#614)
abitofevrything Jan 5, 2024
4c7f7fa
Widen type of RoleUpdateBuilder.permissions (#617)
abitofevrything Jan 5, 2024
a1b2bc6
Export unexported types (#616)
abitofevrything Jan 5, 2024
ff92f86
Allow plugins to intercept HTTP requests and Gateway events (#615)
abitofevrything Jan 5, 2024
797579b
Correct serialization of request body in MessageManager.bulkDelete (#…
abitofevrything Jan 6, 2024
7ea4070
Parse GuildDeleteEvent.isUnavailable even when unavailable is not pre…
abitofevrything Jan 7, 2024
bad6daa
Correct getting started link in README (#620)
abitofevrything Jan 11, 2024
d9593c5
Correct serialization of guild builders (#621)
abitofevrything Jan 16, 2024
463cda9
fix (#623)
MCausc78 Jan 18, 2024
3e0ecdf
Hide model constructors in generated dartdocs (#624)
abitofevrything Jan 18, 2024
495b88f
Fix parsing role flags in guild templates (#625)
abitofevrything Jan 18, 2024
bb62547
Fixed hoist attribute in both role builder and role update builder (#…
HARUM1122 Jan 20, 2024
4ece7f7
Add more methods on models, bugfixes (#628)
MCausc78 Feb 17, 2024
7407767
Add `enforceNonce` field to `MessageBuilder` (#631)
MCausc78 Feb 17, 2024
0deacf8
impl (#632)
MCausc78 Feb 18, 2024
a1d89ca
Correct the user agent used by default (#633)
abitofevrything Feb 24, 2024
408fe03
Fix OAuth2 requiring `identify` scope, and add ability to quickly lis…
MCausc78 Mar 8, 2024
1e8d5e5
Add fields to delete events containing cached values before the delet…
MCausc78 Mar 12, 2024
2e09030
Add builders to auto moderation actions & moderation (#636)
abitofevrything Mar 12, 2024
02ee8a6
fix: Intialize logging sooner to prevent missed logs (#637)
Lexedia Mar 15, 2024
42f7bef
Add banner to UserUpdateBuilder, and `SkuFlags.available` (#638)
MCausc78 Mar 15, 2024
70c9d04
Add bungie/domain/roblox connection types and correct SkuFlags.availa…
MCausc78 Mar 16, 2024
10181ac
Add user apps (#641)
MCausc78 Mar 20, 2024
6adc5ff
Add `bulkBan` to `GuildManager` (#640)
MCausc78 Mar 29, 2024
e09aebe
Release 6.2.0 (#642)
abitofevrything Mar 31, 2024
89068e7
Fix case where `ApplicationCommand.integrationTypes` is null (#647)
MCausc78 Apr 3, 2024
63a9b26
Release 6.2.1 (#648)
abitofevrything Apr 3, 2024
efdf25c
Add integration test for updating the current user (#652)
abitofevrything Apr 25, 2024
b874066
Add one time purchase SKUs support (#651)
MCausc78 Apr 25, 2024
f2c33ce
Correctly include query parameters (#653)
Lexedia Apr 25, 2024
976d290
Add warning for rate limits (#654)
abitofevrything Apr 27, 2024
55c94c3
Forward deleteMessages duration to `@ban` (#656)
Lexedia May 2, 2024
e8d9d5d
Ensure client.close() cleans up any pending async operations (#655)
abitofevrything May 2, 2024
7908853
Add polls support (#644)
MCausc78 May 23, 2024
27b74b5
Correctly encode the audit log header to a URI component (#659)
Lexedia May 23, 2024
a502121
fix automod: Add missing types (#662)
Lexedia Jun 11, 2024
b06596b
fix: update auto-mod builders (#663)
Lexedia Jun 11, 2024
50f3377
Add blockMemberInteraction action type (#664)
Lexedia Jun 11, 2024
19efe05
Add `ButtonStyle.premium` and deprecate `InteractionCallbackType.prem…
MCausc78 Jun 18, 2024
a74af03
Remove `label` and `emoji` parameters from ButtonBuilder.premium() (#…
kingmigdor Jun 21, 2024
0a212fd
Replace (almost) all parsable enums to an enum-like class (#665)
Lexedia Jun 24, 2024
9eb5569
fix: interaction metadata user is an object now (#668)
Lexedia Jul 7, 2024
8afc76d
Release 6.3.0 (#670)
abitofevrything Jul 7, 2024
0824294
fix: `answer_id` being null (#673)
Lexedia Jul 11, 2024
a3b02d5
Release 6.3.1 (#674)
Lexedia Jul 11, 2024
c91f050
add new permissions (#679)
Lexedia Jul 21, 2024
cac408e
make webhook execute apply name/avatar when message doesn't contain a…
chyzman Jul 30, 2024
71b4424
use guild role fetch endpoint (#682)
Lexedia Aug 13, 2024
3e2de40
Add missing `approximateUserInstallCount` to `Application` (#683)
abitofevrything Sep 1, 2024
b1b6414
Add missing audit log event types (#684)
abitofevrything Sep 1, 2024
8f7f629
Add auditLogReason to followChannel (#685)
abitofevrything Sep 1, 2024
ffc0c08
Add recurrence rules for scheduled events (#686)
abitofevrything Sep 1, 2024
8a469c4
Add missing fields to Message (#689)
abitofevrything Sep 1, 2024
e38dbf8
Add type field to Invite (#688)
abitofevrything Sep 1, 2024
7022767
Delete any commands left over in tests (#693)
abitofevrything Sep 3, 2024
b91d782
Add fetch voice state endpoints (#692)
abitofevrything Sep 7, 2024
8e50682
Add support for subscriptions (#690)
abitofevrything Sep 7, 2024
002cdfc
Add update onboarding endpoint to GuildManager (#687)
abitofevrything Sep 7, 2024
56ec264
Add application emojis (#678)
Lexedia Sep 21, 2024
59c0b39
Improve cache implementation (#694)
abitofevrything Sep 23, 2024
8b4b451
Don't modify Cache.keys during iteration (#698)
abitofevrything Oct 2, 2024
e5e171c
release/6.4.0 (#699)
l7ssha Oct 4, 2024
d2312de
bug: Fix exports
l7ssha Oct 4, 2024
a623a74
release/6.4.1
l7ssha Oct 4, 2024
d8d90f6
release/6.4.1
l7ssha Oct 4, 2024
4b2b11b
Add missing subscription manager getter (#703)
abitofevrything Oct 5, 2024
6dcd588
Set limits on the default maximum cache sizes (#704)
abitofevrything Oct 5, 2024
93d7e8d
Release 6.4.2 (#705)
abitofevrything Oct 5, 2024
087ea93
link to PRs/commits in CHANGELOG (#707)
Lexedia Oct 6, 2024
9e66bb8
Handle missing mention_roles field (#709)
abitofevrything Oct 8, 2024
bcba971
Release 6.4.3 (#710)
abitofevrything Oct 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ Please delete options that are not relevant.
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have checked my changes haven't lowered code coverage
485 changes: 310 additions & 175 deletions CHANGELOG.md

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

A complete, robust and efficient wrapper around Discord's API for bots & applications.

To get started using nyxx, follow our [getting started guide](https://nyxx.l7ssha.xyz/docs/guides/writing_your_first_bot) to write your first bot.
To get started using nyxx, follow our [getting started guide](https://nyxx.l7ssha.xyz/docs/tutorials/writing_your_first_bot) to write your first bot.

If you're already familiar with Discord's API, here's a quick example to get you started:
```dart
Expand All @@ -31,9 +31,8 @@ void main() async {
## Other nyxx packages

- [nyxx_commands](https://pub.dev/packages/nyxx_commands): A command framework for handling both simple & complex commands.
- [nyxx_pagination](https://pub.dev/packages/nyxx_pagination): Pagination support for nyxx.
- [nyxx_extensions](https://pub.dev/packages/nyxx_extensions): Pagination, emoji utilities and other miscellaneous helpers for developing bots using nyxx.
- [nyxx_lavalink](https://pub.dev/packages/nyxx_lavalink): Lavalink support for playing audio in voice channels.
- [nyxx_extensions](https://pub.dev/packages/nyxx_extensions): Miscellaneous helpers for common situations when developing bots.

## More examples

Expand Down
4 changes: 4 additions & 0 deletions dartdoc_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dartdoc:
linkToSource:
root: .
uriTemplate: 'https://github.com/nyxx-discord/nyxx/blob/main/%f%#L%l%'
2 changes: 1 addition & 1 deletion example/simple_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void main() async {
// we received.
await event.message.channel.sendMessage(MessageBuilder(
content: 'Pong!',
replyId: event.message.id,
referencedMessage: MessageReferenceBuilder.reply(messageId: event.message.id),
));
}
});
Expand Down
99 changes: 76 additions & 23 deletions lib/nyxx.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ export 'src/errors.dart'
OutOfRemainingSessionsError,
IntegrationNotFoundException,
AlreadyAcknowledgedError,
AlreadyRespondedError;
AlreadyRespondedError,
PluginError,
ClientClosedError,
SkuNotFoundException;

export 'src/builders/builder.dart' show Builder, CreateBuilder, UpdateBuilder;
export 'src/builders/image.dart' show ImageBuilder;
export 'src/builders/user.dart' show UserUpdateBuilder;
export 'src/builders/permission_overwrite.dart' show PermissionOverwriteBuilder;
export 'src/builders/channel/channel_position.dart' show ChannelPositionBuilder;
export 'src/builders/channel/forum_tag.dart' show ForumTagBuilder;
export 'src/builders/channel/group_dm.dart' show GroupDmUpdateBuilder;
export 'src/builders/channel/group_dm.dart' show GroupDmUpdateBuilder, DmRecipientBuilder;
export 'src/builders/channel/guild_channel.dart'
show
ForumChannelUpdateBuilder,
Expand All @@ -43,32 +46,35 @@ export 'src/builders/channel/thread.dart' show ThreadUpdateBuilder, ForumThreadB
export 'src/builders/message/allowed_mentions.dart' show AllowedMentions;
export 'src/builders/message/attachment.dart' show AttachmentBuilder;
export 'src/builders/message/embed.dart' show EmbedBuilder, EmbedAuthorBuilder, EmbedFieldBuilder, EmbedFooterBuilder, EmbedImageBuilder, EmbedThumbnailBuilder;
export 'src/builders/message/message.dart' show MessageBuilder, MessageUpdateBuilder;
export 'src/builders/message/message.dart' show MessageBuilder, MessageUpdateBuilder, MessageReferenceBuilder;
export 'src/builders/message/component.dart'
show ActionRowBuilder, ButtonBuilder, MessageComponentBuilder, SelectMenuBuilder, SelectMenuOptionBuilder, TextInputBuilder;
show ActionRowBuilder, ButtonBuilder, MessageComponentBuilder, SelectMenuBuilder, SelectMenuOptionBuilder, TextInputBuilder, DefaultValue;
export 'src/builders/message/poll.dart' show PollAnswerBuilder, PollBuilder, PollMediaBuilder;
export 'src/builders/webhook.dart' show WebhookBuilder, WebhookUpdateBuilder;
export 'src/builders/guild/guild.dart' show GuildBuilder, GuildUpdateBuilder;
export 'src/builders/guild/member.dart' show CurrentMemberUpdateBuilder, MemberBuilder, MemberUpdateBuilder;
export 'src/builders/guild/welcome_screen.dart' show WelcomeScreenUpdateBuilder;
export 'src/builders/guild/widget.dart' show WidgetSettingsUpdateBuilder;
export 'src/builders/guild/scheduled_event.dart' show ScheduledEventBuilder, ScheduledEventUpdateBuilder;
export 'src/builders/guild/scheduled_event.dart' show ScheduledEventBuilder, ScheduledEventUpdateBuilder, RecurrenceRuleBuilder;
export 'src/builders/guild/template.dart' show GuildTemplateBuilder, GuildTemplateUpdateBuilder;
export 'src/builders/guild/auto_moderation.dart' show AutoModerationRuleBuilder, AutoModerationRuleUpdateBuilder;
export 'src/builders/guild/auto_moderation.dart'
show AutoModerationRuleBuilder, AutoModerationRuleUpdateBuilder, ActionMetadataBuilder, AutoModerationActionBuilder, TriggerMetadataBuilder;
export 'src/builders/guild/onboarding.dart' show OnboardingPromptBuilder, OnboardingPromptOptionBuilder, OnboardingUpdateBuilder;
export 'src/builders/role.dart' show RoleBuilder, RoleUpdateBuilder;
export 'src/builders/voice.dart' show CurrentUserVoiceStateUpdateBuilder, VoiceStateUpdateBuilder, GatewayVoiceStateBuilder;
export 'src/builders/presence.dart' show PresenceBuilder, CurrentUserStatus, ActivityBuilder;
export 'src/builders/application_role_connection.dart' show ApplicationRoleConnectionUpdateBuilder;
export 'src/builders/emoji/emoji.dart' show EmojiBuilder, EmojiUpdateBuilder;
export 'src/builders/emoji/emoji.dart' show EmojiBuilder, EmojiUpdateBuilder, ApplicationEmojiBuilder, ApplicationEmojiUpdateBuilder;
export 'src/builders/emoji/reaction.dart' show ReactionBuilder;
export 'src/builders/invite.dart' show InviteBuilder;
export 'src/builders/sticker.dart' show StickerBuilder, StickerUpdateBuilder;
export 'src/builders/application_command.dart'
show ApplicationCommandBuilder, ApplicationCommandUpdateBuilder, CommandOptionBuilder, CommandOptionChoiceBuilder;
export 'src/builders/interaction_response.dart' show InteractionResponseBuilder, ModalBuilder, InteractionCallbackType;
export 'src/builders/entitlement.dart' show TestEntitlementBuilder, TestEntitlementType;
export 'src/builders/application.dart' show ApplicationUpdateBuilder;
export 'src/builders/application.dart' show ApplicationUpdateBuilder, ApplicationIntegrationTypeConfigurationBuilder;

export 'src/cache/cache.dart' show Cache, CacheConfig;
export 'src/cache/cache.dart' show Cache, CacheConfig, CacheManager;

export 'src/http/bucket.dart' show HttpBucket;
export 'src/http/handler.dart' show HttpHandler, Oauth2HttpHandler, RateLimitInfo;
Expand All @@ -92,15 +98,20 @@ export 'src/http/managers/gateway_manager.dart' show GatewayManager;
export 'src/http/managers/scheduled_event_manager.dart' show ScheduledEventManager;
export 'src/http/managers/auto_moderation_manager.dart' show AutoModerationManager;
export 'src/http/managers/integration_manager.dart' show IntegrationManager;
export 'src/http/managers/emoji_manager.dart' show EmojiManager;
export 'src/http/managers/emoji_manager.dart' show EmojiManager, ApplicationEmojiManager, GuildEmojiManager;
export 'src/http/managers/audit_log_manager.dart' show AuditLogManager;
export 'src/http/managers/sticker_manager.dart' show GuildStickerManager, GlobalStickerManager;
export 'src/http/managers/application_command_manager.dart' show ApplicationCommandManager, GlobalApplicationCommandManager, GuildApplicationCommandManager;
export 'src/http/managers/interaction_manager.dart' show InteractionManager;
export 'src/http/managers/entitlement_manager.dart' show EntitlementManager;
export 'src/http/managers/sku_manager.dart' show SkuManager;
export 'src/http/managers/subscription_manager.dart' show SubscriptionManager;

export 'src/gateway/gateway.dart' show Gateway;
export 'src/gateway/message.dart' show Disconnecting, Dispose, ErrorReceived, EventReceived, GatewayMessage, Send, ShardData, ShardMessage;
export 'src/gateway/event_parser.dart' show EventParser;
export 'src/gateway/shard_runner.dart' show ShardRunner, ShardConnection;
export 'src/gateway/message.dart'
show Disconnecting, Dispose, ErrorReceived, EventReceived, GatewayMessage, Send, Sent, ShardData, ShardMessage, Identify, RequestingIdentify, StartShard;
export 'src/gateway/shard.dart' show Shard;

export 'src/models/discord_color.dart' show DiscordColor;
Expand Down Expand Up @@ -139,10 +150,22 @@ export 'src/models/message/activity.dart' show MessageActivity, MessageActivityT
export 'src/models/message/attachment.dart' show Attachment, AttachmentFlags;
export 'src/models/message/author.dart' show MessageAuthor;
export 'src/models/message/channel_mention.dart' show ChannelMention;
export 'src/models/message/embed.dart' show Embed, EmbedAuthor, EmbedField, EmbedFooter, EmbedImage, EmbedProvider, EmbedThumbnail, EmbedVideo;
export 'src/models/message/message.dart' show Message, MessageFlags, PartialMessage, MessageType, MessageInteraction;
export 'src/models/message/embed.dart' show Embed, EmbedAuthor, EmbedField, EmbedFooter, EmbedImage, EmbedProvider, EmbedThumbnail, EmbedVideo, EmbedType;

export 'src/models/message/message.dart'
show
Message,
MessageFlags,
PartialMessage,
MessageType,
// ignore: deprecated_member_use_from_same_package
MessageInteraction,
MessageInteractionMetadata,
MessageSnapshot,
MessageCall;
export 'src/models/message/poll.dart' show Poll, PollAnswer, PollAnswerCount, PollMedia, PollResults, PollLayoutType;
export 'src/models/message/reaction.dart' show Reaction, ReactionCountDetails;
export 'src/models/message/reference.dart' show MessageReference;
export 'src/models/message/reference.dart' show MessageReference, MessageReferenceType;
export 'src/models/message/role_subscription_data.dart' show RoleSubscriptionData;
export 'src/models/message/component.dart'
show
Expand All @@ -151,14 +174,16 @@ export 'src/models/message/component.dart'
MessageComponent,
SelectMenuComponent,
SelectMenuOption,
SelectMenuDefaultValue,
SelectMenuDefaultValueType,
TextInputComponent,
ButtonStyle,
MessageComponentType,
TextInputStyle;
export 'src/models/invite/invite.dart' show Invite, TargetType;
export 'src/models/invite/invite.dart' show Invite, TargetType, InviteType;
export 'src/models/invite/invite_metadata.dart' show InviteWithMetadata;
export 'src/models/webhook.dart' show PartialWebhook, Webhook, WebhookType, WebhookAuthor;
export 'src/models/guild/ban.dart' show Ban;
export 'src/models/guild/ban.dart' show Ban, BulkBanResponse;
export 'src/models/guild/guild_preview.dart' show GuildPreview;
export 'src/models/guild/guild_widget.dart' show GuildWidget, WidgetSettings, WidgetImageStyle;
export 'src/models/guild/guild.dart'
Expand All @@ -172,15 +197,36 @@ export 'src/models/guild/guild.dart'
MfaLevel,
NsfwLevel,
PremiumTier,
VerificationLevel;
VerificationLevel,
UserGuild;
export 'src/models/guild/integration.dart' show PartialIntegration, Integration, IntegrationAccount, IntegrationApplication, IntegrationExpireBehavior;
export 'src/models/guild/member.dart' show Member, MemberFlags, PartialMember;
export 'src/models/guild/onboarding.dart' show Onboarding, OnboardingPrompt, OnboardingPromptOption, OnboardingPromptType;
export 'src/models/guild/onboarding.dart' show Onboarding, OnboardingPrompt, OnboardingPromptOption, OnboardingPromptType, OnboardingMode;
export 'src/models/guild/welcome_screen.dart' show WelcomeScreen, WelcomeScreenChannel;
export 'src/models/guild/scheduled_event.dart' show EntityMetadata, PartialScheduledEvent, ScheduledEvent, ScheduledEventUser, EventStatus, ScheduledEntityType;
export 'src/models/guild/scheduled_event.dart'
show
EntityMetadata,
PartialScheduledEvent,
ScheduledEvent,
ScheduledEventUser,
EventStatus,
ScheduledEntityType,
RecurrenceRule,
RecurrenceRuleFrequency,
RecurrenceRuleMonth,
RecurrenceRuleNWeekday,
RecurrenceRuleWeekday;
export 'src/models/guild/audit_log.dart' show AuditLogChange, AuditLogEntry, AuditLogEntryInfo, PartialAuditLogEntry, AuditLogEvent;
export 'src/models/application.dart'
show Application, ApplicationFlags, InstallationParameters, PartialApplication, ApplicationRoleConnectionMetadata, ConnectionMetadataType;
show
Application,
ApplicationFlags,
InstallationParameters,
PartialApplication,
ApplicationRoleConnectionMetadata,
ConnectionMetadataType,
ApplicationIntegrationType,
ApplicationIntegrationTypeConfiguration;
export 'src/models/guild/template.dart' show GuildTemplate;
export 'src/models/guild/auto_moderation.dart'
show
Expand Down Expand Up @@ -260,7 +306,9 @@ export 'src/models/gateway/events/message.dart'
MessageReactionRemoveAllEvent,
MessageReactionRemoveEmojiEvent,
MessageReactionRemoveEvent,
MessageUpdateEvent;
MessageUpdateEvent,
MessagePollVoteAddEvent,
MessagePollVoteRemoveEvent;
export 'src/models/gateway/events/presence.dart' show PresenceUpdateEvent, TypingStartEvent, UserUpdateEvent;
export 'src/models/gateway/events/ready.dart' show ReadyEvent, ResumedEvent;
export 'src/models/gateway/events/stage_instance.dart' show StageInstanceCreateEvent, StageInstanceDeleteEvent, StageInstanceUpdateEvent;
Expand Down Expand Up @@ -293,11 +341,15 @@ export 'src/models/interaction.dart'
ApplicationCommandInteraction,
MessageComponentInteraction,
ModalSubmitInteraction,
PingInteraction;
PingInteraction,
InteractionContextType;
export 'src/models/entitlement.dart' show Entitlement, PartialEntitlement, EntitlementType;
export 'src/models/sku.dart' show Sku, SkuType;
export 'src/models/sku.dart' show Sku, SkuType, SkuFlags, PartialSku;
export 'src/models/oauth2.dart' show OAuth2Information;
export 'src/models/subscription.dart' show PartialSubscription, Subscription, SubscriptionStatus;

export 'src/utils/flags.dart' show Flag, Flags;
export 'src/utils/enum_like.dart' show EnumLike;
export 'src/intents.dart' show GatewayIntents;

export 'src/plugin/plugin.dart' show NyxxPlugin, NyxxPluginState;
Expand All @@ -316,3 +368,4 @@ export 'package:http/http.dart'
StreamedResponse;
export 'package:logging/logging.dart' show Logger, Level;
export 'package:runtime_type/runtime_type.dart' show RuntimeType;
export 'package:oauth2/oauth2.dart' show Credentials;
4 changes: 2 additions & 2 deletions lib/src/api_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import 'package:oauth2/oauth2.dart';
/// Options for connecting to the Discord API.
abstract class ApiOptions {
/// The version of nyxx used in [defaultUserAgent].
static const nyxxVersion = '6.0.0';
static const nyxxVersion = '6.4.3';

/// The URL to the nyxx repository used in [defaultUserAgent].
static const nyxxRepositoryUrl = 'https://github.com/nyxx-discord/nyxx';

/// The default value for the `User-Agent` header for bots made with nyxx.
static const defaultUserAgent = 'Nyxx ($nyxxRepositoryUrl, $nyxxVersion)';
static const defaultUserAgent = 'DiscordBot ($nyxxRepositoryUrl, $nyxxVersion)';

/// The host at which the API can be found.
///
Expand Down
32 changes: 28 additions & 4 deletions lib/src/builders/application.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ import 'package:nyxx/src/builders/sentinels.dart';
import 'package:nyxx/src/models/application.dart';
import 'package:nyxx/src/utils/flags.dart';

class ApplicationIntegrationTypeConfigurationBuilder extends CreateBuilder<ApplicationIntegrationTypeConfiguration> {
/// Install params for each installation context's default in-app authorization link.
final InstallationParameters? oauth2InstallParameters;

ApplicationIntegrationTypeConfigurationBuilder({this.oauth2InstallParameters});

@override
Map<String, Object?> build() => {
if (oauth2InstallParameters != null)
'oauth2_install_params': {
'scopes': oauth2InstallParameters!.scopes,
'permissions': oauth2InstallParameters!.permissions.value.toString(),
},
};
}

class ApplicationUpdateBuilder extends UpdateBuilder<Application> {
Uri? customInstallUrl;

Expand All @@ -23,31 +39,39 @@ class ApplicationUpdateBuilder extends UpdateBuilder<Application> {

List<String>? tags;

Map<ApplicationIntegrationType, ApplicationIntegrationTypeConfigurationBuilder>? integrationTypesConfig;

ApplicationUpdateBuilder({
this.customInstallUrl,
this.description,
this.roleConnectionsVerificationUrl,
this.roleConnectionsVerificationUrl = sentinelUri,
this.installationParameters,
this.flags,
this.icon = sentinelImageBuilder,
this.coverImage = sentinelImageBuilder,
this.interactionsEndpointUrl,
this.interactionsEndpointUrl = sentinelUri,
this.tags,
this.integrationTypesConfig,
});

@override
Map<String, Object?> build() => {
if (customInstallUrl != null) 'custom_install_url': customInstallUrl!.toString(),
if (description != null) 'description': description,
if (roleConnectionsVerificationUrl != null) 'role_connections_verification_url': roleConnectionsVerificationUrl!.toString(),
if (!identical(roleConnectionsVerificationUrl, sentinelUri)) 'role_connections_verification_url': roleConnectionsVerificationUrl?.toString(),
if (installationParameters != null)
'install_params': {
'scopes': installationParameters!.scopes,
'permissions': installationParameters!.permissions.toString(),
'permissions': installationParameters!.permissions.value.toString(),
},
if (integrationTypesConfig != null)
'integration_types_config': {
for (final MapEntry(:key, :value) in integrationTypesConfig!.entries) key.value.toString(): value.build(),
},
if (flags != null) 'flags': flags!.value,
if (!identical(icon, sentinelImageBuilder)) 'icon': icon?.buildDataString(),
if (!identical(coverImage, sentinelImageBuilder)) 'cover_image': coverImage?.buildDataString(),
if (!identical(interactionsEndpointUrl, sentinelUri)) 'interactions_endpoint_url': interactionsEndpointUrl?.toString(),
if (tags != null) 'tags': tags,
};
}
Loading
Loading