mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-12 02:08:27 -04:00
Added pagination to .reroli
This commit is contained in:
@@ -67,15 +67,23 @@ public partial class Administration
|
|||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[UserPerm(GuildPerm.ManageRoles)]
|
[UserPerm(GuildPerm.ManageRoles)]
|
||||||
[BotPerm(GuildPerm.ManageRoles)]
|
[BotPerm(GuildPerm.ManageRoles)]
|
||||||
public async Task ReactionRolesList()
|
public async Task ReactionRolesList(int page = 1)
|
||||||
{
|
{
|
||||||
|
if (--page < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
var reros = await _rero.GetReactionRolesAsync(ctx.Guild.Id);
|
var reros = await _rero.GetReactionRolesAsync(ctx.Guild.Id);
|
||||||
|
|
||||||
|
await ctx.SendPaginatedConfirmAsync(page, curPage =>
|
||||||
|
{
|
||||||
var embed = _eb.Create(ctx)
|
var embed = _eb.Create(ctx)
|
||||||
.WithOkColor();
|
.WithOkColor();
|
||||||
|
|
||||||
var content = string.Empty;
|
var content = string.Empty;
|
||||||
foreach (var g in reros.GroupBy(x => x.MessageId).OrderBy(x => x.Key))
|
foreach (var g in reros.OrderBy(x => x.Group)
|
||||||
|
.Skip(curPage * 10)
|
||||||
|
.GroupBy(x => x.MessageId)
|
||||||
|
.OrderBy(x => x.Key))
|
||||||
{
|
{
|
||||||
var messageId = g.Key;
|
var messageId = g.Key;
|
||||||
content +=
|
content +=
|
||||||
@@ -89,7 +97,8 @@ public partial class Administration
|
|||||||
|
|
||||||
foreach (var rero in ggs)
|
foreach (var rero in ggs)
|
||||||
{
|
{
|
||||||
content += $"\t{rero.Emote} -> {(ctx.Guild.GetRole(rero.RoleId)?.Mention ?? "<missing role>")}";
|
content +=
|
||||||
|
$"\t{rero.Emote} -> {(ctx.Guild.GetRole(rero.RoleId)?.Mention ?? "<missing role>")}";
|
||||||
if (rero.LevelReq > 0)
|
if (rero.LevelReq > 0)
|
||||||
content += $" (lvl {rero.LevelReq}+)";
|
content += $" (lvl {rero.LevelReq}+)";
|
||||||
content += '\n';
|
content += '\n';
|
||||||
@@ -102,7 +111,8 @@ public partial class Administration
|
|||||||
? "There are no reaction roles on this server"
|
? "There are no reaction roles on this server"
|
||||||
: content);
|
: content);
|
||||||
|
|
||||||
await ctx.Channel.EmbedAsync(embed);
|
return embed;
|
||||||
|
}, reros.Count, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Cmd]
|
[Cmd]
|
||||||
|
Reference in New Issue
Block a user