Update discord.net to v3

This commit is contained in:
Daan Boerlage 2022-07-22 19:46:32 +02:00
parent be06870892
commit b0d603e518
Signed by: daan
GPG key ID: FCE070E1E4956606
10 changed files with 38 additions and 19 deletions

View file

@ -14,7 +14,7 @@
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.8.0" />
<PackageReference Include="Discord.Net" Version="2.4.0" />
<PackageReference Include="Discord.Net" Version="3.7.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.12">
<PrivateAssets>all</PrivateAssets>

View file

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Discord;
@ -12,8 +13,17 @@ namespace Geekbot.Core.Polyfills
public string Mention { get; set; }
public IActivity Activity { get; }
public UserStatus Status { get; set; }
IReadOnlyCollection<ClientType> IPresence.ActiveClients => ActiveClients;
IReadOnlyCollection<IActivity> IPresence.Activities => Activities;
public IImmutableSet<ClientType> ActiveClients { get; }
public IImmutableList<IActivity> Activities { get; }
public Task<IDMChannel> CreateDMChannelAsync(RequestOptions options = null)
{
throw new NotImplementedException();
}
public string AvatarId { get; set; }
public string AvatarUrl { get; set; }
public string Discriminator { get; set; }

View file

@ -8,8 +8,8 @@ namespace Geekbot.Core.ReactionListener
{
bool IsListener(ulong id);
Task AddRoleToListener(ulong messageId, ulong guildId, string emoji, IRole role);
void RemoveRole(ISocketMessageChannel channel, SocketReaction reaction);
void GiveRole(ISocketMessageChannel message, SocketReaction reaction);
void RemoveRole(IMessageChannel channel, SocketReaction reaction);
void GiveRole(IMessageChannel message, SocketReaction reaction);
IEmote ConvertStringToEmote(string emoji);
}
}

View file

@ -67,7 +67,7 @@ namespace Geekbot.Core.ReactionListener
_listener[messageId].Add(emote, role.Id);
}
public async void RemoveRole(ISocketMessageChannel channel, SocketReaction reaction)
public async void RemoveRole(IMessageChannel channel, SocketReaction reaction)
{
_listener.TryGetValue(reaction.MessageId, out var registeredReactions);
if (registeredReactions == null) return;
@ -86,7 +86,7 @@ namespace Geekbot.Core.ReactionListener
}
}
public async void GiveRole(ISocketMessageChannel channel, SocketReaction reaction)
public async void GiveRole(IMessageChannel channel, SocketReaction reaction)
{
_listener.TryGetValue(reaction.MessageId, out var registeredReactions);
if (registeredReactions == null) return;

View file

@ -34,7 +34,7 @@ namespace Geekbot.Core
Transaction.Finish();
}
protected override Task<IUserMessage> ReplyAsync(string message = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null)
protected Task<IUserMessage> ReplyAsync(string message = null, bool isTTS = false, Embed embed = null, RequestOptions options = null, AllowedMentions allowedMentions = null, MessageReference messageReference = null)
{
var replySpan = Transaction.StartChild("Reply");
var msg = base.ReplyAsync(message, isTTS, embed, options, allowedMentions, messageReference);