Esempio n. 1
0
        public void InlineMenu(InlineQuery query, IBot Parent)
        {
            if (Parent.Modules.Exists(fn => fn.Name == "_2chModule") && query.Query.Contains("2ch"))
            {
                Webm webm = Parent.GetModule <_2chModule>().WebmsSent.Find(fn => fn.Path == query.Query);
                if (webm != null)
                {
                    var msg = new Telegram.Bot.Types.InlineQueryResults.InputTextMessageContent($"<a href=\"{ webm.Thumbnail }\">&#8204;</a>{webm.Path}")
                    {
                        ParseMode = Telegram.Bot.Types.Enums.ParseMode.Html
                    };

                    Telegram.Bot.Types.InlineQueryResults.InlineQueryResultArticle[] results =
                    {
                        new Telegram.Bot.Types.InlineQueryResults.InlineQueryResultArticle("0", "WEBM", msg)
                        {
                            ReplyMarkup = LikeDislikeModule.getKeyBoard(),
                            Description = "POST"
                        }
                    };
                    Parent.Client.AnswerInlineQueryAsync(query.Id, results);
                }
            }
            else if (query.Query.Contains("opros"))
            {
                string id = query.Query.Split('-').Last();
                try
                {
                    var Oprs = Parent.GetModule <VoteModule>().Opros.Find(fn => fn.Id == int.Parse(id));
                    if (Oprs != null)
                    {
                        var msg = new Telegram.Bot.Types.InlineQueryResults.InputTextMessageContent($"{Oprs.About}")
                        {
                            ParseMode = Telegram.Bot.Types.Enums.ParseMode.Html
                        };

                        Pes7BotCrator.Modules.Types.VoteModule.Likes ll = null;
                        try
                        {
                            ll = Parent.GetModule <VoteModule>().LLikes.Find(fn => fn.ParentO.Id == int.Parse(id));
                        }
                        catch { }
                        Telegram.Bot.Types.InlineQueryResults.InlineQueryResultArticle[] results =
                        {
                            new Telegram.Bot.Types.InlineQueryResults.InlineQueryResultArticle("0", "Opros",            msg)
                            {
                                ReplyMarkup = VoteModule.getKeyBoard(ll.LikeId.Count,               ll.DisLikeId.Count, Oprs,Oprs.Query),
                                Description = "POST"
                            }
                        };
                        Parent.Client.AnswerInlineQueryAsync(query.Id, results);
                    }
                }
                catch {}
            }
        }
Esempio n. 2
0
 public void AutoDelMessage(Telegram.Bot.Types.Message ms, IBot Parent, List <ArgC> args)
 {
     if (args != null)
     {
         ArgC time = args.Find(fs => fs.Name == "time");
         ArgC text = args.Find(fs => fs.Name == "text");
         if (text != null && time != null)
         {
             Parent.GetModule <TRM>().SendTimeRelayMessageAsynkAsync(ms.Chat.Id, text.Arg, int.Parse(time.Arg));
         }
     }
 }