Beispiel #1
0
        /// <summary> Set a reaction to confirm the exeuction or failure of the used command. </summary>
        public static async Task SetResultAsync(this IMessage message, CommandResult commandResult)
        {
            Emotes?reaction = null;

            switch (commandResult)
            {
            case CommandResult.Success:
                reaction = Emotes.WhiteCheckMark;
                break;

            case CommandResult.SuccessAlt1:
                reaction = Emotes.BallotBoxWithCheck;
                break;

            case CommandResult.SuccessAlt2:
                reaction = Emotes.HeavyCheckMark;
                break;

            case CommandResult.Failed:
                reaction = Emotes.X;
                break;

            case CommandResult.InvalidParameters:
                reaction = Emotes.Anger;
                break;

            case CommandResult.FailedBotPermission:
                reaction = Emotes.NoEntrySign;
                break;

            case CommandResult.FailedUserPermission:
                reaction = Emotes.NoEntry;
                break;
            }

            if (reaction.HasValue)
            {
                await message.AddReactionsAsync(reaction.Value).ConfigureAwait(false);
            }
        }