Beispiel #1
0
        private async Task RunReactionPrompts([NotNull] MessageReactionAddPayload payload)
        {
            var key    = IPromptDataReaction.ToKey(payload);
            var result = await Client.Cache.Prompts.GetAsync(key);

            if (result is null)
            {
                return;
            }

            var state = (result.Data as IPromptDataReaction) !;
            // ReSharper disable once PossibleNullReferenceException
            var delay = await state.RunAsync(payload);

            if (delay is null)
            {
                await Client.Cache.Prompts.DeleteAsync(key);
            }
            else if (delay != TimeSpan.Zero)
            {
                await Client.Cache.Prompts.SetAsync(result, (TimeSpan)delay);
            }
        }
 public string ToKey()
 {
     return(IPromptDataReaction.ToKey(MessageId, AuthorId));
 }