mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 01:38:27 -04:00
Added .todo show, Renamed ReactionRole* commands to rero*
This commit is contained in:
@@ -17,7 +17,7 @@ public partial class Administration
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
public async Task ReactionRoleAdd(
|
||||
public async Task ReRoAdd(
|
||||
ulong messageId,
|
||||
string emoteStr,
|
||||
IRole role,
|
||||
@@ -68,7 +68,7 @@ public partial class Administration
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
public async Task ReactionRolesList(int page = 1)
|
||||
public async Task ReRoList(int page = 1)
|
||||
{
|
||||
if (--page < 0)
|
||||
return;
|
||||
@@ -124,7 +124,7 @@ public partial class Administration
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
public async Task ReactionRolesRemove(ulong messageId)
|
||||
public async Task ReRoRemove(ulong messageId)
|
||||
{
|
||||
var succ = await _rero.RemoveReactionRoles(ctx.Guild.Id, messageId);
|
||||
if (succ)
|
||||
@@ -137,7 +137,7 @@ public partial class Administration
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
public async Task ReactionRolesDeleteAll()
|
||||
public async Task ReRoDeleteAll()
|
||||
{
|
||||
await _rero.RemoveAllReactionRoles(ctx.Guild.Id);
|
||||
await ctx.OkAsync();
|
||||
@@ -148,7 +148,7 @@ public partial class Administration
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
[Ratelimit(60)]
|
||||
public async Task ReactionRolesTransfer(ulong fromMessageId, ulong toMessageId)
|
||||
public async Task ReRoTransfer(ulong fromMessageId, ulong toMessageId)
|
||||
{
|
||||
var msg = await ctx.Channel.GetMessageAsync(toMessageId);
|
||||
|
||||
|
@@ -283,14 +283,13 @@ public sealed class Help : NadekoModule<HelpService>
|
||||
//if cross is specified, and the command doesn't satisfy the requirements, cross it out
|
||||
if (opts.View == CommandsOptions.ViewType.Cross)
|
||||
{
|
||||
return
|
||||
$"{(succ.Contains(x) ? "✅" : "❌")} {prefix + x.Aliases[0]}";
|
||||
return $"{(succ.Contains(x) ? "✅" : "❌")} {prefix + x.Aliases[0]}";
|
||||
}
|
||||
|
||||
if (x.Aliases.Count == 1)
|
||||
return prefix + x.Aliases[0];
|
||||
|
||||
return prefix + x.Aliases[0] + " / " + prefix + x.Aliases[1];
|
||||
return prefix + x.Aliases[0] + " | " + prefix + x.Aliases[1];
|
||||
});
|
||||
|
||||
embed.AddField(g.ElementAt(i).Key, "" + string.Join("\n", transformed) + "", true);
|
||||
@@ -304,12 +303,18 @@ public sealed class Help : NadekoModule<HelpService>
|
||||
private async Task Group(ModuleInfo group)
|
||||
{
|
||||
var eb = _sender.CreateEmbed()
|
||||
.WithTitle(GetText(strs.cmd_group_commands(group.Name)))
|
||||
.WithOkColor();
|
||||
.WithTitle(GetText(strs.cmd_group_commands(group.Name)))
|
||||
.WithOkColor();
|
||||
|
||||
foreach (var cmd in group.Commands.DistinctBy(x => x.Aliases[0]))
|
||||
{
|
||||
eb.AddField(prefix + cmd.Aliases.First(), cmd.RealSummary(_strings, _medusae, Culture, prefix));
|
||||
string cmdName;
|
||||
if (cmd.Aliases.Count > 1)
|
||||
cmdName = Format.Code(prefix +cmd.Aliases[0]) + " | " + Format.Code(prefix + cmd.Aliases[1]);
|
||||
else
|
||||
cmdName = Format.Code(prefix + cmd.Aliases.First());
|
||||
|
||||
eb.AddField(cmdName, cmd.RealSummary(_strings, _medusae, Culture, prefix));
|
||||
}
|
||||
|
||||
await Response().Embed(eb).SendAsync();
|
||||
@@ -358,7 +363,7 @@ public sealed class Help : NadekoModule<HelpService>
|
||||
var data = await GetHelpString();
|
||||
if (data == default)
|
||||
return;
|
||||
|
||||
|
||||
await Response().Text(data).SendAsync();
|
||||
try
|
||||
{
|
||||
@@ -536,8 +541,8 @@ public sealed class Help : NadekoModule<HelpService>
|
||||
SelfhostAction));
|
||||
|
||||
var eb = _sender.CreateEmbed()
|
||||
.WithOkColor()
|
||||
.WithTitle("Thank you for considering to donate to the NadekoBot project!");
|
||||
.WithOkColor()
|
||||
.WithTitle("Thank you for considering to donate to the NadekoBot project!");
|
||||
|
||||
eb
|
||||
.WithDescription("NadekoBot relies on donations to keep the servers, services and APIs running.\n"
|
||||
@@ -581,7 +586,7 @@ Nadeko will DM you the welcome instructions, and you may start using the patron-
|
||||
.Embed(eb)
|
||||
.Interaction(selfhostInter)
|
||||
.SendAsync();
|
||||
|
||||
|
||||
_ = ctx.OkAsync();
|
||||
}
|
||||
catch
|
||||
|
@@ -66,6 +66,22 @@ public partial class Utility
|
||||
.SendAsync();
|
||||
}
|
||||
|
||||
[Cmd]
|
||||
public async Task TodoShow(kwum todoId)
|
||||
{
|
||||
var todo = await _service.GetTodoAsync(ctx.User.Id, todoId);
|
||||
|
||||
if (todo is null)
|
||||
{
|
||||
await Response().Error(strs.todo_not_found).SendAsync();
|
||||
return;
|
||||
}
|
||||
|
||||
await Response()
|
||||
.Confirm($"`{new kwum(todo.Id)}` {todo.Todo}")
|
||||
.SendAsync();
|
||||
}
|
||||
|
||||
|
||||
[Cmd]
|
||||
public async Task TodoComplete(kwum todoId)
|
||||
@@ -105,7 +121,7 @@ public partial class Utility
|
||||
var sb = new StringBuilder();
|
||||
foreach (var todo in todos)
|
||||
{
|
||||
sb.AppendLine($"{(todo.IsDone ? "✔" : "□")} {Format.Code(new kwum(todo.Id).ToString())} {todo.Todo}");
|
||||
sb.AppendLine(InternalItemShow(todo));
|
||||
|
||||
sb.AppendLine("---");
|
||||
}
|
||||
@@ -113,6 +129,9 @@ public partial class Utility
|
||||
eb.WithDescription(sb.ToString());
|
||||
}
|
||||
|
||||
private static string InternalItemShow(TodoModel todo)
|
||||
=> $"{(todo.IsDone ? "✔" : "□")} {Format.Code(new kwum(todo.Id).ToString())} {todo.Todo}";
|
||||
|
||||
[Group("archive")]
|
||||
public partial class ArchiveCommands : NadekoModule<TodoService>
|
||||
{
|
||||
|
@@ -179,4 +179,14 @@ public sealed class TodoService
|
||||
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
public async Task<TodoModel?> GetTodoAsync(ulong userId, int todoId)
|
||||
{
|
||||
await using var ctx = _db.GetDbContext();
|
||||
|
||||
return await ctx
|
||||
.GetTable<TodoModel>()
|
||||
.Where(x => x.UserId == userId && x.Id == todoId)
|
||||
.FirstOrDefaultAsyncLinqToDB();
|
||||
}
|
||||
}
|
@@ -664,11 +664,17 @@ public partial class Utility : NadekoModule
|
||||
.WithReferences(this.GetType().Assembly)
|
||||
.WithImports(
|
||||
"System",
|
||||
"System.Collections.Generic",
|
||||
"System.IO",
|
||||
"System.Linq",
|
||||
"System.Net.Http",
|
||||
"System.Threading",
|
||||
"System.Threading.Tasks",
|
||||
"NadekoBot",
|
||||
"NadekoBot.Extensions",
|
||||
"Microsoft.Extensions.DependencyInjection",
|
||||
"NadekoBot.Common",
|
||||
"NadekoBot.Modules",
|
||||
"System.Text",
|
||||
"System.Text.Json"),
|
||||
globalsType: typeof(EvalGlobals));
|
||||
|
Reference in New Issue
Block a user