mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
e036a2d3c9 | ||
|
62a16f3faf | ||
|
231451f978 | ||
|
2bed4e7eac | ||
|
22eea3fa7b |
36
CHANGELOG.md
36
CHANGELOG.md
@@ -2,6 +2,42 @@
|
|||||||
|
|
||||||
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.2.4] - 27.11.2024
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
|
||||||
|
- More fixes for .sclr
|
||||||
|
- `.iamn` fixed
|
||||||
|
|
||||||
|
## [5.2.3] - 27.11.2024
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
|
||||||
|
- `.iam` Fixed
|
||||||
|
- `.sclr` will now properly change color on many commands it didn't work previously
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- `.rps` now also has bet amount in the result, like other gambling commands
|
||||||
|
|
||||||
|
## [5.2.2] - 27.11.2024
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Button roles are now non-exclusive by default
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed sar migration, again (this time correctly)
|
||||||
|
- Fixed `.sclr` not updating unless bot is restarted, the changes should be immediate now for warn and error
|
||||||
|
- Fixed group buttons exclusivity message always saying groups are exclusive
|
||||||
|
|
||||||
|
## [5.2.1] - 26.11.2024
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed old self assigned missing
|
||||||
|
|
||||||
## [5.2.0] - 26.11.2024
|
## [5.2.0] - 26.11.2024
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@@ -21,17 +21,14 @@ public static class MigrationQueries
|
|||||||
INNER JOIN GuildConfigs as GC ON GN.GuildConfigId = GC.Id;
|
INNER JOIN GuildConfigs as GC ON GN.GuildConfigId = GC.Id;
|
||||||
|
|
||||||
INSERT INTO Sar (GuildId, RoleId, SarGroupId, LevelReq)
|
INSERT INTO Sar (GuildId, RoleId, SarGroupId, LevelReq)
|
||||||
SELECT SAR.GuildId, SAR.RoleId, SG2.Id, MIN(SAR.LevelRequirement)
|
SELECT SAR.GuildId, SAR.RoleId, (SELECT Id FROM SarGroup WHERE SG.Number = SarGroup.GroupNumber AND SG.GuildId = SarGroup.GuildId), MIN(SAR.LevelRequirement)
|
||||||
FROM SelfAssignableRoles as SAR
|
FROM SelfAssignableRoles as SAR
|
||||||
INNER JOIN (SELECT GuildId FROM GroupName as gn
|
INNER JOIN (SELECT GuildId, gn.Number FROM GroupName as gn
|
||||||
INNER JOIN GuildConfigs as gc ON gn.GuildConfigId =gc.Id
|
INNER JOIN GuildConfigs as gc ON gn.GuildConfigId =gc.Id
|
||||||
) as SG
|
) as SG
|
||||||
ON SG.GuildId = SAR.GuildId
|
ON SG.GuildId = SAR.GuildId
|
||||||
INNER JOIN (SELECT gn.Id, Number FROM GroupName as gn
|
WHERE SG.Number IN (SELECT GroupNumber FROM SarGroup WHERE Sar.GuildId = SarGroup.GuildId)
|
||||||
INNER JOIN GuildConfigs as gc ON gn.GuildConfigId =gc.Id
|
GROUP BY SAR.GuildId, SAR.RoleId;
|
||||||
) as SG2
|
|
||||||
ON SG2.Number = SAR."Group"
|
|
||||||
GROUP BY SAR.GuildId, SAR.RoleId;
|
|
||||||
|
|
||||||
INSERT INTO SarAutoDelete (GuildId, IsEnabled)
|
INSERT INTO SarAutoDelete (GuildId, IsEnabled)
|
||||||
SELECT GuildId, AutoDeleteSelfAssignedRoleMessages FROM GuildConfigs WHERE AutoDeleteSelfAssignedRoleMessages = TRUE;
|
SELECT GuildId, AutoDeleteSelfAssignedRoleMessages FROM GuildConfigs WHERE AutoDeleteSelfAssignedRoleMessages = TRUE;
|
||||||
|
@@ -283,7 +283,13 @@ public partial class Administration
|
|||||||
{
|
{
|
||||||
var res = await _service.SetExclusiveButtonRoles(ctx.Guild.Id, messageId, exclusive.Value);
|
var res = await _service.SetExclusiveButtonRoles(ctx.Guild.Id, messageId, exclusive.Value);
|
||||||
|
|
||||||
if (res)
|
if (!res)
|
||||||
|
{
|
||||||
|
await Response().Error(strs.btnrole_not_found).SendAsync();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exclusive.Value)
|
||||||
{
|
{
|
||||||
await Response().Confirm(strs.btnrole_exclusive).SendAsync();
|
await Response().Confirm(strs.btnrole_exclusive).SendAsync();
|
||||||
}
|
}
|
||||||
|
@@ -126,7 +126,11 @@ public sealed class ButtonRolesService : INService, IReadyExecutor
|
|||||||
Emote = emoteStr,
|
Emote = emoteStr,
|
||||||
Label = string.Empty,
|
Label = string.Empty,
|
||||||
ButtonId = $"{BTN_PREFIX}:{guildId}:{guid}",
|
ButtonId = $"{BTN_PREFIX}:{guildId}:{guid}",
|
||||||
Exclusive = (uow.GetTable<ButtonRole>().Where(x => x.GuildId == guildId && x.MessageId == messageId).All(x => x.Exclusive))
|
Exclusive = uow.GetTable<ButtonRole>()
|
||||||
|
.Any(x => x.GuildId == guildId && x.MessageId == messageId)
|
||||||
|
&& uow.GetTable<ButtonRole>()
|
||||||
|
.Where(x => x.GuildId == guildId && x.MessageId == messageId)
|
||||||
|
.All(x => x.Exclusive)
|
||||||
},
|
},
|
||||||
_ => new()
|
_ => new()
|
||||||
{
|
{
|
||||||
@@ -178,7 +182,6 @@ public sealed class ButtonRolesService : INService, IReadyExecutor
|
|||||||
.UpdateAsync((_) => new()
|
.UpdateAsync((_) => new()
|
||||||
{
|
{
|
||||||
Exclusive = exclusive
|
Exclusive = exclusive
|
||||||
})
|
}) > 0;
|
||||||
> 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -21,7 +21,7 @@ public partial class Administration
|
|||||||
{
|
{
|
||||||
var guildUser = (IGuildUser)ctx.User;
|
var guildUser = (IGuildUser)ctx.User;
|
||||||
|
|
||||||
var group = await _service.GetRoleGroup(ctx.User.Id, role.Id);
|
var group = await _service.GetRoleGroup(ctx.Guild.Id, role.Id);
|
||||||
|
|
||||||
IUserMessage msg = null;
|
IUserMessage msg = null;
|
||||||
try
|
try
|
||||||
@@ -84,13 +84,13 @@ public partial class Administration
|
|||||||
IUserMessage msg = null;
|
IUserMessage msg = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (guildUser.RoleIds.Contains(role.Id))
|
if (!guildUser.RoleIds.Contains(role.Id))
|
||||||
{
|
{
|
||||||
msg = await Response().Error(strs.self_assign_not_have(Format.Bold(role.Name))).SendAsync();
|
msg = await Response().Error(strs.self_assign_not_have(Format.Bold(role.Name))).SendAsync();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var group = await _service.GetRoleGroup(role.Guild.Id, role.Id);
|
var group = await _service.GetRoleGroup(ctx.Guild.Id, role.Id);
|
||||||
|
|
||||||
if (group is null || group.Roles.All(x => x.RoleId != role.Id))
|
if (group is null || group.Roles.All(x => x.RoleId != role.Id))
|
||||||
{
|
{
|
||||||
|
@@ -390,7 +390,7 @@ public partial class Gambling : GamblingModule<GamblingService>
|
|||||||
[Priority(0)]
|
[Priority(0)]
|
||||||
public Task CurrencyTransactions([Leftover] IUser usr)
|
public Task CurrencyTransactions([Leftover] IUser usr)
|
||||||
=> InternalCurrencyTransactions(usr.Id, 1);
|
=> InternalCurrencyTransactions(usr.Id, 1);
|
||||||
|
|
||||||
[Cmd]
|
[Cmd]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
[Priority(-1)]
|
[Priority(-1)]
|
||||||
@@ -872,9 +872,6 @@ public partial class Gambling : GamblingModule<GamblingService>
|
|||||||
}
|
}
|
||||||
else if (result.Result == RpsResultType.Win)
|
else if (result.Result == RpsResultType.Win)
|
||||||
{
|
{
|
||||||
if ((long)result.Won > 0)
|
|
||||||
embed.AddField(GetText(strs.won), N((long)result.Won));
|
|
||||||
|
|
||||||
msg = GetText(strs.rps_win(ctx.User.Mention,
|
msg = GetText(strs.rps_win(ctx.User.Mention,
|
||||||
GetRpsPick(pick),
|
GetRpsPick(pick),
|
||||||
GetRpsPick((InputRpsPick)result.ComputerPick)));
|
GetRpsPick((InputRpsPick)result.ComputerPick)));
|
||||||
@@ -890,6 +887,13 @@ public partial class Gambling : GamblingModule<GamblingService>
|
|||||||
.WithOkColor()
|
.WithOkColor()
|
||||||
.WithDescription(msg);
|
.WithDescription(msg);
|
||||||
|
|
||||||
|
if (amount > 0)
|
||||||
|
{
|
||||||
|
embed
|
||||||
|
.AddField(GetText(strs.bet), N(amount), true)
|
||||||
|
.AddField(GetText(strs.won), $"{N((long)result.Won)}", true);
|
||||||
|
}
|
||||||
|
|
||||||
await Response().Embed(embed).SendAsync();
|
await Response().Embed(embed).SendAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@ public partial class Utility
|
|||||||
}
|
}
|
||||||
|
|
||||||
private string GetCommandString(NadekoCommandCallModel res)
|
private string GetCommandString(NadekoCommandCallModel res)
|
||||||
=> $"{_bcs.Data.Prefix}{res.Name} {res.Arguments.Select((x, i) => GetParamString(x, i + 1 == res.Arguments.Count)).Join(" ")}";
|
=> $"{prefix}{res.Name} {res.Arguments.Select((x, i) => GetParamString(x, i + 1 == res.Arguments.Count)).Join(" ")}";
|
||||||
|
|
||||||
private static string GetParamString(string val, bool isLast)
|
private static string GetParamString(string val, bool isLast)
|
||||||
=> isLast ? val : "\"" + val + "\"";
|
=> isLast ? val : "\"" + val + "\"";
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>true</ImplicitUsings>
|
<ImplicitUsings>true</ImplicitUsings>
|
||||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||||
<Version>5.2.1</Version>
|
<Version>5.2.4</Version>
|
||||||
|
|
||||||
<!-- Output/build -->
|
<!-- Output/build -->
|
||||||
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
|
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
|
||||||
|
@@ -19,7 +19,6 @@ public abstract class NadekoModule : ModuleBase
|
|||||||
public INadekoInteractionService _inter { get; set; }
|
public INadekoInteractionService _inter { get; set; }
|
||||||
public IReplacementService repSvc { get; set; }
|
public IReplacementService repSvc { get; set; }
|
||||||
public IMessageSenderService _sender { get; set; }
|
public IMessageSenderService _sender { get; set; }
|
||||||
public BotConfigService _bcs { get; set; }
|
|
||||||
|
|
||||||
protected string prefix
|
protected string prefix
|
||||||
=> _cmdHandler.GetPrefix(ctx.Guild);
|
=> _cmdHandler.GetPrefix(ctx.Guild);
|
||||||
@@ -31,7 +30,7 @@ public abstract class NadekoModule : ModuleBase
|
|||||||
=> _sender.CreateEmbed(ctx.Guild?.Id);
|
=> _sender.CreateEmbed(ctx.Guild?.Id);
|
||||||
|
|
||||||
public ResponseBuilder Response()
|
public ResponseBuilder Response()
|
||||||
=> new ResponseBuilder(Strings, _bcs, (DiscordSocketClient)ctx.Client)
|
=> new ResponseBuilder(Strings, _sender, (DiscordSocketClient)ctx.Client)
|
||||||
.Context(ctx);
|
.Context(ctx);
|
||||||
|
|
||||||
protected override void BeforeExecute(CommandInfo command)
|
protected override void BeforeExecute(CommandInfo command)
|
||||||
|
@@ -9,31 +9,31 @@ public sealed class MessageSenderService : IMessageSenderService, INService
|
|||||||
|
|
||||||
public MessageSenderService(
|
public MessageSenderService(
|
||||||
IBotStrings bs,
|
IBotStrings bs,
|
||||||
BotConfigService bcs,
|
|
||||||
DiscordSocketClient client,
|
DiscordSocketClient client,
|
||||||
IGuildColorsService gcs)
|
IGuildColorsService gcs,
|
||||||
|
BotConfigService bcs)
|
||||||
{
|
{
|
||||||
_bs = bs;
|
_bs = bs;
|
||||||
_bcs = bcs;
|
|
||||||
_client = client;
|
_client = client;
|
||||||
_gcs = gcs;
|
_gcs = gcs;
|
||||||
|
_bcs = bcs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ResponseBuilder Response(IMessageChannel channel)
|
public ResponseBuilder Response(IMessageChannel channel)
|
||||||
=> new ResponseBuilder(_bs, _bcs, _client)
|
=> new ResponseBuilder(_bs, this, _client)
|
||||||
.Channel(channel);
|
.Channel(channel);
|
||||||
|
|
||||||
public ResponseBuilder Response(ICommandContext ctx)
|
public ResponseBuilder Response(ICommandContext ctx)
|
||||||
=> new ResponseBuilder(_bs, _bcs, _client)
|
=> new ResponseBuilder(_bs, this, _client)
|
||||||
.Context(ctx);
|
.Context(ctx);
|
||||||
|
|
||||||
public ResponseBuilder Response(IUser user)
|
public ResponseBuilder Response(IUser user)
|
||||||
=> new ResponseBuilder(_bs, _bcs, _client)
|
=> new ResponseBuilder(_bs, this, _client)
|
||||||
.User(user);
|
.User(user);
|
||||||
|
|
||||||
public ResponseBuilder Response(SocketMessageComponent smc)
|
public ResponseBuilder Response(SocketMessageComponent smc)
|
||||||
=> new ResponseBuilder(_bs, _bcs, _client)
|
=> new ResponseBuilder(_bs, this, _client)
|
||||||
.Channel(smc.Channel);
|
.Channel(smc.Channel);
|
||||||
|
|
||||||
public NadekoEmbedBuilder CreateEmbed(ulong? guildId = null)
|
public NadekoEmbedBuilder CreateEmbed(ulong? guildId = null)
|
||||||
|
@@ -6,16 +6,17 @@ public sealed partial class ResponseBuilder
|
|||||||
{
|
{
|
||||||
private ICommandContext? ctx;
|
private ICommandContext? ctx;
|
||||||
private IMessageChannel? channel;
|
private IMessageChannel? channel;
|
||||||
|
private IUser? user;
|
||||||
|
private IUserMessage? msg;
|
||||||
|
|
||||||
private string? plainText;
|
private string? plainText;
|
||||||
private IReadOnlyCollection<EmbedBuilder>? embeds;
|
private IReadOnlyCollection<EmbedBuilder>? embeds;
|
||||||
private IUserMessage? msg;
|
|
||||||
private IUser? user;
|
|
||||||
private bool sanitizeMentions = true;
|
private bool sanitizeMentions = true;
|
||||||
private LocStr? locTxt;
|
private LocStr? locTxt;
|
||||||
private object[] locParams = [];
|
private object[] locParams = [];
|
||||||
private bool shouldReply = true;
|
private bool shouldReply = true;
|
||||||
private readonly IBotStrings _bs;
|
private readonly IBotStrings _bs;
|
||||||
private readonly BotConfigService _bcs;
|
private readonly IMessageSenderService _sender;
|
||||||
private EmbedBuilder? embedBuilder;
|
private EmbedBuilder? embedBuilder;
|
||||||
private NadekoInteractionBase? inter;
|
private NadekoInteractionBase? inter;
|
||||||
private Stream? fileStream;
|
private Stream? fileStream;
|
||||||
@@ -25,10 +26,10 @@ public sealed partial class ResponseBuilder
|
|||||||
|
|
||||||
public DiscordSocketClient Client { get; set; }
|
public DiscordSocketClient Client { get; set; }
|
||||||
|
|
||||||
public ResponseBuilder(IBotStrings bs, BotConfigService bcs, DiscordSocketClient client)
|
public ResponseBuilder(IBotStrings bs, IMessageSenderService sender, DiscordSocketClient client)
|
||||||
{
|
{
|
||||||
_bs = bs;
|
_bs = bs;
|
||||||
_bcs = bcs;
|
_sender = sender;
|
||||||
Client = client;
|
Client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,7 +198,7 @@ public sealed partial class ResponseBuilder
|
|||||||
string? url = null,
|
string? url = null,
|
||||||
string? footer = null)
|
string? footer = null)
|
||||||
{
|
{
|
||||||
var eb = new NadekoEmbedBuilder(_bcs)
|
var eb = _sender.CreateEmbed(ctx?.Guild?.Id ?? (channel as ITextChannel)?.GuildId ?? (user as IGuildUser)?.GuildId)
|
||||||
.WithDescription(text);
|
.WithDescription(text);
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(title))
|
if (!string.IsNullOrWhiteSpace(title))
|
||||||
|
@@ -75,6 +75,14 @@ public sealed class GuildColorsService : IReadyExecutor, IGuildColorsService, IN
|
|||||||
{
|
{
|
||||||
GuildId = guildId
|
GuildId = guildId
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!_colors.TryAdd(guildId, new Colors(null, null, color?.ToDiscordColor())))
|
||||||
|
{
|
||||||
|
_colors[guildId] = _colors[guildId] with
|
||||||
|
{
|
||||||
|
Error = color?.ToDiscordColor()
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SetPendingColor(ulong guildId, Rgba32? color)
|
public async Task SetPendingColor(ulong guildId, Rgba32? color)
|
||||||
@@ -95,6 +103,14 @@ public sealed class GuildColorsService : IReadyExecutor, IGuildColorsService, IN
|
|||||||
{
|
{
|
||||||
GuildId = guildId
|
GuildId = guildId
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!_colors.TryAdd(guildId, new Colors(null, color?.ToDiscordColor(), null)))
|
||||||
|
{
|
||||||
|
_colors[guildId] = _colors[guildId] with
|
||||||
|
{
|
||||||
|
Pending = color?.ToDiscordColor()
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task OnReadyAsync()
|
public async Task OnReadyAsync()
|
||||||
@@ -110,8 +126,8 @@ public sealed class GuildColorsService : IReadyExecutor, IGuildColorsService, IN
|
|||||||
{
|
{
|
||||||
var colors = new Colors(
|
var colors = new Colors(
|
||||||
ConvertColor(color.OkColor),
|
ConvertColor(color.OkColor),
|
||||||
ConvertColor(color.ErrorColor),
|
ConvertColor(color.PendingColor),
|
||||||
ConvertColor(color.PendingColor));
|
ConvertColor(color.ErrorColor));
|
||||||
|
|
||||||
_colors.TryAdd(color.GuildId, colors);
|
_colors.TryAdd(color.GuildId, colors);
|
||||||
}
|
}
|
||||||
|
@@ -9,7 +9,7 @@ public static class SocketMessageComponentExtensions
|
|||||||
MsgType type,
|
MsgType type,
|
||||||
bool ephemeral = false)
|
bool ephemeral = false)
|
||||||
{
|
{
|
||||||
var embed = sender.CreateEmbed().WithDescription(text);
|
var embed = sender.CreateEmbed(ch.GuildId).WithDescription(text);
|
||||||
|
|
||||||
embed = (type switch
|
embed = (type switch
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user