Пример #1
0
 private static async void OnInlineQuery(object sender, InlineQueryEventArgs e)
 {
     Log.Information("OnInlineResultChosen: {@InlineQuery}", e.InlineQuery);
     await Bot.AnswerInlineQueryAsync(e.InlineQuery.Id, new InlineQueryResult[0], isPersonal : true, cacheTime : 3600);
 }
Пример #2
0
        private static async void BotOnInlineQueryReceived(object sender, InlineQueryEventArgs inlineQueryEventArgs)
        {
            var results = GetLocation();

            await Bot.AnswerInlineQueryAsync(inlineQueryEventArgs.InlineQuery.Id, results, isPersonal : true, cacheTime : 0);
        }
Пример #3
0
        public async Task InlineQuery(InlineQuery inlineQuery)
        {
            var userId = inlineQuery.From.Id;
            var q      = inlineQuery.Query;

            if (!_checker.AllowUser(userId))
            {
                return;
            }

            if (q.Length > MaxInlineQueryLength)
            {
                return;
            }

            if (!_repository.IsUserExist(userId))
            {
                _repository.AddUser(new Bot.Rest.Model.User
                {
                    IdUser = userId,
                    Name   = $"{inlineQuery.From.FirstName} {inlineQuery.From.LastName}",
                    Mode   = EGettingWordsStrategy.Random.ToString()
                });
            }

            WordSearchResult[] results;

            // ReSharper disable once ConvertIfStatementToConditionalTernaryExpression
            if (q.Any())
            {
                results = _repository.FindFlashCard(q, userId).ToArray();
            }
            else
            {
                results = _repository.GetLastWords(userId, MaxInlineSearchResult).ToArray();
            }

            if (!results.Any())
            {
                await _client.AnswerInlineQueryAsync(inlineQuery.Id, new InlineQueryResultBase[]
                {
                    new InlineQueryResultArticle(inlineQuery.Id, "Please, type a chinese word to view it's flashcard",
                                                 new InputTextMessageContent("Still can't show you a flashcard")
                    {
                        DisableWebPagePreview = true,
                        ParseMode             = ParseMode.Default
                    })
                });

                _checker.UserQueryProcessed(userId);
                return;
            }


            var inlineQueryResults = results.Select(
                a =>
                new InlineQueryResultPhoto(Guid.NewGuid().ToString(), _flashCardUrl + a.File.Id,
                                           _flashCardUrl + a.File.Id)
            {
                Caption     = a.OriginalWord,
                PhotoHeight = a.File.Height,
                PhotoWidth  = a.File.Width
            });


            await _client.AnswerInlineQueryAsync(inlineQuery.Id, inlineQueryResults.ToArray(), 0);

            _checker.UserQueryProcessed(userId);
        }
Пример #4
0
        public HurtomBot(string TelegramApiToken)
        {
            bot = new TelegramBotClient(TelegramApiToken);

            bot.SetWebhookAsync("");

            bot.OnInlineQuery += async(object updobj, InlineQueryEventArgs iqea) =>
            {
                if (string.IsNullOrEmpty(iqea.InlineQuery.Query) || string.IsNullOrWhiteSpace(iqea.InlineQuery.Query))
                {
                    return;
                }

                var toloka = new TolokaHurtom.Toloka(iqea.InlineQuery.Query).ToArray();

                if (toloka.Length > 0)
                {
                    var inline = new InlineQueryResultArticle[toloka.Length];

                    for (int i = 0; i < toloka.Length; i++)
                    {
                        var content = new InputTextMessageContent($"<b>{toloka[i].title}</b>\n\n{toloka[i].size} | Роздають: {toloka[i].seeders} | Завантажують: {toloka[i].leechers}\n\n<i>{toloka[i].forum_parent} / {toloka[i].forum_name}</i>\n\n{toloka[i].link}");
                        content.ParseMode = ParseMode.Html;

                        inline[i] = new InlineQueryResultArticle(
                            i.ToString(),
                            toloka[i].title,
                            content);

                        inline[i].Description =
                            toloka[i].size + " | Роздають: " + toloka[i].seeders + " | Завантажують: " + toloka[i].leechers;

                        inline[i].ThumbUrl = toloka[i].link;
                    }

                    await bot.AnswerInlineQueryAsync(iqea.InlineQuery.Id, inline);
                }
            };

            bot.OnMessage += async(object updobj, MessageEventArgs mea) =>
            {
                var message = mea.Message;

                if (mea.Message.Type == MessageType.Text)
                {
                    if (message.Text == null)
                    {
                        return;
                    }

                    var ChatId = message.Chat.Id;

                    string command = message.Text.ToLower().Replace("@hurtombot", "").Replace("/", "");

                    switch (command)
                    {
                    case "start":
                        await bot.SendTextMessageAsync(ChatId, "Вітаю! Я @HurtomBot!\nНапишіть, що ви хочете знайти на Гуртом, і я знайду для вас українські торренти.\nНатисніть '/', щоби обрати команду.");

                        break;

                    case "sendtorrent":
                        await bot.SendTextMessageAsync(ChatId, "Оберіть чат, до якого хочете надіслати торрент.", replyMarkup : new InlineKeyboardMarkup(new[] { InlineKeyboardButton.WithSwitchInlineQuery("Надіслати") }));

                        break;

                    default:
                        foreach (var torrent in new TolokaHurtom.Toloka(command).ToArray())
                        {
                            bot.SendTextMessageAsync(ChatId, $"<b>{torrent.title}</b>\n\n{torrent.size} | Роздають: {torrent.seeders} | Завантажують: {torrent.leechers}\n\n<i>{torrent.forum_parent} / {torrent.forum_name}</i>\n\n{torrent.link}", ParseMode.Html);
                        }
                        break;
                    }
                }
            };
        }
Пример #5
0
        private static async void HandleQuery(InlineQuery query)
        {
            var user = UserHelper.GetTelegramUser(Program.DB, null, query);

            if (user.Grounded)
            {
                Bot.AnswerInlineQueryAsync(query.Id, new InlineQueryResultBase[]
                {
                    new InlineQueryResultArticle("0", "Nope!", new InputTextMessageContent("I did bad things, and now I'm grounded from the bot."))
                    {
                        Description = "You are grounded...",
                    }
                }, 0, true);
                return;
            }
            Log.WriteLine("INLINE QUERY", LogLevel.Info, ConsoleColor.Cyan, "telegram.log");
            Log.WriteLine(user.Name + ": " + query.Query, LogLevel.Info, ConsoleColor.White, "telegram.log");
            var com     = GetParameters("/" + query.Query);
            var choices =
                Loader.Commands.Where(x => x.Key.DevOnly != true && x.Key.BotAdminOnly != true && x.Key.GroupAdminOnly != true & !x.Key.HideFromInline & !x.Key.DontSearchInline &&
                                      x.Key.Triggers.Any(t => t.ToLower().Contains(com[0].ToLower())) & !x.Key.DontSearchInline).ToList();

            choices.AddRange(Loader.Commands.Where(x => x.Key.DontSearchInline && x.Key.Triggers.Any(t => String.Equals(t, com[0], StringComparison.InvariantCultureIgnoreCase))));
            if (Program.LoadedSetting.TelegramDefaultAdminUserId == user.UserId)
            {
                choices.AddRange(Loader.Commands.Where(x => (x.Key.DevOnly || x.Key.BotAdminOnly) && x.Key.AllowInlineAdmin && x.Key.Triggers.Any(t => t == com[0])));
            }
            if (user.IsBotAdmin)
            {
                choices.AddRange(Loader.Commands.Where(x => x.Key.BotAdminOnly && x.Key.AllowInlineAdmin && x.Key.Triggers.Any(t => t == com[0])));
            }

            var results = new List <InlineQueryResultBase>();

            foreach (var c in choices)
            {
                var response = c.Value.Invoke(new CommandEventArgs
                {
                    SourceUser       = user,
                    DatabaseInstance = Program.DB,
                    Parameters       = com[1],
                    Target           = "",
                    Messenger        = Program.Messenger,
                    Bot     = Bot,
                    Message = null
                });



                var title       = c.Key.Triggers[0];
                var description = c.Key.HelpText;
                if (query.Query.Split(' ').Length > 1 || c.Key.DontSearchInline || c.Key.Triggers.Any(x => String.Equals(x, com[0], StringComparison.InvariantCultureIgnoreCase)))
                {
                    description = response.ImageDescription ?? description;
                    title       = response.ImageTitle ?? title;
                }


                results.Add(new InlineQueryResultArticle(Loader.Commands.ToList().IndexOf(c).ToString(), title, new InputTextMessageContent(response.Text)
                {
                    DisableWebPagePreview = false,
                    ParseMode             = response.ParseMode
                })
                {
                    Description = description,
                    Title       = title,
                    ThumbUrl    = response.ImageUrl,
                    Url         = response.ImageUrl,
                    HideUrl     = true
                });
            }
            var menu = results.ToArray();

            try
            {
                await Bot.AnswerInlineQueryAsync(query.Id, menu, 0, true);
            }
            catch (AggregateException e)
            {
                Console.WriteLine(e.InnerExceptions[0].Message);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
        async void inlineQuery(TelegramBotClient Bot, InlineQueryEventArgs iqea)
        {
            await Bot.AnswerInlineQueryAsync(iqea.InlineQuery.Id, new InlineQueryResultVoice[]
            {
                new InlineQueryResultVoice("0",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152630&authkey=ANEl5SuhOYpHpJk",
                                           "Cheeki breeki radio"),

                new InlineQueryResultVoice("1",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152934&authkey=AIgJ96vtXRW-VuQ",
                                           "Anuu cheeki breeki i v damke"),

                new InlineQueryResultVoice("2",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152933&authkey=ADNsV2n4PTAiCLM",
                                           "Mliaa ia masleenu poimal"),

                new InlineQueryResultVoice("3",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152932&authkey=ABCFW63kzL2ndg0",
                                           "Ia dyriavyj"),

                new InlineQueryResultVoice("4",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152931&authkey=ANrToz9xGca6CLQ",
                                           "Aii mliaa"),

                new InlineQueryResultVoice("5",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152960&authkey=ABsq02_kaeN5VfA",
                                           "Malacca"),

                new InlineQueryResultVoice("6",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152963&authkey=AGLstjZiSF4n6gI",
                                           "Eii aleen'"),

                new InlineQueryResultVoice("7",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152961&authkey=AMM4GrYP82jyYHc",
                                           "Kandeeha veselei"),

                new InlineQueryResultVoice("8",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152962&authkey=ALFiAEmgQg7qSCI",
                                           "Shelupoon'"),

                new InlineQueryResultVoice("9",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152969&authkey=AAr0FEWkEUDOtfg",
                                           "Ia ne poniav"),

                new InlineQueryResultVoice("10",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152968&authkey=ABaBUnrLVneYc84",
                                           "Ty kudy kydaiesh scooqa"),

                new InlineQueryResultVoice("11",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152967&authkey=ADvID-ferSydH9E",
                                           "Bushlat derevianyi"),

                new InlineQueryResultVoice("12",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152966&authkey=AMSVLMKu-_PDTiA",
                                           "Ty sho ofonarel"),

                new InlineQueryResultVoice("13",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152965&authkey=ANPtGVyVz3uAJfc",
                                           "Nu ty j looh"),

                new InlineQueryResultVoice("14",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152973&authkey=AMVgs1cIdeMTKVc",
                                           "Ia taschuus'"),

                new InlineQueryResultVoice("15",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152971&authkey=AG_6E7V_eCjvTwU",
                                           "Ty v nature plesen'"),

                new InlineQueryResultVoice("16",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152972&authkey=ANepo45Qw0Rj2l4",
                                           "Smeschno priam nymagu"),

                new InlineQueryResultVoice("17",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152975&authkey=AIU0UKqbL7YxNDo",
                                           "Loh pa zhyzni"),

                new InlineQueryResultVoice("18",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152982&authkey=ABxSHxbRaE_KwK4",
                                           "Karoche tipa ot cho"),

                new InlineQueryResultVoice("19",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152983&authkey=AAFG5aRkulmtcLg",
                                           "Scha scha ia zbaccaiu"),

                new InlineQueryResultVoice("20",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152976&authkey=AJPmBte1ulcW3qU",
                                           "Zhyrno zhyrno"),

                new InlineQueryResultVoice("21",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152980&authkey=AEREA5EjXo7axss",
                                           "Aaa skateena"),

                new InlineQueryResultVoice("22",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152979&authkey=AHT_9gQt4MzoIOc",
                                           "Koresh meni zara ne do tiorok"),

                new InlineQueryResultVoice("23",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152978&authkey=ABd-uyT4Hha2_bE",
                                           "Ssysysh odvaly"),

                new InlineQueryResultVoice("24",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152977&authkey=AKh2S9tL8lOcpLQ",
                                           "Nie nu sho ty khlebalo rozkryv"),

                new InlineQueryResultVoice("25",
                                           "https://onedrive.live.com/download?cid=DC5D1991291792D2&resid=DC5D1991291792D2%2152981&authkey=AHRpYOyLnQsbRE8",
                                           "Raz dva vse dela")
            });
        }
Пример #7
0
        public GoogleSpeechUkrBot(string TelegramApiToken, string ConnectionString)
        {
            var userSettings = new UserSettings(ConnectionString);

            bot = new TelegramBotClient(TelegramApiToken);

            bot.SetWebhookAsync("");

            bot.OnInlineQuery += async(object updobj, InlineQueryEventArgs iqea) =>
            {
                try
                {
                    if (string.IsNullOrEmpty(iqea.InlineQuery.Query) || string.IsNullOrWhiteSpace(iqea.InlineQuery.Query))
                    {
                        return;
                    }

                    var url = new GoogleTTS.gTTS(iqea.InlineQuery.Query, URLonly: true).URL;

                    if (!string.IsNullOrEmpty(url))
                    {
                        var inline = new InlineQueryResultVoice[]
                        {
                            new InlineQueryResultVoice("0", url, iqea.InlineQuery.Query)
                        };

                        await bot.AnswerInlineQueryAsync(iqea.InlineQuery.Id, inline);
                    }
                }
                catch (Exception ex)
                {
                    return;
                }
            };

            bot.OnMessage += async(object updobj, MessageEventArgs mea) =>
            {
                var message = mea.Message;

                if (message.Type == MessageType.Voice && userSettings.GetVoice(message.Chat.Id))
                {
                    try
                    {
                        var gSTT = new GoogleSTT.gSTT($"https://api.telegram.org/file/bot{TelegramApiToken}/{bot.GetFileAsync(message.Voice.FileId).Result.FilePath}");
                        await bot.SendTextMessageAsync(message.Chat.Id, gSTT.Result, replyToMessageId : message.MessageId);
                    }
                    catch (Exception ex)
                    {
                        await bot.SendTextMessageAsync(message.Chat.Id, $"Не вдалося розпізнати повідомлення. Помилка: {ex.Message}", replyToMessageId : message.MessageId);
                    }
                }
                else if (mea.Message.Type == MessageType.Text)
                {
                    if (message.Text == null)
                    {
                        return;
                    }

                    var ChatId = message.Chat.Id;

                    var command = message.Text.ToLower().Replace("@googlespeechukrbot", "").Replace("/", "");

                    switch (command)
                    {
                    case "start":
                        await bot.SendTextMessageAsync(ChatId, "Вітаю! Я @GoogleSpeechUkrBot!\nНадішліть мені текстове повідомлення, щоб синтезувати голосове повідомлення, або надішліть голосове повідомлення, щоб розпізнати мовлення.\nНатисніть '/', щоби обрати команду.");

                        break;

                    case "sendvoice":
                        await bot.SendTextMessageAsync(ChatId, "Оберіть чат, до якого хочете надіслати голосове повідомлення.", replyMarkup : new InlineKeyboardMarkup(new[] { InlineKeyboardButton.WithSwitchInlineQuery("Надіслати") }));

                        break;

                    case "voiceon":
                        userSettings.ManageVoice(ChatId, true);
                        await bot.SendTextMessageAsync(message.Chat.Id, "Увімкнено розпізнавання мовлення у цьому чаті.", replyToMessageId : message.MessageId);

                        break;

                    case "voiceoff":
                        userSettings.ManageVoice(ChatId, false);
                        await bot.SendTextMessageAsync(message.Chat.Id, "Вимкнено розпізнавання мовлення у цьому чаті.", replyToMessageId : message.MessageId);

                        break;

                    case "texton":
                        userSettings.ManageText(ChatId, true);
                        await bot.SendTextMessageAsync(message.Chat.Id, "Увімкнено синтез мовлення у цьому чаті.", replyToMessageId : message.MessageId);

                        break;

                    case "textoff":
                        userSettings.ManageText(ChatId, false);
                        await bot.SendTextMessageAsync(message.Chat.Id, "Вимкнено синтез мовлення у цьому чаті.", replyToMessageId : message.MessageId);

                        break;

                    default:
                        if (userSettings.GetText(message.Chat.Id))
                        {
                            try
                            {
                                await bot.SendVoiceAsync(ChatId, new InputFileStream(new MemoryStream(new GoogleTTS.gTTS(command).ToByteArray())).Content, replyToMessageId : message.MessageId);
                            }
                            catch
                            {
                                await bot.SendTextMessageAsync(message.Chat.Id, "Під час синтезу мовлення виникла помилка.", replyToMessageId : message.MessageId);
                            }
                        }
                        break;
                    }
                }
            };
        }
Пример #8
0
 private static async void BotOnInlineQueryReceived(object sender, InlineQueryEventArgs inlineQueryEventArgs)
 {
     Console.WriteLine($"Received inline query from: {inlineQueryEventArgs.InlineQuery.From.Id}");
     await Bot.AnswerInlineQueryAsync(inlineQueryEventArgs.InlineQuery.Id, null, isPersonal : true, cacheTime : 0);
 }
Пример #9
0
        private static void HandleQuery(InlineQuery query)
        {
            var user = UserHelper.GetTelegramUser(Program.DB, null, query);

            if (user.Grounded)
            {
                Bot.AnswerInlineQueryAsync(query.Id, new InlineQueryResult[]
                {
                    new InlineQueryResultArticle()
                    {
                        Description         = "You are grounded...",
                        Id                  = "0",
                        Title               = "Nope!",
                        InputMessageContent = new InputTextMessageContent
                        {
                            DisableWebPagePreview = true,
                            MessageText           = "I did bad things, and now I'm grounded from the bot."
                        }
                    }
                }, 0, true);
                return;
            }
            Log.WriteLine("INLINE QUERY", LogLevel.Info, ConsoleColor.Cyan, "telegram.log");
            Log.WriteLine(user.Name + ": " + query.Query, LogLevel.Info, ConsoleColor.White, "telegram.log");
            var com     = GetParameters("/" + query.Query);
            var choices =
                Loader.Commands.Where(x => x.Key.DevOnly != true && x.Key.BotAdminOnly != true && x.Key.GroupAdminOnly != true & !x.Key.HideFromInline & !x.Key.DontSearchInline &&
                                      x.Key.Triggers.Any(t => t.ToLower().Contains(com[0].ToLower())) & !x.Key.DontSearchInline).ToList();

            choices.AddRange(Loader.Commands.Where(x => x.Key.DontSearchInline && x.Key.Triggers.Any(t => String.Equals(t, com[0], StringComparison.InvariantCultureIgnoreCase))));
            var results = new List <InlineQueryResultArticle>();

            foreach (var c in choices)
            {
                var response = c.Value.Invoke(new CommandEventArgs
                {
                    SourceUser       = user,
                    DatabaseInstance = Program.DB,
                    Parameters       = com[1],
                    Target           = "",
                    Messenger        = Program.Messenger,
                    Bot     = Bot,
                    Message = null
                });
                results.Add(new InlineQueryResultArticle()
                {
                    Description         = c.Key.HelpText,
                    Id                  = Loader.Commands.ToList().IndexOf(c).ToString(),
                    Title               = c.Key.Triggers[0],
                    InputMessageContent = new InputTextMessageContent
                    {
                        DisableWebPagePreview = true,
                        MessageText           = response.Text,
                        ParseMode             = response.ParseMode
                    }
                });
            }
            var menu = results.Cast <InlineQueryResult>().ToArray();

            Bot.AnswerInlineQueryAsync(query.Id, menu, 0, true);
        }
Пример #10
0
        private async void OnInlineQuery(object sender, InlineQueryEventArgs e)
        {
            try
            {
                long MsgId = Interlocked.Increment(ref Identifier) * MusicHandler.MaxQueued;

                var Results = new List <InlineQueryResult>();
                InlineQueryResultVideo Result;

                int i = 0;

                if (e.InlineQuery.Query == "remove")
                {
                    while (i < MusicHandler.MaxQueued)
                    {
                        Result                     = Result = new InlineQueryResultVideo();
                        Result.Id                  = (MsgId + i++).ToString();
                        Result.Title               = "Remove Song";
                        Result.Description         = $"#{i}";
                        Result.ThumbUrl            = "https://github.com/google/material-design-icons/blob/master/av/2x_web/ic_note_black_48dp.png?raw=true";
                        Result.MimeType            = "text/html";
                        Result.Url                 = Result.ThumbUrl;
                        Result.InputMessageContent = new InputTextMessageContent();
                        ((InputTextMessageContent)Result.InputMessageContent).MessageText = $"/remove{Mention} [{MsgId}] {i}";
                        Result.ReplyMarkup = IKM("Loading..", "", "/");

                        Results.Add(Result);
                    }
                }
                else
                {
                    foreach (var Key in new string[] { "skip", "repeat" })
                    {
                        if (Key.StartsWith(e.InlineQuery.Query))
                        {
                            Result                     = Result = new InlineQueryResultVideo();
                            Result.Id                  = (MsgId + i++).ToString();
                            Result.Title               = "Use command";
                            Result.Description         = Key;
                            Result.ThumbUrl            = "https://github.com/google/material-design-icons/blob/master/av/2x_web/ic_note_black_48dp.png?raw=true";
                            Result.MimeType            = "text/html";
                            Result.Url                 = Result.ThumbUrl;
                            Result.InputMessageContent = new InputTextMessageContent();
                            ((InputTextMessageContent)Result.InputMessageContent).MessageText = $"/{Key}{Mention} [{MsgId}]";
                            Result.ReplyMarkup = IKM("Loading..", "", "/");

                            Results.Add(Result);
                        }
                    }

                    var Loading = new InlineKeyboardMarkup();
                    Loading.InlineKeyboard                    = new InlineKeyboardButton[][] { new[] { new InlineKeyboardButton() } };
                    Loading.InlineKeyboard[0][0].Text         = "Loading..";
                    Loading.InlineKeyboard[0][0].CallbackData = "/";

                    var Files = SongData.Search(e.InlineQuery.Query, 25);

                    foreach (var SearchResult in Files)
                    {
                        Results.Add(new InlineQueryResultVideo
                        {
                            Id       = (MsgId + i++).ToString(),
                            Url      = "http://music.botnets.me",
                            MimeType = "text/html",

                            ThumbUrl            = (SearchResult.Thumbnail != null && SearchResult.Thumbnail != string.Empty) ? SearchResult.Thumbnail : "https://github.com/google/material-design-icons/blob/master/av/2x_web/ic_note_black_48dp.png?raw=true",
                            Title               = SearchResult.FullName,
                            InputMessageContent = new InputTextMessageContent
                            {
                                MessageText = $"/add{Mention} [{MsgId}] {(SearchResult.Type == SongType.Local ? SearchResult.FullName : SearchResult.Url)}"
                            },
                            ReplyMarkup = Loading
                        });
                    }
                }

                await Client.AnswerInlineQueryAsync(e.InlineQuery.Id, Results.ToArray(), 0);
            }
            catch (Exception Ex)
            {
                Bot.Log(Ex);
            }
        }