1
Fork 0
mirror of https://gitlab.com/Kwoth/nadekobot.git synced 2024-10-02 12:09:07 +00:00

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
This commit is contained in:
Kwoth 2024-08-01 02:36:49 +00:00
parent 0df3c1a4a1
commit 2c3ada4710
9 changed files with 110 additions and 55 deletions

View file

@ -12,7 +12,6 @@ ProjectSection(SolutionItems) = preProject
README.md = README.md README.md = README.md
.gitlab-ci.yml = .gitlab-ci.yml .gitlab-ci.yml = .gitlab-ci.yml
Dockerfile = Dockerfile Dockerfile = Dockerfile
NuGet.Config = NuGet.Config
migrate.ps1 = migrate.ps1 migrate.ps1 = migrate.ps1
remove-migration.ps1 = remove-migration.ps1 remove-migration.ps1 = remove-migration.ps1
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="nadeko.bot" value="https://www.myget.org/F/nadeko/api/v3/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

@ -5,5 +5,5 @@ namespace NadekoBot.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

@ -2,7 +2,8 @@
namespace NadekoBot.Modules.Games.Common.ChatterBot; namespace NadekoBot.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

@ -5,11 +5,11 @@ namespace NadekoBot.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

@ -5,14 +5,14 @@ namespace NadekoBot.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

@ -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

@ -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;
} }