.boost should now us the correct channel, and it should send a message for users boosting the same server more than once

This commit is contained in:
Kwoth
2021-09-12 21:05:19 +02:00
parent 8ee1160a00
commit 0429210a73
2 changed files with 8 additions and 2 deletions

View File

@@ -54,7 +54,12 @@ namespace NadekoBot.Services
private Task ClientOnGuildMemberUpdated(SocketGuildUser oldUser, SocketGuildUser newUser)
{
if (oldUser is { PremiumSince: null } && newUser is { PremiumSince: not null })
// if user is a new booster
// or boosted again the same server
if ((oldUser is { PremiumSince: null } && newUser is { PremiumSince: not null })
|| (oldUser.PremiumSince is DateTimeOffset oldDate
&& newUser.PremiumSince is DateTimeOffset newDate
&& newDate > oldDate))
{
var conf = GetOrAddSettingsForGuild(newUser.Guild.Id);
if (!conf.SendBoostMessage) return Task.CompletedTask;
@@ -603,6 +608,7 @@ namespace NadekoBot.Services
using var uow = _db.GetDbContext();
var conf = uow.GuildConfigsForId(guildId, set => set);
conf.SendBoostMessage = !conf.SendBoostMessage;
conf.BoostMessageChannelId = channelId;
await uow.SaveChangesAsync();
var toAdd = GreetSettings.Create(conf);

View File

@@ -19,7 +19,7 @@ namespace NadekoBot.Services
private readonly IBotCredentials _creds;
private readonly DateTime _started;
public const string BotVersion = "3.0.1";
public const string BotVersion = "3.0.2";
public string Author => "Kwoth#2452";
public string Library => "Discord.Net";