Esempio n. 1
0
        private static async Task OnInlineQuery(InlineQuery query)
        {
            var game = GetGame(query.From);

            if (game == null)
            {
                await Telegram.AnswerInline(query);
            }
            else
            {
                await game.OnInline(query);
            }
        }
Esempio n. 2
0
        // point d'entrée pour la complétion inline
        public async Task OnInline(InlineQuery query)
        {
            await sem.WaitAsync();

            try
            {
                string expr   = query.Query;
                var    player = FindPlayer(query);
                if (player == null)
                {
                    await Telegram.AnswerInline(query);

                    return;
                }
                string descr = null;
                if (Board.Count >= 3)
                {
                    descr = "Votre main: " + Card.BestHand(Board.Concat(player.Cards)).descr;
                }
                await Telegram.AnswerInline(query,
                                            new[] {
                    new InlineQueryResultArticle($"Card_" + string.Join("_", player.Cards),
                                                 "Vos cartes:  " + string.Join("  ", player.Cards),
                                                 new InputTextMessageContent("(je regarde mes cartes)"))
                    {
                        Description = descr
                    },                                                  //, ThumbUrl = "https://raw.githubusercontent.com/hayeah/playing-cards-assets/master/png/2_of_hearts.png", ThumbWidth = 222, ThumbHeight = 323 },
                    //new InlineQueryResultPhoto("2", $"http://via.placeholder.com/{expr}", $"http://via.placeholder.com/{expr}") { Title = "photo", PhotoWidth = 85, PhotoHeight = 85 },
                },
                                            2, isPersonal : true, switchPmText : $"Mise: {BB(player.Bet)} | Stack: {BB(player.Stack)}", switchPmParameter : "cards");
            }
            finally
            {
                sem.Release();
            }
        }