コード例 #1
0
        public string FillPlaceholders(string text, SenderReceived sender)
        {
            var newText = text;

            newText = text.Replace("<sender_name>", sender.Name);
            return(newText);
        }
コード例 #2
0
ファイル: Frame.cs プロジェクト: 117503445/go_back_n
 private void LeftAnimation_Completed(object sender, EventArgs e)
 {
     Canvas.Children.Remove(button);
     if (!IsLost && !IsBroken)
     {
         if (isFromSender)
         {
             ReceiverReceived?.Invoke(sender, this);
         }
         else
         {
             SenderReceived?.Invoke(sender, this);
         }
     }
 }
コード例 #3
0
        public IEnumerable <ResponseMessage> CreateResponseFor(MessageReceived message, SenderReceived sender)
        {
            var responses = new List <ResponseMessage>();

            var category = DetermineMessageCategory(message);

            switch (category)
            {
            case MessageCategory.Love:
                responses.Add(new ResponseMessage {
                    Type = ResponseMessageType.Text, Text = "Κι εγώ αγάπη μου!"
                });
                responses.Add(new ResponseMessage {
                    Type = ResponseMessageType.Sticker, StickerId = 40108
                });
                break;

            case MessageCategory.KaliXronia:
                responses.Add(new ResponseMessage {
                    Type = ResponseMessageType.Text, Text = "Καλή χρονιά και χρόνια πολλά! Με υγεία κι ευτυχία το νέο έτος!"
                });
                responses.Add(new ResponseMessage {
                    Type = ResponseMessageType.Sticker, StickerId = 5716
                });
                break;

            case MessageCategory.Pasok:
                responses.Add(new ResponseMessage {
                    Type = ResponseMessageType.Sticker, StickerId = 68408
                });
                responses.Add(new ResponseMessage {
                    Type = ResponseMessageType.AnimatedGif, MediaUrl = "https://media.giphy.com/media/TIRQqWIimnH9xL0kJx/giphy-downsized.gif"
                });
                break;

            case MessageCategory.OrderStart:
                var url = _mediaUrlResolver.GetMenuImageFor("pala", "pala_front");
                responses.Add(new ResponseMessage {
                    Type = ResponseMessageType.Picture, MediaUrl = url, Text = "Θα παραγγείλεις από το Pala"
                });
                responses.Add(new ResponseMessage {
                    Type = ResponseMessageType.Text, Text = "Τι θα προτιμούσες;\npinsa (μια παραλλαγή πίτσας), σάντουιτς ή κάποιο snack;"
                });
                break;

            case MessageCategory.OrderPinsa:
                var url2 = _mediaUrlResolver.GetMenuImageFor("pala", "pinse1");
                var url3 = _mediaUrlResolver.GetMenuImageFor("pala", "pinse2");
                responses.Add(new ResponseMessage {
                    Type = ResponseMessageType.Picture, MediaUrl = url2, Text = "Διάλεξε μια από αυτές"
                });
                responses.Add(new ResponseMessage {
                    Type = ResponseMessageType.Picture, MediaUrl = url3, Text = "... ή αυτές"
                });
                break;

            case MessageCategory.OrderSnack:
                var url4 = _mediaUrlResolver.GetMenuImageFor("pala", "snacks");
                responses.Add(new ResponseMessage {
                    Type = ResponseMessageType.Picture, MediaUrl = url4, Text = "Διάλεξε κάποιο"
                });
                break;

            case MessageCategory.OrderSandwitch:
                var url5 = _mediaUrlResolver.GetMenuImageFor("pala", "sandwiches");
                responses.Add(new ResponseMessage {
                    Type = ResponseMessageType.Picture, MediaUrl = url5, Text = "Διάλεξε κάποιο"
                });
                break;

            default:
                responses.Add(new ResponseMessage {
                    Type = ResponseMessageType.Text, Text = FillPlaceholders(_botConfig.DefaultMessage, sender)
                });
                responses.Add(new ResponseMessage {
                    Type = ResponseMessageType.Sticker, StickerId = Stickers.Random
                });
                break;
            }

            return(responses);
        }