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
This commit is contained in:
Toastie 2024-08-02 00:06:28 +12:00
parent 67224663cd
commit 0397ea09b0
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4
9 changed files with 114 additions and 64 deletions

View file

@ -8,11 +8,10 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6C633450-E6C2-47ED-A7AA-7367232F703A}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6C633450-E6C2-47ED-A7AA-7367232F703A}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
CHANGELOG.md = CHANGELOG.md CHANGELOG.md = CHANGELOG.md
LICENSE = LICENSE
README.md = README.md
Dockerfile = Dockerfile Dockerfile = Dockerfile
NuGet.Config = NuGet.Config LICENSE = LICENSE
migrate.ps1 = migrate.ps1 migrate.ps1 = migrate.ps1
README.md = README.md
remove-migrations.ps1 = remove-migrations.ps1 remove-migrations.ps1 = remove-migrations.ps1
TODO.md = TODO.md TODO.md = TODO.md
EndProjectSection EndProjectSection

View file

@ -1,6 +0,0 @@
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="toastielab.dev" value="https://toastielab.dev/api/packages/ellie/nuget/index.json" protocolVersion="3" />
</packageSources>
</configuration>

View file

@ -9,7 +9,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Discord.Net.Core" Version="3.204.0" /> <PackageReference Include="Discord.Net.Core" Version="3.15.3" />
<PackageReference Include="Serilog" Version="3.1.1" /> <PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="YamlDotNet" Version="15.1.4" /> <PackageReference Include="YamlDotNet" Version="15.1.4" />
</ItemGroup> </ItemGroup>

View file

@ -4,7 +4,7 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>true</ImplicitUsings> <ImplicitUsings>true</ImplicitUsings>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages> <SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<Version>5.1.4</Version> <Version>5.1.5</Version>
<!-- Output/build --> <!-- Output/build -->
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory> <RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
@ -29,7 +29,7 @@
</PackageReference> </PackageReference>
<PackageReference Include="CodeHollow.FeedReader" Version="1.2.6" /> <PackageReference Include="CodeHollow.FeedReader" Version="1.2.6" />
<PackageReference Include="CommandLineParser" Version="2.9.1" /> <PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Discord.Net" Version="3.204.0" /> <PackageReference Include="Discord.Net" Version="3.15.3" />
<PackageReference Include="CoreCLR-NCalc" Version="3.1.246" /> <PackageReference Include="CoreCLR-NCalc" Version="3.1.246" />
<PackageReference Include="Google.Apis.Urlshortener.v1" Version="1.41.1.138" /> <PackageReference Include="Google.Apis.Urlshortener.v1" Version="1.41.1.138" />
<PackageReference Include="Google.Apis.YouTube.v3" Version="1.68.0.3414" /> <PackageReference Include="Google.Apis.YouTube.v3" Version="1.68.0.3414" />

View file

@ -1,10 +1,9 @@
#nullable disable using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace EllieBot.Modules.Games.Common.ChatterBot; namespace EllieBot.Modules.Games.Common.ChatterBot;
public class Choice public class Choice
{ {
[JsonPropertyName("message")] [JsonPropertyName("message")]
public Message Message { get; init; } public required Message Message { get; init; }
} }

View file

@ -1,10 +1,9 @@
#nullable disable using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace EllieBot.Modules.Games.Common.ChatterBot; namespace EllieBot.Modules.Games.Common.ChatterBot;
public class Message public class Message
{ {
[JsonPropertyName("content")] [JsonPropertyName("content")]
public string Content { get; init; } public required string Content { get; init; }
} }

View file

@ -1,16 +1,15 @@
#nullable disable using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace EllieBot.Modules.Games.Common.ChatterBot; namespace EllieBot.Modules.Games.Common.ChatterBot;
public class OpenAiApiMessage public class OpenAiApiMessage
{ {
[JsonPropertyName("role")] [JsonPropertyName("role")]
public string Role { get; init; } public required string Role { get; init; }
[JsonPropertyName("content")] [JsonPropertyName("content")]
public string Content { get; init; } public required string Content { get; init; }
[JsonPropertyName("name")] [JsonPropertyName("name")]
public string Name { get; init; } public required string Name { get; init; }
} }

View file

@ -1,19 +1,18 @@
#nullable disable using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace EllieBot.Modules.Games.Common.ChatterBot; namespace EllieBot.Modules.Games.Common.ChatterBot;
public class OpenAiApiRequest public class OpenAiApiRequest
{ {
[JsonPropertyName("model")] [JsonPropertyName("model")]
public string Model { get; init; } public required string Model { get; init; }
[JsonPropertyName("messages")] [JsonPropertyName("messages")]
public List<OpenAiApiMessage> Messages { get; init; } public required List<OpenAiApiMessage> Messages { get; init; }
[JsonPropertyName("temperature")] [JsonPropertyName("temperature")]
public int Temperature { get; init; } public required int Temperature { get; init; }
[JsonPropertyName("max_tokens")] [JsonPropertyName("max_tokens")]
public int MaxTokens { get; init; } public required int MaxTokens { get; init; }
} }

View file

@ -15,9 +15,11 @@ public sealed class DoAsUserMessage : IUserMessage
_message = message; _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) public Task DeleteAsync(RequestOptions? options = null)
{ {
@ -56,67 +58,104 @@ public sealed class DoAsUserMessage : IUserMessage
ReactionType type = ReactionType.Normal) ReactionType type = ReactionType.Normal)
=> _msg.GetReactionUsersAsync(emoji, limit, options, type); => _msg.GetReactionUsersAsync(emoji, limit, options, type);
public IAsyncEnumerable<IReadOnlyCollection<IUser>> GetReactionUsersAsync(IEmote emoji, int limit, public IAsyncEnumerable<IReadOnlyCollection<IUser>> GetReactionUsersAsync(
IEmote emoji,
int limit,
RequestOptions? options = null) RequestOptions? options = null)
{ {
return _msg.GetReactionUsersAsync(emoji, limit, options); 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<IAttachment> Attachments => _msg.Attachments; public IReadOnlyCollection<IAttachment> Attachments
=> _msg.Attachments;
public IReadOnlyCollection<IEmbed> Embeds => _msg.Embeds; public IReadOnlyCollection<IEmbed> Embeds
=> _msg.Embeds;
public IReadOnlyCollection<ITag> Tags => _msg.Tags; public IReadOnlyCollection<ITag> Tags
=> _msg.Tags;
public IReadOnlyCollection<ulong> MentionedChannelIds => _msg.MentionedChannelIds; public IReadOnlyCollection<ulong> MentionedChannelIds
=> _msg.MentionedChannelIds;
public IReadOnlyCollection<ulong> MentionedRoleIds => _msg.MentionedRoleIds; public IReadOnlyCollection<ulong> MentionedRoleIds
=> _msg.MentionedRoleIds;
public IReadOnlyCollection<ulong> MentionedUserIds => _msg.MentionedUserIds; public IReadOnlyCollection<ulong> 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<IEmote, ReactionMetadata> Reactions => _msg.Reactions; public IReadOnlyDictionary<IEmote, ReactionMetadata> Reactions
=> _msg.Reactions;
public IReadOnlyCollection<IMessageComponent> Components => _msg.Components; public IReadOnlyCollection<IMessageComponent> Components
=> _msg.Components;
public IReadOnlyCollection<IStickerItem> Stickers => _msg.Stickers; public IReadOnlyCollection<IStickerItem> Stickers
=> _msg.Stickers;
public MessageFlags? Flags => _msg.Flags; public MessageFlags? Flags
=> _msg.Flags;
[Obsolete("Obsolete in favor of InteractionMetadata")] [Obsolete("Obsolete in favor of InteractionMetadata")]
public IMessageInteraction Interaction => _msg.Interaction; public IMessageInteraction Interaction
public MessageRoleSubscriptionData RoleSubscriptionData => _msg.RoleSubscriptionData; => _msg.Interaction;
public MessageRoleSubscriptionData RoleSubscriptionData
=> _msg.RoleSubscriptionData;
public PurchaseNotification PurchaseNotification
=> _msg.PurchaseNotification;
public MessageCallData? CallData
=> _msg.CallData;
public Task ModifyAsync(Action<MessageProperties> func, RequestOptions? options = null) public Task ModifyAsync(Action<MessageProperties> func, RequestOptions? options = null)
{ {
@ -138,17 +177,39 @@ public sealed class DoAsUserMessage : IUserMessage
return _msg.CrosspostAsync(options); 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 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); 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<IReadOnlyCollection<IUser>> 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 public IMessageInteractionMetadata InteractionMetadata
=> _msg.InteractionMetadata; => _msg.InteractionMetadata;
public Poll? Poll
=> _msg.Poll;
} }