Compare commits

...

7 commits
5.1.20 ... v5

8 changed files with 16 additions and 18 deletions

View file

@ -7,7 +7,7 @@ public static class MigrationQueries
{ {
public static void UpdateUsernames(MigrationBuilder migrationBuilder) public static void UpdateUsernames(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.Sql("UPDATE DiscordUser SET Username = '??' + Username WHERE Discriminator = '????';"); migrationBuilder.Sql("UPDATE DiscordUser SET Username = '??' || Username WHERE Discriminator = '????';");
} }
public static void MigrateRero(MigrationBuilder migrationBuilder) public static void MigrateRero(MigrationBuilder migrationBuilder)

View file

@ -265,7 +265,7 @@ public partial class Gambling : GamblingModule<GamblingService>
{ {
msg += "\n\n"; msg += "\n\n";
if (booster) if (booster)
msg += $"*+{N(Config.BoostBonus.BaseTimelyBonus)} bonus for boosting {userInfo.guild}!*"; msg += $"*+{N(Config.BoostBonus.BaseTimelyBonus)} bonus for boosting {userInfo.guild}!*\n";
if (percentBonus > float.Epsilon) if (percentBonus > float.Epsilon)
msg += msg +=

View file

@ -8,7 +8,7 @@ namespace EllieBot.Modules.Gambling.Services;
public sealed class UserBetStatsService : IEService public sealed class UserBetStatsService : IEService
{ {
private const long RESET_MIN_PRICE = 1000; private const long RESET_MIN_PRICE = 1000;
private const decimal RESET_TOTAL_MULTIPLIER = 0.02m; private const decimal RESET_TOTAL_MULTIPLIER = 0.002m;
private readonly DbService _db; private readonly DbService _db;
private readonly ICurrencyService _cs; private readonly ICurrencyService _cs;

View file

@ -1,5 +1,4 @@
#nullable disable using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using EllieBot.Db.Models; using EllieBot.Db.Models;
namespace EllieBot.Db; namespace EllieBot.Db;
@ -17,6 +16,8 @@ public static class SelfAssignableRolesExtensions
return true; return true;
} }
public static IReadOnlyCollection<SelfAssignedRole> GetFromGuild(this DbSet<SelfAssignedRole> roles, ulong guildId) public static IReadOnlyCollection<SelfAssignedRole> GetFromGuild(
this DbSet<SelfAssignedRole> roles,
ulong guildId)
=> roles.AsQueryable().Where(s => s.GuildId == guildId).ToArray(); => roles.AsQueryable().Where(s => s.GuildId == guildId).ToArray();
} }

View file

@ -1,4 +1,3 @@
#nullable disable
using LinqToDB; using LinqToDB;
using LinqToDB.Data; using LinqToDB.Data;
using LinqToDB.EntityFrameworkCore; using LinqToDB.EntityFrameworkCore;
@ -53,8 +52,7 @@ public sealed class BlacklistService : IExecOnMessage, IReadyExecutor
private ValueTask OnReload(BlacklistEntry[] newBlacklist) private ValueTask OnReload(BlacklistEntry[] newBlacklist)
{ {
if (newBlacklist is null) newBlacklist ??= [];
return default;
blacklistedGuilds = blacklistedGuilds =
new HashSet<ulong>(newBlacklist.Where(x => x.Type == BlacklistType.Server).Select(x => x.ItemId)) new HashSet<ulong>(newBlacklist.Where(x => x.Type == BlacklistType.Server).Select(x => x.ItemId))
@ -69,9 +67,9 @@ public sealed class BlacklistService : IExecOnMessage, IReadyExecutor
return default; return default;
} }
public Task<bool> ExecOnMessageAsync(IGuild guild, IUserMessage usrMsg) public Task<bool> ExecOnMessageAsync(IGuild? guild, IUserMessage usrMsg)
{ {
if (blacklistedGuilds.Contains(guild.Id)) if (guild is not null && blacklistedGuilds.Contains(guild.Id))
{ {
Log.Information("Blocked input from blacklisted guild: {GuildName} [{GuildId}]", Log.Information("Blocked input from blacklisted guild: {GuildName} [{GuildId}]",
guild.Name, guild.Name,

View file

@ -1,5 +1,4 @@
#nullable disable using System.Text.RegularExpressions;
using System.Text.RegularExpressions;
namespace EllieBot.Common.TypeReaders.Models; namespace EllieBot.Common.TypeReaders.Models;
@ -9,8 +8,8 @@ public class StoopidTime
@"^(?:(?<months>\d)mo)?(?:(?<weeks>\d{1,2})w)?(?:(?<days>\d{1,2})d)?(?:(?<hours>\d{1,4})h)?(?:(?<minutes>\d{1,5})m)?(?:(?<seconds>\d{1,6})s)?$", @"^(?:(?<months>\d)mo)?(?:(?<weeks>\d{1,2})w)?(?:(?<days>\d{1,2})d)?(?:(?<hours>\d{1,4})h)?(?:(?<minutes>\d{1,5})m)?(?:(?<seconds>\d{1,6})s)?$",
RegexOptions.Compiled | RegexOptions.Multiline); RegexOptions.Compiled | RegexOptions.Multiline);
public string Input { get; set; } public string Input { get; set; } = string.Empty;
public TimeSpan Time { get; set; } public TimeSpan Time { get; set; } = default;
private StoopidTime() { } private StoopidTime() { }
@ -53,8 +52,8 @@ public class StoopidTime
}; };
} }
public static implicit operator TimeSpan(StoopidTime st) public static implicit operator TimeSpan?(StoopidTime? st)
=> st.Time; => st?.Time;
public static implicit operator StoopidTime(TimeSpan ts) public static implicit operator StoopidTime(TimeSpan ts)
=> new() => new()

View file

@ -1517,7 +1517,7 @@ take:
betroll: betroll:
desc: |- desc: |-
Bets the specified amount of currency and rolls a dice. Bets the specified amount of currency and rolls a dice.
Rolling over 66 yields x2 of your currency, over 90 - x4 and 100 x10. Rolling over 65 yields x2 of your currency, over 90 - x4 and 100 x10.
You can specify 'all', 'half' or 'X%' instead of the amount to bet that part of your current balance. You can specify 'all', 'half' or 'X%' instead of the amount to bet that part of your current balance.
ex: ex:
- 5 - 5