public string GetNickWithoutRank(DiscordMember member) { string nick = member.Nickname; var rank = MilRanks.Find(x => x.Abbreviation == nick.Split(" ")[0].Replace(".", "")); var commRank = MilRanks.Find(x => x.Abbreviation == nick.Split(" ")[0].Replace(".", "")); if (rank == null && commRank == null) { return(nick); } else { return(nick.Split(" ")[1]); } }
public string GetNickWithoutRank(string memberName) { try { var rank = MilRanks.Find(x => x.Abbreviation == memberName.Split(" ")[0].Replace(".", "")); var commRank = MilRanks.Find(x => x.Abbreviation == memberName.Split(" ")[0].Replace(".", "")); if (rank == null && commRank == null) { return(memberName); } else { return(memberName.Split(" ")[1]); } } catch { return(memberName); } }
public string GetUpdatedNickname(DiscordMember member, int advancement = 1) { string nick = member.Nickname; var rank = MilRanks.Find(x => x.Abbreviation == nick.Split(" ")[0].Replace(".", "")); var commRank = CommerceRanks.Find(x => x.Abbreviation == nick.Split(" ")[0].Replace(".", "")); if (rank == null && commRank == null) { rank = GetMatchingRank(member); return($"{rank.Abbreviation}. {nick}"); } else if (rank == null) { return(nick.Replace(commRank.Abbreviation, CommerceRanks.Find(x => x.Number == commRank.Number + advancement).Abbreviation)); } else { return(nick.Replace(rank.Abbreviation, MilRanks.Find(x => x.Number == rank.Number + advancement).Abbreviation)); } }