mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 17:28:27 -04:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
40f1774655 | ||
|
fddd0f2340 | ||
|
86f9d901fe | ||
|
eaab60898f |
16
CHANGELOG.md
16
CHANGELOG.md
@@ -2,6 +2,22 @@
|
||||
|
||||
Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o
|
||||
|
||||
## [5.3.8] - 27.01.2025
|
||||
|
||||
## Fixed
|
||||
|
||||
- `.temprole` now correctly adds a role
|
||||
- `.h temprole` also shows the correct overload now
|
||||
|
||||
## [5.3.7] - 21.01.2025
|
||||
|
||||
## Changed
|
||||
|
||||
- You can now run `.prune` in DMs
|
||||
- It deletes only bot messages
|
||||
- You can't specify a number of messages to delete (100 default)
|
||||
- Updated command list
|
||||
|
||||
## [5.3.6] - 20.01.2025
|
||||
|
||||
## Added
|
||||
|
@@ -32,6 +32,25 @@ public partial class Administration
|
||||
}
|
||||
}
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.DM)]
|
||||
[NadekoOptions<PruneOptions>]
|
||||
public async Task Prune()
|
||||
{
|
||||
var progressMsg = await Response().Pending(strs.prune_progress(0, 100)).SendAsync();
|
||||
var progress = GetProgressTracker(progressMsg);
|
||||
|
||||
var result = await _service.PruneWhere(ctx.Channel,
|
||||
100,
|
||||
x => x.Author.Id == ctx.Client.CurrentUser.Id,
|
||||
progress);
|
||||
|
||||
ctx.Message.DeleteAfter(3);
|
||||
|
||||
await SendResult(result);
|
||||
await progressMsg.DeleteAsync();
|
||||
}
|
||||
|
||||
//deletes her own messages, no perm required
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
@@ -114,9 +133,9 @@ public partial class Administration
|
||||
await progressMsg.ModifyAsync(props =>
|
||||
{
|
||||
props.Embed = CreateEmbed()
|
||||
.WithPendingColor()
|
||||
.WithDescription(GetText(strs.prune_progress(deleted, total)))
|
||||
.Build();
|
||||
.WithPendingColor()
|
||||
.WithDescription(GetText(strs.prune_progress(deleted, total)))
|
||||
.Build();
|
||||
});
|
||||
}
|
||||
catch
|
||||
|
@@ -18,7 +18,7 @@ public class PruneService : INService
|
||||
}
|
||||
|
||||
public async Task<PruneResult> PruneWhere(
|
||||
ITextChannel channel,
|
||||
IMessageChannel channel,
|
||||
int amount,
|
||||
Func<IMessage, bool> predicate,
|
||||
IProgress<(int deleted, int total)> progress,
|
||||
@@ -30,13 +30,14 @@ public class PruneService : INService
|
||||
|
||||
var originalAmount = amount;
|
||||
|
||||
var gid = (channel as ITextChannel)?.GuildId ?? channel.Id;
|
||||
using var cancelSource = new CancellationTokenSource();
|
||||
if (!_pruningGuilds.TryAdd(channel.GuildId, cancelSource))
|
||||
if (!_pruningGuilds.TryAdd(gid, cancelSource))
|
||||
return PruneResult.AlreadyRunning;
|
||||
|
||||
try
|
||||
{
|
||||
if (!await _ps.LimitHitAsync(LimitedFeatureName.Prune, channel.Guild.OwnerId))
|
||||
if (channel is ITextChannel tc && !await _ps.LimitHitAsync(LimitedFeatureName.Prune, tc.Guild.OwnerId))
|
||||
{
|
||||
return PruneResult.FeatureLimit;
|
||||
}
|
||||
@@ -74,9 +75,9 @@ public class PruneService : INService
|
||||
singleDeletable.Add(x);
|
||||
}
|
||||
|
||||
if (bulkDeletable.Count > 0)
|
||||
if (channel is ITextChannel tc2 && bulkDeletable.Count > 0)
|
||||
{
|
||||
await channel.DeleteMessagesAsync(bulkDeletable);
|
||||
await tc2.DeleteMessagesAsync(bulkDeletable);
|
||||
amount -= msgs.Length;
|
||||
progress.Report((originalAmount - amount, originalAmount));
|
||||
await Task.Delay(2000, cancelSource.Token);
|
||||
@@ -97,7 +98,7 @@ public class PruneService : INService
|
||||
}
|
||||
finally
|
||||
{
|
||||
_pruningGuilds.TryRemove(channel.GuildId, out _);
|
||||
_pruningGuilds.TryRemove(gid, out _);
|
||||
}
|
||||
|
||||
return PruneResult.Success;
|
||||
|
@@ -221,7 +221,7 @@ public partial class Administration
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
public async Task TempRole(ParsedTimespan timespan, IUser user, [Leftover] IRole role)
|
||||
public async Task TempRole(ParsedTimespan timespan, IGuildUser user, [Leftover] IRole role)
|
||||
{
|
||||
if (!await CheckRoleHierarchy(role))
|
||||
{
|
||||
@@ -231,6 +231,7 @@ public partial class Administration
|
||||
return;
|
||||
}
|
||||
|
||||
await user.AddRoleAsync(role);
|
||||
await _tempRoleService.AddTempRoleAsync(ctx.Guild.Id, role.Id, user.Id, timespan.Time);
|
||||
|
||||
|
||||
|
@@ -170,7 +170,7 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
#if GLOBAL_NADEKO
|
||||
if (_rng.Next(0, 5) == 0)
|
||||
toSend = toSend
|
||||
.Confirm("[Sub on Patreon](https://patreon.com/nadekobot) to remove captcha.")
|
||||
.Confirm("[Sub on Patreon](https://patreon.com/nadekobot) to remove captcha.");
|
||||
#endif
|
||||
|
||||
var captchaMessage = await toSend.SendAsync();
|
||||
|
@@ -35,7 +35,7 @@ public partial class Games
|
||||
#if GLOBAL_NADEKO
|
||||
if (_rng.Next(0, 5) == 0)
|
||||
toSend = toSend
|
||||
.Confirm("[Sub on Patreon](https://patreon.com/nadekobot) to remove captcha.")
|
||||
.Confirm("[Sub on Patreon](https://patreon.com/nadekobot) to remove captcha.");
|
||||
#endif
|
||||
var captcha = await toSend.SendAsync();
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>true</ImplicitUsings>
|
||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||
<Version>5.3.6</Version>
|
||||
<Version>5.3.8</Version>
|
||||
|
||||
<!-- Output/build -->
|
||||
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
|
||||
|
@@ -974,7 +974,7 @@
|
||||
"Module": "Administration",
|
||||
"Options": null,
|
||||
"Requirements": [
|
||||
"Bot Owner Only"
|
||||
"Administrator Server Permission"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -990,7 +990,7 @@
|
||||
"Module": "Administration",
|
||||
"Options": null,
|
||||
"Requirements": [
|
||||
"Bot Owner Only"
|
||||
"Administrator Server Permission"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1008,7 +1008,7 @@
|
||||
"Module": "Administration",
|
||||
"Options": null,
|
||||
"Requirements": [
|
||||
"Bot Owner Only"
|
||||
"Administrator Server Permission"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -4045,6 +4045,51 @@
|
||||
"ManageMessages Server Permission"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Aliases": [
|
||||
".fish",
|
||||
".fi"
|
||||
],
|
||||
"Description": "Attempt to catch a fish.\nDifferent fish live in different places, at different times of day and in different weather.",
|
||||
"Usage": [
|
||||
".fish"
|
||||
],
|
||||
"Submodule": "FishCommands",
|
||||
"Module": "Games",
|
||||
"Options": null,
|
||||
"Requirements": []
|
||||
},
|
||||
{
|
||||
"Aliases": [
|
||||
".fishspot",
|
||||
".fisp",
|
||||
".fish?"
|
||||
],
|
||||
"Description": "Shows information about the current fish spot, weather and time.",
|
||||
"Usage": [
|
||||
".fishspot"
|
||||
],
|
||||
"Submodule": "FishCommands",
|
||||
"Module": "Games",
|
||||
"Options": null,
|
||||
"Requirements": []
|
||||
},
|
||||
{
|
||||
"Aliases": [
|
||||
".fishlist",
|
||||
".fili",
|
||||
".fishes",
|
||||
".fil"
|
||||
],
|
||||
"Description": "Look at your fish catalogue.\nShows how many of each fish you caught and what was the highest quality.\nFor each caught fish, it also shows its required spot, time of day and weather.",
|
||||
"Usage": [
|
||||
".fishlist"
|
||||
],
|
||||
"Submodule": "FishCommands",
|
||||
"Module": "Games",
|
||||
"Options": null,
|
||||
"Requirements": []
|
||||
},
|
||||
{
|
||||
"Aliases": [
|
||||
".hangmanlist"
|
||||
|
@@ -4852,11 +4852,11 @@ temprole:
|
||||
- '15m @User Jail'
|
||||
- '7d @Newbie Trial Member'
|
||||
params:
|
||||
- days:
|
||||
- time:
|
||||
desc: "The time after which the role is automatically removed."
|
||||
- user:
|
||||
user:
|
||||
desc: "The user to give the role to."
|
||||
- role:
|
||||
role:
|
||||
desc: "The role to give to the user."
|
||||
minesweeper:
|
||||
desc: |-
|
||||
|
Reference in New Issue
Block a user