Example #1
0
        /// <summary>
        /// The EditSuggestion method is used to approve/decline a proposed subject. To achieve this, it takes in the related fields and applies them to the given context.
        /// </summary>
        /// <param name="Tracker">The tracker of the proposal, used to search up the suggestion in the given database.</param>
        /// <param name="Reason">The optional reason for the proposal having been approved / declined.</param>
        /// <param name="Approver">The administrator who has approved the given suggestion.</param>
        /// <param name="MessageChannel">The channel in which the approval command was run.</param>
        /// <param name="ProposalStatus">The type of proposal status you wish to set the embed to.</param>
        /// <returns>A <c>Task</c> object, which can be awaited until this method completes successfully.</returns>

        public async Task EditProposal(string Tracker, string Reason, IUser Approver, IMessageChannel MessageChannel, ProposalStatus ProposalStatus)
        {
            Proposal Proposal = ProposalDB.GetProposalByNameOrID(Tracker);

            if (Proposal == null)
            {
                await BuildEmbed(EmojiEnum.Annoyed)
                .WithTitle("Proposal does not exist!")
                .WithDescription($"Cound not fetch the proposal from tracker / message ID / staff message ID `{Tracker}`.\n" +
                                 $"Are you sure it exists?")
                .SendEmbed(MessageChannel);
            }
            else
            {
                Proposal.Reason = Reason;

                await UpdateProposal(Proposal, ProposalStatus);

                await BuildEmbed(ProposalStatus == ProposalStatus.Declined?EmojiEnum.Annoyed : EmojiEnum.Love)
                .WithTitle($"{Proposal.ProposalType.ToString().Prettify()} {Proposal.ProposalStatus}.")
                .WithDescription($"The {Proposal.ProposalType.ToString().Prettify().ToLower()} `{Proposal.Tracker}` was successfully {Proposal.ProposalStatus.ToString().ToLower()} by {Approver.Mention}.")
                .AddField(!string.IsNullOrEmpty(Reason), "Reason", Reason)
                .WithCurrentTimestamp()
                .SendDMAttachedEmbed(MessageChannel, BotConfiguration, DiscordSocketClient.GetUser(Proposal.Proposer), BuildProposal(Proposal));
            }
        }
Example #2
0
        public async Task FetchProposal(string Tracker)
        {
            Proposal Proposal = ProposalDB.GetProposalByNameOrID(Tracker);

            if (Proposal == null)
            {
                await BuildEmbed(EmojiEnum.Annoyed)
                .WithTitle("Proposal does not exist!")
                .WithDescription($"Cound not fetch the proposal from tracker / message ID / staff message ID `{Tracker}`.\n" +
                                 $"Are you sure it exists?")
                .SendEmbed(Context.Channel);
            }
            else
            {
                await ProposalService.BuildProposal(Proposal)
                .SendEmbed(Context.Channel);
            }
        }