Example #1
0
        /// <summary>
        /// The Get Proposal By Name Or ID method gets a proposal both from either its token, staff message ID or message ID.
        /// </summary>
        /// <param name="Tracker">The tracked variable of the proposal you would like to find.</param>
        /// <returns>A proposal object pertaining to the proposal that has been returned on the tracked token.</returns>

        public Proposal GetProposalByNameOrID(string Tracker)
        {
            Proposal TryTracked = Proposals.Find(Tracker);

            if (TryTracked != null)
            {
                return(TryTracked);
            }

            if (ulong.TryParse(Tracker, out ulong TrackerASULONG))
            {
                Proposal TryMessageID = Proposals.AsQueryable().Where(Proposal => Proposal.MessageID == TrackerASULONG).FirstOrDefault();

                if (TryMessageID != null)
                {
                    return(TryMessageID);
                }

                Suggestion Suggestion = Suggestions.AsQueryable().Where(Suggestion => Suggestion.StaffMessageID == TrackerASULONG).FirstOrDefault();

                if (Suggestion != null)
                {
                    return(Proposals.Find(Suggestion.Tracker));
                }
            }

            return(null);
        }