Skip to content

Commit

Permalink
Merge pull request #700 from nyxx-discord/dev
Browse files Browse the repository at this point in the history
Deploy 6.4.0
  • Loading branch information
l7ssha authored Oct 4, 2024
2 parents a3b02d5 + e5e171c commit af06819
Show file tree
Hide file tree
Showing 61 changed files with 1,787 additions and 322 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
## 6.4.0
__04.10.2024__

- feat: Add new permissions (#679)
- bug: Make webhook execute apply name/avatar when message doesn't contain any attachments (#681)
- bug: Add missing `approximateUserInstallCount` to `Application` (#683)
- feat: Add missing audit log event types (#684)
- feat: Add auditLogReason to followChannel (#685)
- feat: Add recurrence rules for scheduled events (#686)
- bug: Add missing fields to Message (#689)
- feat: Add type field to Invite (#688)
- bug: Delete any commands left over in tests (#693)
- feat: Add fetch voice state endpoints (#692)
- feat: Add support for subscriptions (#690)
- feat: Add update onboarding endpoint to GuildManager (#687)
- feat: Add application emojis (#678)
- feat: Improve cache implementation (#694)
- bug: Don't modify Cache.keys during iteration (#698)

## 6.3.1
__11.07.2024__

Expand Down
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
53 changes: 40 additions & 13 deletions lib/nyxx.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ 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, DefaultValue;
export 'src/builders/message/poll.dart' show PollAnswerBuilder, PollBuilder, PollMediaBuilder;
Expand All @@ -54,10 +54,11 @@ 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, ActionMetadataBuilder, AutoModerationActionBuilder;
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;
Expand All @@ -72,7 +73,7 @@ export 'src/builders/interaction_response.dart' show InteractionResponseBuilder,
export 'src/builders/entitlement.dart' show TestEntitlementBuilder, TestEntitlementType;
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 @@ -96,12 +97,14 @@ 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'
Expand Down Expand Up @@ -144,12 +147,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;
// ignore: deprecated_member_use_from_same_package
export 'src/models/message/message.dart' show Message, MessageFlags, PartialMessage, MessageType, MessageInteraction, MessageInteractionMetadata;
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 @@ -164,7 +177,7 @@ export 'src/models/message/component.dart'
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, BulkBanResponse;
Expand All @@ -185,9 +198,21 @@ export 'src/models/guild/guild.dart'
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
Expand All @@ -197,7 +222,8 @@ export 'src/models/application.dart'
PartialApplication,
ApplicationRoleConnectionMetadata,
ConnectionMetadataType,
ApplicationIntegrationType;
ApplicationIntegrationType,
ApplicationIntegrationTypeConfiguration;
export 'src/models/guild/template.dart' show GuildTemplate;
export 'src/models/guild/auto_moderation.dart'
show
Expand Down Expand Up @@ -315,8 +341,9 @@ export 'src/models/interaction.dart'
PingInteraction,
InteractionContextType;
export 'src/models/entitlement.dart' show Entitlement, PartialEntitlement, EntitlementType;
export 'src/models/sku.dart' show Sku, SkuType, SkuFlags;
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/intents.dart' show GatewayIntents;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/api_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ 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.3.1';
static const nyxxVersion = '6.4.0';

/// The URL to the nyxx repository used in [defaultUserAgent].
static const nyxxRepositoryUrl = 'https://github.com/nyxx-discord/nyxx';
Expand Down
33 changes: 33 additions & 0 deletions lib/src/builders/emoji/emoji.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,36 @@ class EmojiUpdateBuilder implements UpdateBuilder<GuildEmoji> {
if (!identical(roles, sentinelList)) 'roles': roles?.map((s) => s.toString()).toList(),
};
}

class ApplicationEmojiBuilder implements CreateBuilder<ApplicationEmoji> {
/// The name of the emoji.
String name;

/// The 128x128 emoji image.
ImageBuilder image;

ApplicationEmojiBuilder({
required this.name,
required this.image,
});

@override
Map<String, Object?> build() => {
'name': name,
'image': image.buildDataString(),
};
}

class ApplicationEmojiUpdateBuilder implements UpdateBuilder<ApplicationEmoji> {
/// The name of the emoji.
String? name;

ApplicationEmojiUpdateBuilder({
this.name,
});

@override
Map<String, Object?> build() => {
if (name != null) 'name': name,
};
}
95 changes: 95 additions & 0 deletions lib/src/builders/guild/onboarding.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import 'package:nyxx/src/builders/builder.dart';
import 'package:nyxx/src/models/emoji.dart';
import 'package:nyxx/src/models/guild/onboarding.dart';
import 'package:nyxx/src/models/snowflake.dart';

class OnboardingUpdateBuilder extends UpdateBuilder<Onboarding> {
List<OnboardingPromptBuilder> prompts;

List<Snowflake> defaultChannelIds;

bool isEnabled;

OnboardingMode mode;

OnboardingUpdateBuilder({
required this.prompts,
required this.defaultChannelIds,
required this.isEnabled,
required this.mode,
});

@override
Map<String, Object?> build() => {
'prompts': prompts.map((prompt) => prompt.build()).toList(),
'default_channel_ids': defaultChannelIds.map((channelId) => channelId.toString()).toList(),
'enabled': isEnabled,
'mode': mode.value,
};
}

class OnboardingPromptBuilder extends CreateBuilder<OnboardingPrompt> {
OnboardingPromptType type;

List<OnboardingPromptOptionBuilder> options;

String title;

bool isSingleSelect;

bool isRequired;

bool isInOnboarding;

OnboardingPromptBuilder({
required this.type,
required this.options,
required this.title,
required this.isSingleSelect,
required this.isRequired,
required this.isInOnboarding,
});

@override
Map<String, Object?> build() => {
'type': type.value,
'options': options.map((option) => option.build()).toList(),
'title': title,
'single_select': isSingleSelect,
'required': isRequired,
'in_onboarding': isInOnboarding,
};
}

class OnboardingPromptOptionBuilder extends CreateBuilder<OnboardingPromptOption> {
List<Snowflake> channelIds;

List<Snowflake> roleIds;

Emoji? emoji;

String title;

String? description;

OnboardingPromptOptionBuilder({
required this.channelIds,
required this.roleIds,
this.emoji,
required this.title,
this.description,
});

@override
Map<String, Object?> build() => {
'channel_ids': channelIds.map((id) => id.toString()).toList(),
'role_ids': roleIds.map((id) => id.toString()).toList(),
if (emoji case final emoji?) 'emoji_name': emoji.name,
if (emoji case GuildEmoji emoji) ...{
'emoji_id': emoji.id,
'emoji_animated': emoji.isAnimated,
},
'title': title,
'description': description,
};
}
Loading

0 comments on commit af06819

Please sign in to comment.