public async override Task PerformAction(SocketReaction option) { switch (option.Emote.ToString()) { case ReactionHandler.UP_STR: await CursorDown(); // these are swapped because I messed something up. They should remain swapped (CursorDown under the UP_STR case and vice versa) break; case ReactionHandler.DOWN_STR: await CursorUp(); break; case ReactionHandler.SELECT_STR: if (HelpManager.GetDirList(Path, Admin, Mod).Length < 1) { return; } await Select(HelpManager.GetDirList(Path, Admin, Mod)[Cursor]); break; case GoBack: await Back(); break; } }
private async Task Back() { Path = HelpManager.BackDir(Path); FileCount = HelpManager.GetDirList(Path, Admin, Mod).Length; await UpdateEmbed(); }
public HelpEmbed(SocketCommandContext ctx, bool mod = false, bool admin = false) { AddMenuOptions(ReactionHandler.SELECT, ReactionHandler.UP, ReactionHandler.DOWN, new MenuOptionNode(GoBack, "Go back")); SetCtx(ctx); Path = @"Help"; Cursor = 0; Admin = admin; Mod = mod; FileCount = HelpManager.GetDirList(Path, Admin, mod).Length; }
private async Task Select(string dir) { if (FileCount == 0) { return; } Cursor = 0; Path = HelpManager.SelectDir(Path, dir); if (!OnFile()) { FileCount = HelpManager.GetDirList(Path, Admin, Mod).Length; } else { FileCount = 0; } await UpdateEmbed(); }
/// <summary> /// Adds the list of files and folders to the embed /// </summary> /// <param name="eb">The embed builder</param> private void AddDirList(EmbedBuilder eb) { eb.AddField(VirtualPath(), GetDirText(HelpManager.GetDirList(Path, Admin, Mod), Cursor)); }