* add: .prunecancel to cancel active prunes

* change: .qs improved with thumbnails
* change: .prune now reports progress
* dev: DryIoc replacing Ninject
This commit is contained in:
Kwoth
2024-05-04 06:33:45 +00:00
parent 7637de8fed
commit ea0b51d474
22 changed files with 418 additions and 235 deletions

View File

@@ -61,7 +61,7 @@ public abstract class NadekoModule : ModuleBase
}
// TypeConverter typeConverter = TypeDescriptor.GetConverter(propType); ?
public async Task<string> GetUserInputAsync(ulong userId, ulong channelId)
public async Task<string> GetUserInputAsync(ulong userId, ulong channelId, Func<string, bool> validate = null)
{
var userInputTask = new TaskCompletionSource<string>();
var dsc = (DiscordSocketClient)ctx.Client;
@@ -89,6 +89,9 @@ public abstract class NadekoModule : ModuleBase
|| userMsg.Channel.Id != channelId)
return Task.CompletedTask;
if (validate is not null && !validate(arg.Content))
return Task.CompletedTask;
if (userInputTask.TrySetResult(arg.Content))
userMsg.DeleteAfter(1);