From 0397ea09b0bcf2c81f6dff26df3a450406491c21 Mon Sep 17 00:00:00 2001 From: Toastie Date: Fri, 2 Aug 2024 00:06:28 +1200 Subject: [PATCH] using official version of discord.net upped version to 5.1.5 removed nuget.config as we are no longer using our fork of discord.net Fixed some build warnings --- EllieBot.sln | 5 +- NuGet.Config | 6 - src/Ellie.Marmalade/Ellie.Marmalade.csproj | 2 +- src/EllieBot/EllieBot.csproj | 4 +- .../Games/ChatterBot/_common/Choice.cs | 5 +- .../Games/ChatterBot/_common/Message.cs | 5 +- .../_common/OpenAiApi/OpenAiApiMessage.cs | 9 +- .../_common/OpenAiApi/OpenAiApiRequest.cs | 11 +- src/EllieBot/_common/DoAsUserMessage.cs | 131 +++++++++++++----- 9 files changed, 114 insertions(+), 64 deletions(-) delete mode 100644 NuGet.Config diff --git a/EllieBot.sln b/EllieBot.sln index 4a3f164..f34ad17 100644 --- a/EllieBot.sln +++ b/EllieBot.sln @@ -8,11 +8,10 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6C633450-E6C2-47ED-A7AA-7367232F703A}" ProjectSection(SolutionItems) = preProject CHANGELOG.md = CHANGELOG.md - LICENSE = LICENSE - README.md = README.md Dockerfile = Dockerfile - NuGet.Config = NuGet.Config + LICENSE = LICENSE migrate.ps1 = migrate.ps1 + README.md = README.md remove-migrations.ps1 = remove-migrations.ps1 TODO.md = TODO.md EndProjectSection diff --git a/NuGet.Config b/NuGet.Config deleted file mode 100644 index 7e64704..0000000 --- a/NuGet.Config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/Ellie.Marmalade/Ellie.Marmalade.csproj b/src/Ellie.Marmalade/Ellie.Marmalade.csproj index db33025..8371f74 100644 --- a/src/Ellie.Marmalade/Ellie.Marmalade.csproj +++ b/src/Ellie.Marmalade/Ellie.Marmalade.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/EllieBot/EllieBot.csproj b/src/EllieBot/EllieBot.csproj index dfb91a8..1f0a2f0 100644 --- a/src/EllieBot/EllieBot.csproj +++ b/src/EllieBot/EllieBot.csproj @@ -4,7 +4,7 @@ enable true en - 5.1.4 + 5.1.5 $(MSBuildProjectDirectory) @@ -29,7 +29,7 @@ - + diff --git a/src/EllieBot/Modules/Games/ChatterBot/_common/Choice.cs b/src/EllieBot/Modules/Games/ChatterBot/_common/Choice.cs index 0d3cbe8..c1290dd 100644 --- a/src/EllieBot/Modules/Games/ChatterBot/_common/Choice.cs +++ b/src/EllieBot/Modules/Games/ChatterBot/_common/Choice.cs @@ -1,10 +1,9 @@ -#nullable disable -using System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace EllieBot.Modules.Games.Common.ChatterBot; public class Choice { [JsonPropertyName("message")] - public Message Message { get; init; } + public required Message Message { get; init; } } \ No newline at end of file diff --git a/src/EllieBot/Modules/Games/ChatterBot/_common/Message.cs b/src/EllieBot/Modules/Games/ChatterBot/_common/Message.cs index bd85a77..df26315 100644 --- a/src/EllieBot/Modules/Games/ChatterBot/_common/Message.cs +++ b/src/EllieBot/Modules/Games/ChatterBot/_common/Message.cs @@ -1,10 +1,9 @@ -#nullable disable -using System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace EllieBot.Modules.Games.Common.ChatterBot; public class Message { [JsonPropertyName("content")] - public string Content { get; init; } + public required string Content { get; init; } } \ No newline at end of file diff --git a/src/EllieBot/Modules/Games/ChatterBot/_common/OpenAiApi/OpenAiApiMessage.cs b/src/EllieBot/Modules/Games/ChatterBot/_common/OpenAiApi/OpenAiApiMessage.cs index efadfc0..20ee90d 100644 --- a/src/EllieBot/Modules/Games/ChatterBot/_common/OpenAiApi/OpenAiApiMessage.cs +++ b/src/EllieBot/Modules/Games/ChatterBot/_common/OpenAiApi/OpenAiApiMessage.cs @@ -1,16 +1,15 @@ -#nullable disable -using System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace EllieBot.Modules.Games.Common.ChatterBot; public class OpenAiApiMessage { [JsonPropertyName("role")] - public string Role { get; init; } + public required string Role { get; init; } [JsonPropertyName("content")] - public string Content { get; init; } + public required string Content { get; init; } [JsonPropertyName("name")] - public string Name { get; init; } + public required string Name { get; init; } } \ No newline at end of file diff --git a/src/EllieBot/Modules/Games/ChatterBot/_common/OpenAiApi/OpenAiApiRequest.cs b/src/EllieBot/Modules/Games/ChatterBot/_common/OpenAiApi/OpenAiApiRequest.cs index cf06ac1..3ab7d68 100644 --- a/src/EllieBot/Modules/Games/ChatterBot/_common/OpenAiApi/OpenAiApiRequest.cs +++ b/src/EllieBot/Modules/Games/ChatterBot/_common/OpenAiApi/OpenAiApiRequest.cs @@ -1,19 +1,18 @@ -#nullable disable -using System.Text.Json.Serialization; +using System.Text.Json.Serialization; namespace EllieBot.Modules.Games.Common.ChatterBot; public class OpenAiApiRequest { [JsonPropertyName("model")] - public string Model { get; init; } + public required string Model { get; init; } [JsonPropertyName("messages")] - public List Messages { get; init; } + public required List Messages { get; init; } [JsonPropertyName("temperature")] - public int Temperature { get; init; } + public required int Temperature { get; init; } [JsonPropertyName("max_tokens")] - public int MaxTokens { get; init; } + public required int MaxTokens { get; init; } } \ No newline at end of file diff --git a/src/EllieBot/_common/DoAsUserMessage.cs b/src/EllieBot/_common/DoAsUserMessage.cs index f7f2980..68a9188 100644 --- a/src/EllieBot/_common/DoAsUserMessage.cs +++ b/src/EllieBot/_common/DoAsUserMessage.cs @@ -15,9 +15,11 @@ public sealed class DoAsUserMessage : IUserMessage _message = message; } - public ulong Id => _msg.Id; + public ulong Id + => _msg.Id; - public DateTimeOffset CreatedAt => _msg.CreatedAt; + public DateTimeOffset CreatedAt + => _msg.CreatedAt; public Task DeleteAsync(RequestOptions? options = null) { @@ -56,67 +58,104 @@ public sealed class DoAsUserMessage : IUserMessage ReactionType type = ReactionType.Normal) => _msg.GetReactionUsersAsync(emoji, limit, options, type); - public IAsyncEnumerable> GetReactionUsersAsync(IEmote emoji, int limit, + public IAsyncEnumerable> GetReactionUsersAsync( + IEmote emoji, + int limit, RequestOptions? options = null) { return _msg.GetReactionUsersAsync(emoji, limit, options); } - public MessageType Type => _msg.Type; + public MessageType Type + => _msg.Type; - public MessageSource Source => _msg.Source; + public MessageSource Source + => _msg.Source; - public bool IsTTS => _msg.IsTTS; + public bool IsTTS + => _msg.IsTTS; - public bool IsPinned => _msg.IsPinned; + public bool IsPinned + => _msg.IsPinned; - public bool IsSuppressed => _msg.IsSuppressed; + public bool IsSuppressed + => _msg.IsSuppressed; - public bool MentionedEveryone => _msg.MentionedEveryone; + public bool MentionedEveryone + => _msg.MentionedEveryone; - public string Content => _message; + public string Content + => _message; - public string CleanContent => _msg.CleanContent; + public string CleanContent + => _msg.CleanContent; - public DateTimeOffset Timestamp => _msg.Timestamp; + public DateTimeOffset Timestamp + => _msg.Timestamp; - public DateTimeOffset? EditedTimestamp => _msg.EditedTimestamp; + public DateTimeOffset? EditedTimestamp + => _msg.EditedTimestamp; - public IMessageChannel Channel => _msg.Channel; + public IMessageChannel Channel + => _msg.Channel; - public IUser Author => _user; + public IUser Author + => _user; - public IThreadChannel Thread => _msg.Thread; + public IThreadChannel Thread + => _msg.Thread; - public IReadOnlyCollection Attachments => _msg.Attachments; + public IReadOnlyCollection Attachments + => _msg.Attachments; - public IReadOnlyCollection Embeds => _msg.Embeds; + public IReadOnlyCollection Embeds + => _msg.Embeds; - public IReadOnlyCollection Tags => _msg.Tags; + public IReadOnlyCollection Tags + => _msg.Tags; - public IReadOnlyCollection MentionedChannelIds => _msg.MentionedChannelIds; + public IReadOnlyCollection MentionedChannelIds + => _msg.MentionedChannelIds; - public IReadOnlyCollection MentionedRoleIds => _msg.MentionedRoleIds; + public IReadOnlyCollection MentionedRoleIds + => _msg.MentionedRoleIds; - public IReadOnlyCollection MentionedUserIds => _msg.MentionedUserIds; + public IReadOnlyCollection MentionedUserIds + => _msg.MentionedUserIds; - public MessageActivity Activity => _msg.Activity; + public MessageActivity Activity + => _msg.Activity; - public MessageApplication Application => _msg.Application; + public MessageApplication Application + => _msg.Application; - public MessageReference Reference => _msg.Reference; + public MessageReference Reference + => _msg.Reference; - public IReadOnlyDictionary Reactions => _msg.Reactions; + public IReadOnlyDictionary Reactions + => _msg.Reactions; - public IReadOnlyCollection Components => _msg.Components; + public IReadOnlyCollection Components + => _msg.Components; - public IReadOnlyCollection Stickers => _msg.Stickers; + public IReadOnlyCollection Stickers + => _msg.Stickers; - public MessageFlags? Flags => _msg.Flags; + public MessageFlags? Flags + => _msg.Flags; [Obsolete("Obsolete in favor of InteractionMetadata")] - public IMessageInteraction Interaction => _msg.Interaction; - public MessageRoleSubscriptionData RoleSubscriptionData => _msg.RoleSubscriptionData; + public IMessageInteraction Interaction + => _msg.Interaction; + + public MessageRoleSubscriptionData RoleSubscriptionData + => _msg.RoleSubscriptionData; + + public PurchaseNotification PurchaseNotification + => _msg.PurchaseNotification; + + public MessageCallData? CallData + => _msg.CallData; public Task ModifyAsync(Action func, RequestOptions? options = null) { @@ -138,17 +177,39 @@ public sealed class DoAsUserMessage : IUserMessage return _msg.CrosspostAsync(options); } - public string Resolve(TagHandling userHandling = TagHandling.Name, TagHandling channelHandling = TagHandling.Name, + public string Resolve( + TagHandling userHandling = TagHandling.Name, + TagHandling channelHandling = TagHandling.Name, TagHandling roleHandling = TagHandling.Name, - TagHandling everyoneHandling = TagHandling.Ignore, TagHandling emojiHandling = TagHandling.Name) + TagHandling everyoneHandling = TagHandling.Ignore, + TagHandling emojiHandling = TagHandling.Name) { return _msg.Resolve(userHandling, channelHandling, roleHandling, everyoneHandling, emojiHandling); } - public MessageResolvedData ResolvedData => _msg.ResolvedData; + public Task EndPollAsync(RequestOptions options) + => _msg.EndPollAsync(options); - public IUserMessage ReferencedMessage => _msg.ReferencedMessage; + public IAsyncEnumerable> GetPollAnswerVotersAsync( + uint answerId, + int? limit = null, + ulong? afterId = null, + RequestOptions? options = null) + => _msg.GetPollAnswerVotersAsync( + answerId, + limit, + afterId, + options); + + public MessageResolvedData ResolvedData + => _msg.ResolvedData; + + public IUserMessage ReferencedMessage + => _msg.ReferencedMessage; public IMessageInteractionMetadata InteractionMetadata => _msg.InteractionMetadata; + + public Poll? Poll + => _msg.Poll; } \ No newline at end of file