Compare commits

...

9 Commits
5.3.0 ... 5.3.1

11 changed files with 194 additions and 37 deletions

View File

@@ -2,7 +2,7 @@
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.3.0] - 07.12.2024 ## [5.3.0] - 10.12.2024
## Added ## Added
@@ -35,10 +35,12 @@ Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except da
- `.sclr show` will now show hex code of the current color - `.sclr show` will now show hex code of the current color
- Queueing a song will now restart the playback if the queue is on the last track and stopped (there were no more tracks - Queueing a song will now restart the playback if the queue is on the last track and stopped (there were no more tracks
to play) to play)
- `.translate` will now use 2 embeds instead of 1
## Fixed ## Fixed
- .setstream and .setactivity will now pause .ropl (rotating statuses) - .setstream and .setactivity will now pause .ropl (rotating statuses)
- Fixed `.sar ex` help description
## Removed ## Removed

View File

@@ -71,7 +71,7 @@ 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(pruneDays: 1); await user.BanAsync(pruneDays: 1, reason: "Honeypot");
await user.Guild.RemoveBanAsync(user.Id); await user.Guild.RemoveBanAsync(user.Id);
} }
catch (Exception e) catch (Exception e)

View File

@@ -149,7 +149,10 @@ public partial class Gambling
?? (await _userService.GetUserAsync(x.UserId))?.Username ?? (await _userService.GetUserAsync(x.UserId))?.Username
?? x.UserId.ToString(); ?? x.UserId.ToString();
outputItems.Add(new WinLbStat(i + 1 + (page * 10), user, x.Game, x.MaxWin)); if (user.StartsWith("??"))
user = x.UserId.ToString();
outputItems.Add(new WinLbStat(i + 1 + (page * 9), user, x.Game, x.MaxWin));
} }
return outputItems; return outputItems;
@@ -166,11 +169,12 @@ public partial class Gambling
await Response() await Response()
.Paginated() .Paginated()
.PageItems(p => GetCachedWinLbAsync(p)) .PageItems(p => GetCachedWinLbAsync(p))
.PageSize(10) .PageSize(9)
.Page((items, curPage) => .Page((items, curPage) =>
{ {
var eb = CreateEmbed() var eb = CreateEmbed()
.WithOkColor(); .WithTitle(GetText(strs.winlb))
.WithOkColor();
if (items.Count == 0) if (items.Count == 0)
{ {
@@ -182,7 +186,8 @@ public partial class Gambling
{ {
var item = items[i]; var item = items[i];
eb.AddField($"#{item.Rank} {item.User}", eb.AddField($"#{item.Rank} {item.User}",
$"{N(item.MaxWin)}\n`{item.Game.ToString().ToLower()}`"); $"{N(item.MaxWin)}\n`{item.Game.ToString().ToLower()}`",
true);
} }
return eb; return eb;

View File

@@ -135,7 +135,6 @@ public partial class Gambling : GamblingModule<GamblingService>
}); });
[Cmd] [Cmd]
[RequireContext(ContextType.Guild)]
public async Task Timely() public async Task Timely()
{ {
var val = Config.Timely.Amount; var val = Config.Timely.Amount;

View File

@@ -60,8 +60,8 @@ public sealed class UserBetStatsService : INService
await using var ctx = _db.GetDbContext(); await using var ctx = _db.GetDbContext();
return await ctx.GetTable<UserBetStats>() return await ctx.GetTable<UserBetStats>()
.OrderByDescending(x => x.MaxWin) .OrderByDescending(x => x.MaxWin)
.Skip(page * 10) .Skip(page * 9)
.Take(10) .Take(9)
.ToArrayAsyncLinqToDB(); .ToArrayAsyncLinqToDB();
} }
} }

View File

@@ -92,13 +92,13 @@ public class GlobalPermissionService : IExecPreCommand, INService
{ {
if (priv) if (priv)
{ {
if (bs.Blocked.Commands.Add(commandName)) if (bs.DmBlocked.Commands.Add(commandName))
{ {
added = true; added = true;
} }
else else
{ {
bs.Blocked.Commands.Remove(commandName); bs.DmBlocked.Commands.Remove(commandName);
added = false; added = false;
} }

View File

@@ -417,15 +417,24 @@ public partial class Searches : NadekoModule<SearchesService>
{ {
usr ??= (IGuildUser)ctx.User; usr ??= (IGuildUser)ctx.User;
var bannerUrl = usr.GetGuildBannerUrl(); var bannerUrl = usr.GetGuildBannerUrl(size: 2048);
if (bannerUrl is null)
{
await Response()
.Error(strs.no_banner)
.SendAsync();
return;
}
await Response() await Response()
.Embed( .Embed(
CreateEmbed() CreateEmbed()
.WithOkColor() .WithOkColor()
.AddField("Username", usr.ToString()) .AddField("Username", usr.ToString(), true)
.AddField("Banner Url", bannerUrl) .AddField("Banner Url", bannerUrl, true)
.WithThumbnailUrl(bannerUrl)) .WithImageUrl(bannerUrl))
.SendAsync(); .SendAsync();
} }

View File

@@ -13,9 +13,9 @@ public partial class Utility
public async Task ServerColorsShow() public async Task ServerColorsShow()
{ {
var colors = _service.GetColors(ctx.Guild.Id); var colors = _service.GetColors(ctx.Guild.Id);
var okHex = colors?.Ok?.RawValue.ToString("X8"); var okHex = colors?.Ok?.RawValue.ToString("x6");
var warnHex = colors?.Warn?.RawValue.ToString("X8"); var warnHex = colors?.Warn?.RawValue.ToString("x6");
var errHex = colors?.Error?.RawValue.ToString("X8"); var errHex = colors?.Error?.RawValue.ToString("x6");
EmbedBuilder[] ebs = EmbedBuilder[] ebs =
[ [
CreateEmbed() CreateEmbed()

View File

@@ -186,7 +186,7 @@ public partial class Utility : NadekoModule
return CreateEmbed() return CreateEmbed()
.WithOkColor() .WithOkColor()
.WithTitle(GetText(strs.inrole_list(roleName, roleUsers.Count))) .WithTitle(GetText(strs.inrole_list(role?.GetIconUrl() + roleName, roleUsers.Count)))
.WithDescription(string.Join("\n", pageUsers)); .WithDescription(string.Join("\n", pageUsers));
}) })
.SendAsync(); .SendAsync();

View File

@@ -961,6 +961,56 @@
"MuteMembers Server Permission" "MuteMembers Server Permission"
] ]
}, },
{
"Aliases": [
".notify",
".nfy"
],
"Description": "Sends a message to the current channel once the specified event occurs.\nProvide no parameters to see all available events.",
"Usage": [
".notify levelup Congratulations to user %user.name% for reaching level %event.level%"
],
"Submodule": "NotifyCommands",
"Module": "Administration",
"Options": null,
"Requirements": [
"Bot Owner Only"
]
},
{
"Aliases": [
".notifylist",
".notifyl"
],
"Description": "Lists all active notifications in this server.",
"Usage": [
".notifylist"
],
"Submodule": "NotifyCommands",
"Module": "Administration",
"Options": null,
"Requirements": [
"Bot Owner Only"
]
},
{
"Aliases": [
".notifyclear",
".notifyremove",
".notifyrm",
".notifclr"
],
"Description": "Removes the specified notify event.",
"Usage": [
".notifyclear levelup"
],
"Submodule": "NotifyCommands",
"Module": "Administration",
"Options": null,
"Requirements": [
"Bot Owner Only"
]
},
{ {
"Aliases": [ "Aliases": [
".dpo" ".dpo"
@@ -1523,6 +1573,22 @@
"Administrator Server Permission" "Administrator Server Permission"
] ]
}, },
{
"Aliases": [
".temprole"
],
"Description": "Grants a user a temporary role for the specified number of time.\nThe role must exist and be lower in the role hierarchy than your highest role.",
"Usage": [
".temprole 15m @User Jail",
".temprole 7d @Newbie Trial Member"
],
"Submodule": "RoleCommands",
"Module": "Administration",
"Options": null,
"Requirements": [
"Administrator Server Permission"
]
},
{ {
"Aliases": [ "Aliases": [
".iam" ".iam"
@@ -1648,9 +1714,9 @@
".sar excl", ".sar excl",
".sar tesar" ".sar tesar"
], ],
"Description": "Toggles whether self-assigned roles are exclusive. While enabled, users can only have one self-assignable role per group.", "Description": "Toggles the sar group as exclusive.\nWhile enabled, users can only have one self-assignable role from that group.",
"Usage": [ "Usage": [
".sar exclusive" ".sar exclusive 1"
], ],
"Submodule": "sar", "Submodule": "sar",
"Module": "Administration", "Module": "Administration",
@@ -3274,6 +3340,21 @@
"Options": null, "Options": null,
"Requirements": [] "Requirements": []
}, },
{
"Aliases": [
".winlb",
".wins"
],
"Description": "Shows the biggest wins leaderboard",
"Usage": [
".winlb",
".winlb 5"
],
"Submodule": "BetStatsCommands",
"Module": "Gambling",
"Options": null,
"Requirements": []
},
{ {
"Aliases": [ "Aliases": [
".gamblestats", ".gamblestats",
@@ -3915,6 +3996,20 @@
"Options": null, "Options": null,
"Requirements": [] "Requirements": []
}, },
{
"Aliases": [
".minesweeper",
".mw"
],
"Description": "Creates a spoiler-based minesweeper mini game.\nYou may specify the number of mines.",
"Usage": [
".minesweeper 15"
],
"Submodule": "Games",
"Module": "Games",
"Options": null,
"Requirements": []
},
{ {
"Aliases": [ "Aliases": [
".acrophobia", ".acrophobia",
@@ -5522,6 +5617,38 @@
"Bot Owner Only" "Bot Owner Only"
] ]
}, },
{
"Aliases": [
".dmmodule",
".dmmod"
],
"Description": "Toggles whether a module can be used in DMs.",
"Usage": [
".dmmodule Gambling"
],
"Submodule": "GlobalPermissionCommands",
"Module": "Permissions",
"Options": null,
"Requirements": [
"Bot Owner Only"
]
},
{
"Aliases": [
".dmcommand",
".dmcmd"
],
"Description": "Toggles whether a command can be used in DMs.",
"Usage": [
".dmcommand .stats"
],
"Submodule": "GlobalPermissionCommands",
"Module": "Permissions",
"Options": null,
"Requirements": [
"Bot Owner Only"
]
},
{ {
"Aliases": [ "Aliases": [
".resetperms" ".resetperms"
@@ -5791,6 +5918,19 @@
"Options": null, "Options": null,
"Requirements": [] "Requirements": []
}, },
{
"Aliases": [
".banner"
],
"Description": "Shows a mentioned person's banner.",
"Usage": [
".banner @Someone"
],
"Submodule": "Searches",
"Module": "Searches",
"Options": null,
"Requirements": []
},
{ {
"Aliases": [ "Aliases": [
".wikia", ".wikia",
@@ -7778,21 +7918,6 @@
"Options": null, "Options": null,
"Requirements": [] "Requirements": []
}, },
{
"Aliases": [
".xpnotify",
".xpn"
],
"Description": "Sets how the bot should notify you when you get a `server` or `global` level. This is a personal setting and affects only how you receive Global or Server level-up notifications. You can set `dm` (for the bot to send you a direct message), `channel` (to get notified in the channel you sent the last message in) or `none` to disable.",
"Usage": [
".xpnotify global dm",
".xpnotify server channel"
],
"Submodule": "Xp",
"Module": "Xp",
"Options": null,
"Requirements": []
},
{ {
"Aliases": [ "Aliases": [
".xpexclude", ".xpexclude",
@@ -7854,6 +7979,21 @@
"Options": null, "Options": null,
"Requirements": [] "Requirements": []
}, },
{
"Aliases": [
".xplevelset"
],
"Description": "Sets the level of the user you specify.",
"Usage": [
".xplevelset 10 @User"
],
"Submodule": "Xp",
"Module": "Xp",
"Options": null,
"Requirements": [
"Administrator Server Permission"
]
},
{ {
"Aliases": [ "Aliases": [
".xpadd" ".xpadd"

View File

@@ -1157,5 +1157,7 @@
"notify_desc_protection": "Triggers when antialt, antispam or antiraid is triggered.", "notify_desc_protection": "Triggers when antialt, antispam or antiraid is triggered.",
"notify_desc_addrolerew": "Triggers when a user gets a role as a reward for reaching a level (xprew).", "notify_desc_addrolerew": "Triggers when a user gets a role as a reward for reaching a level (xprew).",
"notify_desc_removerolerew": "Triggers when a user loses a role as a reward for reaching a level (xprew).", "notify_desc_removerolerew": "Triggers when a user loses a role as a reward for reaching a level (xprew).",
"notify_desc_not_found": "No description found for this notify event. Please report this." "notify_desc_not_found": "No description found for this notify event. Please report this.",
"winlb": "Biggest Wins Leaderboard",
"no_banner": "No banner set."
} }