fix: global nadeko captcha patron add will show 12.5% of the time now, down from 20%, and be smaller

change: increased todo and archive limits slightly
This commit is contained in:
Kwoth
2025-01-30 10:52:38 +00:00
parent 0fdccea31c
commit 42fc0c263d
6 changed files with 44 additions and 12 deletions

View File

@@ -168,9 +168,9 @@ public partial class Gambling : GamblingModule<GamblingService>
.File(stream, "timely.png"); .File(stream, "timely.png");
#if GLOBAL_NADEKO #if GLOBAL_NADEKO
if (_rng.Next(0, 5) == 0) if (_rng.Next(0, 8) == 0)
toSend = toSend toSend = toSend
.Confirm("[Sub on Patreon](https://patreon.com/nadekobot) to remove captcha."); .Text("*[Sub on Patreon](https://patreon.com/nadekobot) to remove captcha.*");
#endif #endif
var captchaMessage = await toSend.SendAsync(); var captchaMessage = await toSend.SendAsync();

View File

@@ -33,9 +33,9 @@ public partial class Games
.File(stream, "timely.png"); .File(stream, "timely.png");
#if GLOBAL_NADEKO #if GLOBAL_NADEKO
if (_rng.Next(0, 5) == 0) if (_rng.Next(0, 8) == 0)
toSend = toSend toSend = toSend
.Confirm("[Sub on Patreon](https://patreon.com/nadekobot) to remove captcha."); .Text("*[Sub on Patreon](https://patreon.com/nadekobot) to remove captcha.*");
#endif #endif
var captcha = await toSend.SendAsync(); var captcha = await toSend.SendAsync();

View File

@@ -150,7 +150,26 @@ public partial class Utility
[Cmd] [Cmd]
public async Task TodoArchiveAdd([Leftover] string name) public async Task TodoArchiveAdd([Leftover] string name)
{ {
var result = await _service.ArchiveTodosAsync(ctx.User.Id, name); var result = await _service.ArchiveTodosAsync(ctx.User.Id, name, false);
if (result == ArchiveTodoResult.NoTodos)
{
await Response().Error(strs.todo_no_todos).SendAsync();
return;
}
if (result == ArchiveTodoResult.MaxLimitReached)
{
await Response().Error(strs.todo_archive_max_limit).SendAsync();
return;
}
await ctx.OkAsync();
}
[Cmd]
public async Task TodoArchiveDone([Leftover] string name)
{
var result = await _service.ArchiveTodosAsync(ctx.User.Id, name, true);
if (result == ArchiveTodoResult.NoTodos) if (result == ArchiveTodoResult.NoTodos)
{ {
await Response().Error(strs.todo_no_todos).SendAsync(); await Response().Error(strs.todo_no_todos).SendAsync();
@@ -193,7 +212,7 @@ public partial class Utility
foreach (var archivedList in items) foreach (var archivedList in items)
{ {
eb.AddField($"id: {archivedList.Id.ToString()}", archivedList.Name, true); eb.AddField($"id: {new kwum(archivedList.Id)}", archivedList.Name, true);
} }
return eb; return eb;
@@ -202,7 +221,7 @@ public partial class Utility
} }
[Cmd] [Cmd]
public async Task TodoArchiveShow(int id) public async Task TodoArchiveShow(kwum id)
{ {
var list = await _service.GetArchivedTodoListAsync(ctx.User.Id, id); var list = await _service.GetArchivedTodoListAsync(ctx.User.Id, id);
if (list == null || list.Items.Count == 0) if (list == null || list.Items.Count == 0)
@@ -234,7 +253,7 @@ public partial class Utility
} }
[Cmd] [Cmd]
public async Task TodoArchiveDelete(int id) public async Task TodoArchiveDelete(kwum id)
{ {
if (!await _service.ArchiveDeleteAsync(ctx.User.Id, id)) if (!await _service.ArchiveDeleteAsync(ctx.User.Id, id))
{ {

View File

@@ -6,8 +6,8 @@ namespace NadekoBot.Modules.Utility;
public sealed class TodoService : INService public sealed class TodoService : INService
{ {
private const int ARCHIVE_MAX_COUNT = 9; private const int ARCHIVE_MAX_COUNT = 18;
private const int TODO_MAX_COUNT = 27; private const int TODO_MAX_COUNT = 36;
private readonly DbService _db; private readonly DbService _db;
@@ -111,7 +111,7 @@ public sealed class TodoService : INService
.DeleteAsync(); .DeleteAsync();
} }
public async Task<ArchiveTodoResult> ArchiveTodosAsync(ulong userId, string name) public async Task<ArchiveTodoResult> ArchiveTodosAsync(ulong userId, string name, bool onlyDone)
{ {
// create a new archive // create a new archive
@@ -140,7 +140,7 @@ public sealed class TodoService : INService
var updated = await ctx var updated = await ctx
.GetTable<TodoModel>() .GetTable<TodoModel>()
.Where(x => x.UserId == userId && x.ArchiveId == null) .Where(x => x.UserId == userId && (!onlyDone || x.IsDone) && x.ArchiveId == null)
.Set(x => x.ArchiveId, inserted.Id) .Set(x => x.ArchiveId, inserted.Id)
.UpdateAsync(); .UpdateAsync();
@@ -204,4 +204,5 @@ public sealed class TodoService : INService
.Where(x => x.UserId == userId && x.Id == todoId) .Where(x => x.UserId == userId && x.Id == todoId)
.FirstOrDefaultAsyncLinqToDB(); .FirstOrDefaultAsyncLinqToDB();
} }
} }

View File

@@ -1441,6 +1441,11 @@ todoarchivedelete:
- del - del
- remove - remove
- rm - rm
todoarchivedone:
- done
- compelete
- finish
- completed
todoedit: todoedit:
- edit - edit
- change - change

View File

@@ -4524,6 +4524,13 @@ todoarchiveadd:
params: params:
- name: - name:
desc: "The name of the archive to be created." desc: "The name of the archive to be created."
todoarchivedone:
desc: Creates a new archive with the specified name using only completed current todos.
ex:
- Success!
params:
- name:
desc: "The name of the archive to be created."
todoarchivelist: todoarchivelist:
desc: Lists all archived todo lists. desc: Lists all archived todo lists.
ex: ex: