From 2c3ada471004a0018f1ac451bf719cb7d0ee456f Mon Sep 17 00:00:00 2001 From: Kwoth Date: Thu, 1 Aug 2024 02:36:49 +0000 Subject: [PATCH] dev: using official version of discord.net docs: upped version to 5.1.5 dev: removed nuget.config as we no longer rely on myget dev: Fixed some build warnings --- NadekoBot.sln | 1 - NuGet.Config | 6 - src/Nadeko.Medusa/Nadeko.Medusa.csproj | 2 +- .../Games/ChatterBot/_common/Choice.cs | 2 +- .../Games/ChatterBot/_common/Message.cs | 5 +- .../_common/OpenAiApi/OpenAiApiMessage.cs | 6 +- .../_common/OpenAiApi/OpenAiApiRequest.cs | 8 +- src/NadekoBot/NadekoBot.csproj | 4 +- src/NadekoBot/_common/DoAsUserMessage.cs | 131 +++++++++++++----- 9 files changed, 110 insertions(+), 55 deletions(-) delete mode 100644 NuGet.Config diff --git a/NadekoBot.sln b/NadekoBot.sln index 797877752..43cfa0936 100644 --- a/NadekoBot.sln +++ b/NadekoBot.sln @@ -12,7 +12,6 @@ ProjectSection(SolutionItems) = preProject README.md = README.md .gitlab-ci.yml = .gitlab-ci.yml Dockerfile = Dockerfile - NuGet.Config = NuGet.Config migrate.ps1 = migrate.ps1 remove-migration.ps1 = remove-migration.ps1 EndProjectSection diff --git a/NuGet.Config b/NuGet.Config deleted file mode 100644 index ed0cbc0ef..000000000 --- a/NuGet.Config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/Nadeko.Medusa/Nadeko.Medusa.csproj b/src/Nadeko.Medusa/Nadeko.Medusa.csproj index 527901041..a38edcb00 100644 --- a/src/Nadeko.Medusa/Nadeko.Medusa.csproj +++ b/src/Nadeko.Medusa/Nadeko.Medusa.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/NadekoBot/Modules/Games/ChatterBot/_common/Choice.cs b/src/NadekoBot/Modules/Games/ChatterBot/_common/Choice.cs index e52096513..4345946bf 100644 --- a/src/NadekoBot/Modules/Games/ChatterBot/_common/Choice.cs +++ b/src/NadekoBot/Modules/Games/ChatterBot/_common/Choice.cs @@ -5,5 +5,5 @@ namespace NadekoBot.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/NadekoBot/Modules/Games/ChatterBot/_common/Message.cs b/src/NadekoBot/Modules/Games/ChatterBot/_common/Message.cs index 3698bdc62..690bfa73e 100644 --- a/src/NadekoBot/Modules/Games/ChatterBot/_common/Message.cs +++ b/src/NadekoBot/Modules/Games/ChatterBot/_common/Message.cs @@ -2,7 +2,8 @@ namespace NadekoBot.Modules.Games.Common.ChatterBot; -public class Message { +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/NadekoBot/Modules/Games/ChatterBot/_common/OpenAiApi/OpenAiApiMessage.cs b/src/NadekoBot/Modules/Games/ChatterBot/_common/OpenAiApi/OpenAiApiMessage.cs index e8ac4b05c..2df865f75 100644 --- a/src/NadekoBot/Modules/Games/ChatterBot/_common/OpenAiApi/OpenAiApiMessage.cs +++ b/src/NadekoBot/Modules/Games/ChatterBot/_common/OpenAiApi/OpenAiApiMessage.cs @@ -5,11 +5,11 @@ namespace NadekoBot.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/NadekoBot/Modules/Games/ChatterBot/_common/OpenAiApi/OpenAiApiRequest.cs b/src/NadekoBot/Modules/Games/ChatterBot/_common/OpenAiApi/OpenAiApiRequest.cs index e58b3c79a..65ed44309 100644 --- a/src/NadekoBot/Modules/Games/ChatterBot/_common/OpenAiApi/OpenAiApiRequest.cs +++ b/src/NadekoBot/Modules/Games/ChatterBot/_common/OpenAiApi/OpenAiApiRequest.cs @@ -5,14 +5,14 @@ namespace NadekoBot.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/NadekoBot/NadekoBot.csproj b/src/NadekoBot/NadekoBot.csproj index e5d670a08..97bd341ea 100644 --- a/src/NadekoBot/NadekoBot.csproj +++ b/src/NadekoBot/NadekoBot.csproj @@ -4,7 +4,7 @@ enable true en - 5.1.4 + 5.1.5 $(MSBuildProjectDirectory) @@ -29,7 +29,7 @@ - + diff --git a/src/NadekoBot/_common/DoAsUserMessage.cs b/src/NadekoBot/_common/DoAsUserMessage.cs index 7c66fc6e6..9dc574807 100644 --- a/src/NadekoBot/_common/DoAsUserMessage.cs +++ b/src/NadekoBot/_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