public override async Task PerformAction(SocketReaction option) { switch (option.Emote.ToString()) { case ReactionHandler.UP_STR: if (SelectedTitle == null) { await CursorUp(); } break; case ReactionHandler.DOWN_STR: if (SelectedTitle == null) { await CursorDown(); } break; case ReactionHandler.SELECT_STR: if (SelectedTitle == null) { SelectedTitle = Titles[Cursor].Item1; } else { if (UserDataManager.HasTitle(User, SelectedTitle.Value)) { UserDataManager.EquipTitle(User, SelectedTitle.Value); TitleEquipedNotify = true; } else { NoTitleNotify = true; } } await UpdateEmbed(); break; case ReactionHandler.BACK_STR: SelectedTitle = null; await UpdateEmbed(); break; } }
public async Task AddTitleAsync([Remainder] string tn = "") { if (string.IsNullOrWhiteSpace(tn)) { TitleEmbed te = new TitleEmbed(Context); await te.Display(); return; } int?select = null; foreach (int id in AchievementManager.NodeMap.Keys) { if (UtilStringComparison.CompareWordScore(tn, AchievementManager.GetTitle(id).Name) >= 0.66) { select = id; break; } } if (select == null) { TitleEmbed te = new TitleEmbed(Context); await te.Display(); return; } if (UserDataManager.HasTitle(BotUtils.GetGUser(Context), select.Value)) { UserDataManager.EquipTitle(BotUtils.GetGUser(Context), select.Value); await ReplyAsync(BotUtils.KamtroText($"The {AchievementManager.GetTitle(select.Value).Name} title has been set!")); } else { await ReplyAsync(BotUtils.KamtroText($"You don't have the {AchievementManager.GetTitle(select.Value).Name} title")); } }