- .streamsclear re-added. It will remove all followed streams on the server.

- .gifts now have 3 new ✂️ Haircut 🧻 ToiletPaper and 🥀 WiltedRose which **reduce** waifu's value
- Added a new multiplier (waifu.multi.negative_gift_effect default 0.5, changeable via .config gambling or data/gambling.yml)
This commit is contained in:
Kwoth
2021-09-30 08:53:15 +02:00
parent 52c9ec670d
commit ff95b3d00f
12 changed files with 247 additions and 159 deletions

View File

@@ -14,6 +14,8 @@ using NadekoBot.Extensions;
using StackExchange.Redis;
using Discord;
using Discord.WebSocket;
using LinqToDB;
using LinqToDB.EntityFrameworkCore;
using NadekoBot.Common.Collections;
using NadekoBot.Common.Replacements;
using NadekoBot.Db;
@@ -342,19 +344,18 @@ namespace NadekoBot.Modules.Searches.Services
return Task.CompletedTask;
}
public int ClearAllStreams(ulong guildId)
public async Task<int> ClearAllStreams(ulong guildId)
{
// todo future clear streams
int count;
using (var uow = _db.GetDbContext())
{
var gc = uow.GuildConfigsForId(guildId, set => set.Include(x => x.FollowedStreams));
count = gc.FollowedStreams.Count;
gc.FollowedStreams.Clear();
uow.SaveChanges();
}
using var uow = _db.GetDbContext();
var gc = uow.GuildConfigsForId(guildId, set => set.Include(x => x.FollowedStreams));
uow.RemoveRange(gc.FollowedStreams);
return count;
foreach (var s in gc.FollowedStreams)
await PublishUnfollowStream(s);
uow.SaveChanges();
return gc.FollowedStreams.Count;
}
public async Task<FollowedStream> UnfollowStreamAsync(ulong guildId, int index)

View File

@@ -69,14 +69,14 @@ namespace NadekoBot.Modules.Searches
fs.Type));
}
// [NadekoCommand, Usage, Description, Aliases]
// [RequireContext(ContextType.Guild)]
// [UserPerm(GuildPerm.Administrator)]
// public async Task StreamsClear()
// {
// var count = _service.ClearAllStreams(ctx.Guild.Id);
// await ReplyErrorLocalizedAsync(strs.streams_cleared(count)));
// }
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.Administrator)]
public async Task StreamsClear()
{
var count = _service.ClearAllStreams(ctx.Guild.Id);
await ReplyConfirmLocalizedAsync(strs.streams_cleared);
}
[NadekoCommand, Aliases]
[RequireContext(ContextType.Guild)]