Exemplo n.º 1
0
        internal static bool TryGetCallbackState(this Event command, out CallbackData callbackData)
        {
            if (!command.State.TryGetValue(Constants.CallbackData, out var json))
            {
                callbackData = null;
                return(false);
            }

            try
            {
                callbackData = SlackJsonSerializer.Deserialize <CallbackData>(json);
                return(callbackData != null);
            }
            catch
            {
                callbackData = null;
                return(false);
            }
        }
Exemplo n.º 2
0
 internal static void AddCallbackState(this BaseCommand command, CallbackData callbackData)
 {
     command.State[Constants.CallbackData] = SlackJsonSerializer.Serialize(callbackData);
 }