Upgrade to discord.net 2.0
This commit is contained in:
parent
acb2b25e09
commit
4e4ef3584e
12 changed files with 35 additions and 20 deletions
|
@ -4,6 +4,7 @@ using System.Threading.Tasks;
|
||||||
using Discord;
|
using Discord;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Geekbot.net.Lib.ErrorHandling;
|
using Geekbot.net.Lib.ErrorHandling;
|
||||||
|
using Geekbot.net.Lib.Extensions;
|
||||||
using PokeAPI;
|
using PokeAPI;
|
||||||
|
|
||||||
namespace Geekbot.net.Commands.Games
|
namespace Geekbot.net.Commands.Games
|
||||||
|
|
|
@ -6,16 +6,17 @@ using Discord;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Geekbot.net.Lib.Converters;
|
using Geekbot.net.Lib.Converters;
|
||||||
using Geekbot.net.Lib.ErrorHandling;
|
using Geekbot.net.Lib.ErrorHandling;
|
||||||
|
using Geekbot.net.Lib.Extensions;
|
||||||
using MtgApiManager.Lib.Service;
|
using MtgApiManager.Lib.Service;
|
||||||
|
|
||||||
namespace Geekbot.net.Commands.Integrations
|
namespace Geekbot.net.Commands.Integrations
|
||||||
{
|
{
|
||||||
public class Magicthegathering : ModuleBase
|
public class MagicTheGathering : ModuleBase
|
||||||
{
|
{
|
||||||
private readonly IErrorHandler _errorHandler;
|
private readonly IErrorHandler _errorHandler;
|
||||||
private readonly IMtgManaConverter _manaConverter;
|
private readonly IMtgManaConverter _manaConverter;
|
||||||
|
|
||||||
public Magicthegathering(IErrorHandler errorHandler, IMtgManaConverter manaConverter)
|
public MagicTheGathering(IErrorHandler errorHandler, IMtgManaConverter manaConverter)
|
||||||
{
|
{
|
||||||
_errorHandler = errorHandler;
|
_errorHandler = errorHandler;
|
||||||
_manaConverter = manaConverter;
|
_manaConverter = manaConverter;
|
||||||
|
|
|
@ -5,6 +5,7 @@ using Discord;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Geekbot.net.Lib.Clients;
|
using Geekbot.net.Lib.Clients;
|
||||||
using Geekbot.net.Lib.ErrorHandling;
|
using Geekbot.net.Lib.ErrorHandling;
|
||||||
|
using Geekbot.net.Lib.Extensions;
|
||||||
|
|
||||||
namespace Geekbot.net.Commands.Integrations
|
namespace Geekbot.net.Commands.Integrations
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,6 +5,7 @@ using System.Threading.Tasks;
|
||||||
using Discord;
|
using Discord;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Geekbot.net.Lib.ErrorHandling;
|
using Geekbot.net.Lib.ErrorHandling;
|
||||||
|
using Geekbot.net.Lib.Extensions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Geekbot.net.Commands.Integrations.UbranDictionary
|
namespace Geekbot.net.Commands.Integrations.UbranDictionary
|
||||||
|
|
|
@ -65,11 +65,9 @@ namespace Geekbot.net.Commands.Randomness
|
||||||
await ReplyAsync("", false, Eb(_mediaProvider.GetFox()));
|
await ReplyAsync("", false, Eb(_mediaProvider.GetFox()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private EmbedBuilder Eb(string image)
|
private static Embed Eb(string image)
|
||||||
{
|
{
|
||||||
var eb = new EmbedBuilder();
|
return new EmbedBuilder {ImageUrl = image}.Build();
|
||||||
eb.ImageUrl = image;
|
|
||||||
return eb;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,6 +7,7 @@ using Discord.Commands;
|
||||||
using Discord.WebSocket;
|
using Discord.WebSocket;
|
||||||
using Geekbot.net.Lib;
|
using Geekbot.net.Lib;
|
||||||
using Geekbot.net.Lib.ErrorHandling;
|
using Geekbot.net.Lib.ErrorHandling;
|
||||||
|
using Geekbot.net.Lib.Extensions;
|
||||||
|
|
||||||
namespace Geekbot.net.Commands.Utils
|
namespace Geekbot.net.Commands.Utils
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,6 +7,7 @@ using Discord;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using Geekbot.net.Lib.Converters;
|
using Geekbot.net.Lib.Converters;
|
||||||
using Geekbot.net.Lib.ErrorHandling;
|
using Geekbot.net.Lib.ErrorHandling;
|
||||||
|
using Geekbot.net.Lib.Extensions;
|
||||||
using Geekbot.net.Lib.UserRepository;
|
using Geekbot.net.Lib.UserRepository;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using StackExchange.Redis;
|
using StackExchange.Redis;
|
||||||
|
|
|
@ -187,12 +187,11 @@ namespace Geekbot.net.Commands.Utils.Quote
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var list = Context.Channel.GetMessagesAsync().Flatten();
|
var list = Context.Channel.GetMessagesAsync().Flatten();
|
||||||
await list;
|
return await list.FirstOrDefault(msg =>
|
||||||
return list.Result
|
msg.Author.Id == user.Id &&
|
||||||
.First(msg => msg.Author.Id == user.Id
|
msg.Embeds.Count == 0 &&
|
||||||
&& msg.Embeds.Count == 0
|
msg.Id != Context.Message.Id &&
|
||||||
&& msg.Id != Context.Message.Id
|
!msg.Content.ToLower().StartsWith("!"));
|
||||||
&& !msg.Content.ToLower().StartsWith("!"));
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,10 +20,10 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CommandLineParser" Version="2.2.1" />
|
<PackageReference Include="CommandLineParser" Version="2.2.1" />
|
||||||
<PackageReference Include="Discord.Net">
|
<PackageReference Include="Discord.Net">
|
||||||
<Version>1.0.2</Version>
|
<Version>2.0.0-beta</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Google.Apis.YouTube.v3" Version="1.33.1.1217" />
|
<PackageReference Include="Google.Apis.YouTube.v3" Version="1.33.1.1226" />
|
||||||
<PackageReference Include="HtmlAgilityPack" Version="1.8.1" />
|
<PackageReference Include="HtmlAgilityPack" Version="1.8.2" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.3" />
|
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.3" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.DataProtection.Redis" Version="0.3.3" />
|
<PackageReference Include="Microsoft.AspNetCore.DataProtection.Redis" Version="0.3.3" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.0.3" />
|
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.0.3" />
|
||||||
|
@ -40,12 +40,12 @@
|
||||||
<PackageReference Include="MtgApiManager.Lib" Version="1.1.0" />
|
<PackageReference Include="MtgApiManager.Lib" Version="1.1.0" />
|
||||||
<PackageReference Include="MyAnimeListSharp" Version="1.3.4" />
|
<PackageReference Include="MyAnimeListSharp" Version="1.3.4" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||||
<PackageReference Include="NLog" Version="4.5.3" />
|
<PackageReference Include="NLog" Version="4.5.4" />
|
||||||
<PackageReference Include="NLog.Config" Version="4.5.3" />
|
<PackageReference Include="NLog.Config" Version="4.5.4" />
|
||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.0.2" />
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.0.2" />
|
||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="1.1.1" />
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="1.1.1" />
|
||||||
<PackageReference Include="PokeApi.NET" Version="1.1.0" />
|
<PackageReference Include="PokeApi.NET" Version="1.1.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.3.2" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
<PackageReference Include="SumoLogic.Logging.NLog" Version="1.0.0.7" />
|
<PackageReference Include="SumoLogic.Logging.NLog" Version="1.0.0.7" />
|
||||||
<PackageReference Include="System.Net.Http" Version="4.3.3" />
|
<PackageReference Include="System.Net.Http" Version="4.3.3" />
|
||||||
<PackageReference Include="System.Runtime.Serialization.Formatters" Version="4.3.0" />
|
<PackageReference Include="System.Runtime.Serialization.Formatters" Version="4.3.0" />
|
||||||
|
|
12
Geekbot.net/Lib/Extensions/EmbedBuilderExtensions.cs
Normal file
12
Geekbot.net/Lib/Extensions/EmbedBuilderExtensions.cs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
using Discord;
|
||||||
|
|
||||||
|
namespace Geekbot.net.Lib.Extensions
|
||||||
|
{
|
||||||
|
public static class EmbedBuilderExtensions
|
||||||
|
{
|
||||||
|
public static EmbedBuilder AddInlineField(this EmbedBuilder builder, string name, object value)
|
||||||
|
{
|
||||||
|
return builder.AddField(new EmbedFieldBuilder().WithIsInline(true).WithName(name).WithValue(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,7 +9,7 @@ namespace Geekbot.net.Lib.Polyfills
|
||||||
public ulong Id { get; set; }
|
public ulong Id { get; set; }
|
||||||
public DateTimeOffset CreatedAt { get; set; }
|
public DateTimeOffset CreatedAt { get; set; }
|
||||||
public string Mention { get; set; }
|
public string Mention { get; set; }
|
||||||
public Game? Game { get; set; }
|
public IActivity Activity { get; }
|
||||||
public UserStatus Status { get; set; }
|
public UserStatus Status { get; set; }
|
||||||
public string AvatarId { get; set; }
|
public string AvatarId { get; set; }
|
||||||
public string Discriminator { get; set; }
|
public string Discriminator { get; set; }
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<NoWarn>NU1701</NoWarn>
|
<NoWarn>NU1701</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
|
||||||
<PackageReference Include="xunit" Version="2.3.1" />
|
<PackageReference Include="xunit" Version="2.3.1" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
|
||||||
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
|
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
|
||||||
|
|
Loading…
Reference in a new issue