5.1.2
This commit is contained in:
commit
d58c516649
16 changed files with 79 additions and 52 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -2,18 +2,24 @@
|
||||||
|
|
||||||
Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o
|
Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o
|
||||||
|
|
||||||
|
## [5.1.2] - 29.06.2024
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Compile issues by disabling honeypot submodule for the time being
|
||||||
|
|
||||||
## [5.1.1] - 29.06.2024
|
## [5.1.1] - 29.06.2024
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Added `.honeypot` command, which automatically softbans (ban and immediate unban) any user who posts in that channel.
|
- Added `'honeypot` command, which automatically softbans (ban and immediate unban) any user who posts in that channel.
|
||||||
- Useful to auto softban bots who spam every channel upon joining
|
- Useful to auto softban bots who spam every channel upon joining
|
||||||
- Users who run commands or expressions won't be softbanned.
|
- Users who run commands or expressions won't be softbanned.
|
||||||
- Users who have ban member permissions are also excluded.
|
- Users who have ban member permissions are also excluded.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed `.betdraw` not respecting maxbet
|
- Fixed `'betdraw` not respecting maxbet
|
||||||
- Fixed `'xpshop` pagination for real this time?
|
- Fixed `'xpshop` pagination for real this time?
|
||||||
|
|
||||||
## [5.1.0] - 28.06.2024
|
## [5.1.0] - 28.06.2024
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using EllieBot.Db.Models;
|
using EllieBot.Db.Models;
|
||||||
|
@ -149,7 +149,7 @@ public abstract class EllieContext : DbContext
|
||||||
.OnDelete(DeleteBehavior.Cascade);
|
.OnDelete(DeleteBehavior.Cascade);
|
||||||
|
|
||||||
// start antispam
|
// start antispam
|
||||||
|
|
||||||
modelBuilder.Entity<GuildConfig>()
|
modelBuilder.Entity<GuildConfig>()
|
||||||
.HasOne(x => x.AntiSpamSetting)
|
.HasOne(x => x.AntiSpamSetting)
|
||||||
.WithOne()
|
.WithOne()
|
||||||
|
@ -282,10 +282,10 @@ public abstract class EllieContext : DbContext
|
||||||
var selfassignableRolesEntity = modelBuilder.Entity<SelfAssignedRole>();
|
var selfassignableRolesEntity = modelBuilder.Entity<SelfAssignedRole>();
|
||||||
|
|
||||||
selfassignableRolesEntity.HasIndex(s => new
|
selfassignableRolesEntity.HasIndex(s => new
|
||||||
{
|
{
|
||||||
s.GuildId,
|
s.GuildId,
|
||||||
s.RoleId
|
s.RoleId
|
||||||
})
|
})
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
selfassignableRolesEntity.Property(x => x.Group).HasDefaultValue(0);
|
selfassignableRolesEntity.Property(x => x.Group).HasDefaultValue(0);
|
||||||
|
@ -358,10 +358,10 @@ public abstract class EllieContext : DbContext
|
||||||
|
|
||||||
var xps = modelBuilder.Entity<UserXpStats>();
|
var xps = modelBuilder.Entity<UserXpStats>();
|
||||||
xps.HasIndex(x => new
|
xps.HasIndex(x => new
|
||||||
{
|
{
|
||||||
x.UserId,
|
x.UserId,
|
||||||
x.GuildId
|
x.GuildId
|
||||||
})
|
})
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
xps.HasIndex(x => x.UserId);
|
xps.HasIndex(x => x.UserId);
|
||||||
|
@ -407,9 +407,9 @@ public abstract class EllieContext : DbContext
|
||||||
.OnDelete(DeleteBehavior.SetNull);
|
.OnDelete(DeleteBehavior.SetNull);
|
||||||
|
|
||||||
ci.HasIndex(x => new
|
ci.HasIndex(x => new
|
||||||
{
|
{
|
||||||
x.Name
|
x.Name
|
||||||
})
|
})
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -528,10 +528,10 @@ public abstract class EllieContext : DbContext
|
||||||
.IsUnique(false);
|
.IsUnique(false);
|
||||||
|
|
||||||
rr2.HasIndex(x => new
|
rr2.HasIndex(x => new
|
||||||
{
|
{
|
||||||
x.MessageId,
|
x.MessageId,
|
||||||
x.Emote
|
x.Emote
|
||||||
})
|
})
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -606,11 +606,11 @@ public abstract class EllieContext : DbContext
|
||||||
{
|
{
|
||||||
// user can own only one of each item
|
// user can own only one of each item
|
||||||
x.HasIndex(model => new
|
x.HasIndex(model => new
|
||||||
{
|
{
|
||||||
model.UserId,
|
model.UserId,
|
||||||
model.ItemType,
|
model.ItemType,
|
||||||
model.ItemKey
|
model.ItemKey
|
||||||
})
|
})
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -635,10 +635,10 @@ public abstract class EllieContext : DbContext
|
||||||
#region Sticky Roles
|
#region Sticky Roles
|
||||||
|
|
||||||
modelBuilder.Entity<StickyRole>(sr => sr.HasIndex(x => new
|
modelBuilder.Entity<StickyRole>(sr => sr.HasIndex(x => new
|
||||||
{
|
{
|
||||||
x.GuildId,
|
x.GuildId,
|
||||||
x.UserId
|
x.UserId
|
||||||
})
|
})
|
||||||
.IsUnique());
|
.IsUnique());
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -4,14 +4,14 @@ using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace EllieBot.Db;
|
namespace EllieBot.Db;
|
||||||
|
|
||||||
public sealed class EllieDbService : DbService
|
public sealed class EllieDbService : DbService
|
||||||
{
|
{
|
||||||
private readonly IBotCredsProvider _creds;
|
private readonly IBotCredsProvider _creds;
|
||||||
|
|
||||||
// these are props because creds can change at runtime
|
// these are props because creds can change at runtime
|
||||||
private string DbType => _creds.GetCreds().Db.Type.ToLowerInvariant().Trim();
|
private string DbType => _creds.GetCreds().Db.Type.ToLowerInvariant().Trim();
|
||||||
private string ConnString => _creds.GetCreds().Db.ConnectionString;
|
private string ConnString => _creds.GetCreds().Db.ConnectionString;
|
||||||
|
|
||||||
public EllieDbService(IBotCredsProvider creds)
|
public EllieDbService(IBotCredsProvider creds)
|
||||||
{
|
{
|
||||||
LinqToDBForEFTools.Initialize();
|
LinqToDBForEFTools.Initialize();
|
||||||
|
@ -26,13 +26,13 @@ public sealed class EllieDbService : DbService
|
||||||
var connString = ConnString;
|
var connString = ConnString;
|
||||||
|
|
||||||
await using var context = CreateRawDbContext(dbType, connString);
|
await using var context = CreateRawDbContext(dbType, connString);
|
||||||
|
|
||||||
// make sure sqlite db is in wal journal mode
|
// make sure sqlite db is in wal journal mode
|
||||||
if (context is SqliteContext)
|
if (context is SqliteContext)
|
||||||
{
|
{
|
||||||
await context.Database.ExecuteSqlRawAsync("PRAGMA journal_mode=WAL");
|
await context.Database.ExecuteSqlRawAsync("PRAGMA journal_mode=WAL");
|
||||||
}
|
}
|
||||||
|
|
||||||
await context.Database.MigrateAsync();
|
await context.Database.MigrateAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ public sealed class EllieDbService : DbService
|
||||||
throw new NotSupportedException($"The database provide type of '{dbType}' is not supported.");
|
throw new NotSupportedException($"The database provide type of '{dbType}' is not supported.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private EllieContext GetDbContextInternal()
|
private EllieContext GetDbContextInternal()
|
||||||
{
|
{
|
||||||
var dbType = DbType;
|
var dbType = DbType;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace EllieBot.Db;
|
namespace EllieBot.Db;
|
||||||
|
|
||||||
public readonly struct LevelStats
|
public readonly struct LevelStats
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#nullable disable
|
#nullable disable
|
||||||
namespace EllieBot.Db.Models;
|
namespace EllieBot.Db.Models;
|
||||||
|
|
||||||
|
|
||||||
// FUTURE remove LastLevelUp from here and UserXpStats
|
// FUTURE remove LastLevelUp from here and UserXpStats
|
||||||
public class DiscordUser : DbEntity
|
public class DiscordUser : DbEntity
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,6 +6,6 @@ public class HoneypotChannel
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
public ulong GuildId { get; set; }
|
public ulong GuildId { get; set; }
|
||||||
|
|
||||||
public ulong ChannelId { get; set; }
|
public ulong ChannelId { get; set; }
|
||||||
}
|
}
|
|
@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace EllieBot.Db.Models;
|
namespace EllieBot.Db.Models;
|
||||||
|
|
||||||
|
|
||||||
public class AntiRaidSetting : DbEntity
|
public class AntiRaidSetting : DbEntity
|
||||||
{
|
{
|
||||||
public int GuildConfigId { get; set; }
|
public int GuildConfigId { get; set; }
|
||||||
|
|
|
@ -6,12 +6,12 @@ public class PatronUser
|
||||||
public string UniquePlatformUserId { get; set; }
|
public string UniquePlatformUserId { get; set; }
|
||||||
public ulong UserId { get; set; }
|
public ulong UserId { get; set; }
|
||||||
public int AmountCents { get; set; }
|
public int AmountCents { get; set; }
|
||||||
|
|
||||||
public DateTime LastCharge { get; set; }
|
public DateTime LastCharge { get; set; }
|
||||||
|
|
||||||
// Date Only component
|
// Date Only component
|
||||||
public DateTime ValidThru { get; set; }
|
public DateTime ValidThru { get; set; }
|
||||||
|
|
||||||
public PatronUser Clone()
|
public PatronUser Clone()
|
||||||
=> new PatronUser()
|
=> new PatronUser()
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>true</ImplicitUsings>
|
<ImplicitUsings>true</ImplicitUsings>
|
||||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||||
<Version>5.1.1</Version>
|
<Version>5.1.2</Version>
|
||||||
|
|
||||||
<!-- Output/build -->
|
<!-- Output/build -->
|
||||||
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
|
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
|
||||||
|
|
|
@ -5,7 +5,7 @@ using EllieBot.Db.Models;
|
||||||
using System.Threading.Channels;
|
using System.Threading.Channels;
|
||||||
|
|
||||||
namespace EllieBot.Modules.Administration.Honeypot;
|
namespace EllieBot.Modules.Administration.Honeypot;
|
||||||
|
/*
|
||||||
public sealed class HoneyPotService : IHoneyPotService, IReadyExecutor, IExecNoCommand, IEService
|
public sealed class HoneyPotService : IHoneyPotService, IReadyExecutor, IExecNoCommand, IEService
|
||||||
{
|
{
|
||||||
private readonly DbService _db;
|
private readonly DbService _db;
|
||||||
|
@ -71,7 +71,8 @@ public sealed class HoneyPotService : IHoneyPotService, IReadyExecutor, IExecNoC
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Log.Information("Honeypot caught user {User} [{UserId}]", user, user.Id);
|
Log.Information("Honeypot caught user {User} [{UserId}]", user, user.Id);
|
||||||
await user.BanAsync();
|
await user.BanAsync(pruneDays: 1);
|
||||||
|
await user.Guild.RemoveBanAsync(user.Id);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -91,4 +92,5 @@ public sealed class HoneyPotService : IHoneyPotService, IReadyExecutor, IExecNoC
|
||||||
await _punishments.Writer.WriteAsync(sgu);
|
await _punishments.Writer.WriteAsync(sgu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
|
@ -1,7 +1,7 @@
|
||||||
using EllieBot.Modules.Administration.Honeypot;
|
using EllieBot.Modules.Administration.Honeypot;
|
||||||
|
|
||||||
namespace EllieBot.Modules.Administration;
|
namespace EllieBot.Modules.Administration;
|
||||||
|
/*
|
||||||
public partial class Administration
|
public partial class Administration
|
||||||
{
|
{
|
||||||
[Group]
|
[Group]
|
||||||
|
@ -26,4 +26,5 @@ public partial class Administration
|
||||||
await Response().Confirm(strs.honeypot_off).SendAsync();
|
await Response().Confirm(strs.honeypot_off).SendAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
|
@ -1,6 +1,7 @@
|
||||||
namespace EllieBot.Modules.Administration.Honeypot;
|
namespace EllieBot.Modules.Administration.Honeypot;
|
||||||
|
/*
|
||||||
public interface IHoneyPotService
|
public interface IHoneyPotService
|
||||||
{
|
{
|
||||||
public Task<bool> ToggleHoneypotChannel(ulong guildId, ulong channelId);
|
public Task<bool> ToggleHoneypotChannel(ulong guildId, ulong channelId);
|
||||||
}
|
}
|
||||||
|
*/
|
|
@ -3,7 +3,7 @@
|
||||||
namespace EllieBot.Modules.Administration;
|
namespace EllieBot.Modules.Administration;
|
||||||
|
|
||||||
public sealed class DummyLogCommandService : ILogCommandService
|
public sealed class DummyLogCommandService : ILogCommandService
|
||||||
#if GLOBAL_ELLIE
|
#if GLOBAL_NADEKO
|
||||||
, IEService
|
, IEService
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,8 +8,8 @@ using EllieBot.Db.Models;
|
||||||
namespace EllieBot.Modules.Administration;
|
namespace EllieBot.Modules.Administration;
|
||||||
|
|
||||||
public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
public sealed class LogCommandService : ILogCommandService, IReadyExecutor
|
||||||
#if !GLOBAL_ELLIE
|
#if !GLOBAL_NADEKO
|
||||||
, IEService // don't load this service on global ellie
|
, IEService // don't load this service on global nadeko
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
public ConcurrentDictionary<ulong, LogSetting> GuildLogSettings { get; }
|
public ConcurrentDictionary<ulong, LogSetting> GuildLogSettings { get; }
|
||||||
|
|
14
src/EllieBot/Modules/Administration/Ticket/TicketCommands.cs
Normal file
14
src/EllieBot/Modules/Administration/Ticket/TicketCommands.cs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// namespace EllieBot.Modules.Administration;
|
||||||
|
//
|
||||||
|
// public partial class Administration
|
||||||
|
// {
|
||||||
|
// [Group]
|
||||||
|
// public partial class TicketCommands : EllieModule
|
||||||
|
// {
|
||||||
|
// [Cmd]
|
||||||
|
// public async Task Ticket()
|
||||||
|
// {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
|
@ -228,7 +228,7 @@ public class UserPunishService : IEService, IReadyExecutor
|
||||||
case PunishmentAction.RemoveRoles:
|
case PunishmentAction.RemoveRoles:
|
||||||
return botUser.GuildPermissions.ManageRoles;
|
return botUser.GuildPermissions.ManageRoles;
|
||||||
case PunishmentAction.ChatMute:
|
case PunishmentAction.ChatMute:
|
||||||
return botUser.GuildPermissions.ManageRoles; // adds ellie-mute role
|
return botUser.GuildPermissions.ManageRoles; // adds nadeko-mute role
|
||||||
case PunishmentAction.VoiceMute:
|
case PunishmentAction.VoiceMute:
|
||||||
return botUser.GuildPermissions.MuteMembers;
|
return botUser.GuildPermissions.MuteMembers;
|
||||||
case PunishmentAction.AddRole:
|
case PunishmentAction.AddRole:
|
||||||
|
|
Loading…
Reference in a new issue