Fixed .feed related commands and updated an example to a working one. Updated packages

This commit is contained in:
Kwoth
2022-03-22 11:49:32 +01:00
parent bed3347cd9
commit 77195843d0
4 changed files with 19 additions and 21 deletions

View File

@@ -39,13 +39,18 @@ public abstract class GamblingModule<TService> : NadekoModule<TService>
return true;
}
protected string N<T>(T cur)
where T : INumber<T>
protected string N(long cur)
=> cur.ToString("C0", GetFlowersCiInternal());
protected string N(decimal cur)
=> cur.ToString("C0", GetFlowersCiInternal());
private IFormatProvider GetFlowersCiInternal()
{
var flowersCi = (CultureInfo)Culture.Clone();
flowersCi.NumberFormat.CurrencySymbol = CurrencySign;
flowersCi.NumberFormat.CurrencyNegativePattern = 5;
return cur.ToString("C0", flowersCi);
return flowersCi;
}
protected Task<bool> CheckBetMandatory(long amount)

View File

@@ -155,7 +155,7 @@ public class FeedsService : INService
public List<FeedSub> GetFeeds(ulong guildId)
{
using var uow = _db.GetDbContext();
return uow.GuildConfigsForId(guildId, set => set.Include(x => x.FeedSubs).ThenInclude(x => x.GuildConfig))
return uow.GuildConfigsForId(guildId, set => set.Include(x => x.FeedSubs))
.FeedSubs.OrderBy(x => x.Id)
.ToList();
}
@@ -171,7 +171,7 @@ public class FeedsService : INService
};
using var uow = _db.GetDbContext();
var gc = uow.GuildConfigsForId(guildId, set => set.Include(x => x.FeedSubs).ThenInclude(x => x.GuildConfig));
var gc = uow.GuildConfigsForId(guildId, set => set.Include(x => x.FeedSubs));
if (gc.FeedSubs.Any(x => x.Url.ToLower() == fs.Url.ToLower()))
return false;

View File

@@ -29,14 +29,14 @@
<PackageReference Include="Google.Apis.YouTube.v3" Version="1.55.0.2449" />
<PackageReference Include="Google.Apis.Customsearch.v1" Version="1.49.0.2084" />
<PackageReference Include="Google.Protobuf" Version="3.19.4" />
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.41.0" />
<PackageReference Include="Grpc.Tools" Version="2.41.1">
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.44.0" />
<PackageReference Include="Grpc.Tools" Version="2.44.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Html2Markdown" Version="5.0.2.561" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageReference Include="NetEscapades.Configuration.Yaml" Version="2.1.0" />
@@ -52,21 +52,21 @@
<PackageReference Include="Serilog.Sinks.Seq" Version="5.1.1" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.4" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta0010" />
<PackageReference Include="StackExchange.Redis" Version="2.2.88" />
<PackageReference Include="StackExchange.Redis" Version="2.5.43" />
<PackageReference Include="YamlDotNet" Version="11.2.1" />
<PackageReference Include="Humanizer" Version="2.14.1" />
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" />
<!-- Db-related packages -->
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.2">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="linq2db.EntityFrameworkCore" Version="6.6.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.3" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.3" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.1" />
@@ -124,11 +124,4 @@
<DebugType>portable</DebugType>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>
<!-- TODO: Remove this when the conflict issue in System.Runtime.Experimental is fixed -->
<Target Name="RemoveSystemRuntimeFromRefPack" BeforeTargets="_HandlePackageFileConflicts" Condition="'@(Reference -&gt; WithMetadataValue('NugetPackageId', 'System.Runtime.Experimental'))' != ''">
<ItemGroup>
<Reference Remove="@(Reference)" Condition="$([System.String]::Copy(%(Reference.Identity)).Contains('System.Runtime.dll')) and&#xD;&#xA; '%(Reference.NuGetPackageId)' == 'Microsoft.NETCore.App.Ref'" />
</ItemGroup>
</Target>
</Project>

View File

@@ -1942,8 +1942,8 @@ ytuploadnotif:
feed:
desc: "Subscribes to a feed. Bot will post an update up to once every 10 seconds. You can have up to 10 feeds on one server. All feeds must have unique URLs. Set a channel as a second optional parameter to specify where to send the updates."
args:
- "https://www.rt.com/rss/"
- "https://www.rt.com/rss/ #updates"
- "https://blog.playstation.com/feed/"
- "https://blog.playstation.com/feed/ #updates"
feedremove:
desc: "Stops tracking a feed on the given index. Use `{0}feeds` command to see a list of feeds and their indexes."
args: