Exemplo n.º 1
0
    public async Task AutomaticMysqlBackup()
    {
        var dataBackupInfo = await BackupMySqlDatabase();

        var fullNameZip   = dataBackupInfo.FullNameZip;
        var fileNameZip   = dataBackupInfo.FileNameZip;
        var channelTarget = _eventLogConfig.ChannelId;

        var caption = HtmlMessage.Empty
                      .Bold("File Size: ").CodeBr($"{dataBackupInfo.FileSizeSql}")
                      .Bold("Zip Size: ").CodeBr($"{dataBackupInfo.FileSizeSqlZip}")
                      .Text("#mysql #auto #backup");

        await using var fileStream = File.OpenRead(fullNameZip);

        var media = new InputOnlineFile(fileStream, fileNameZip)
        {
            FileName = fileNameZip
        };

        await _botClient.SendDocumentAsync(
            chatId : channelTarget,
            document : media,
            caption : caption.ToString(),
            parseMode : ParseMode.Html
            );
    }
        public async Task SendResult(object sender, CaptureResponseEventArgs e)
        {
            if (e == null)
            {
                Logger.Warn("result is null, ignoring");
                return;
            }

            var message = e.Request.RequestContext as Message;

            if (message == null)
            {
                Logger.Error("Returned RequestContext is not a valid Telegram UserRequest object");
                return;
            }

            if (e.Attachments != null)
            {
                foreach (var filePath in e.Attachments)
                {
                    using (var fs = File.OpenRead(filePath))
                    {
                        var trial    = 0;
                        var succeed  = false;
                        var fileName = Path.GetFileName(filePath);
                        while (!succeed && trial < MaxUploadRetries)
                        {
                            try
                            {
                                Logger.Debug($"(retry {trial}/{MaxUploadRetries}) Uploading file \"{fileName}\"");
                                var inputOnlineFile = new InputOnlineFile(fs, fileName);
                                await _bot.SendDocumentAsync(message.Chat, inputOnlineFile,
                                                             replyToMessageId : message.MessageId);

                                succeed = true;
                            }
                            catch (ApiRequestException)
                            {
                                Logger.Warn("Telegram API timeout");
                                trial += 1;
                            }
                        }

                        if (!succeed)
                        {
                            Logger.Error("Unable to upload file \"{fileName}\"");
                            e.StatusText += "Unable to upload file \"{fileName}\".\n";
                        }
                    }
                }
            }

            Logger.Debug("Sending session information");
            await _bot.SendTextMessageAsync(
                message.Chat,
                $"<pre>{e}</pre>",
                replyToMessageId : message.MessageId,
                parseMode : ParseMode.Html
                );
        }
Exemplo n.º 3
0
        public override async Task Execute(Message message, ITelegramBotClient client)
        {
            string url = await GetImage(message);

            var image = new InputOnlineFile(new Uri(url));
            await client.SendPhotoAsync(message.Chat.Id, image);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new request with sticker and position
 /// </summary>
 /// <param name="name">Sticker set name</param>
 /// <param name="userId">User identifier of the sticker set owner</param>
 /// <param name="thumb">A PNG image or a TGS animation with the thumbnail</param>
 public SetStickerSetThumbRequest(string name, long userId, InputOnlineFile thumb = default)
     : base("setStickerSetThumb")
 {
     Name   = name;
     UserId = userId;
     Thumb  = thumb;
 }
        /// <summary>
        /// Sends an video
        /// </summary>
        /// <param name="file"></param>
        /// <param name="buttons"></param>
        /// <param name="replyTo"></param>
        /// <param name="disableNotification"></param>
        /// <returns></returns>
        public async Task <Message> SendVideo(InputOnlineFile file, ButtonForm buttons = null, int replyTo = 0, bool disableNotification = false, ParseMode parseMode = ParseMode.Default)
        {
            if (this.ActiveForm == null)
            {
                return(null);
            }

            InlineKeyboardMarkup markup = buttons;

            Message m = null;

            try
            {
                m = await this.Client.TelegramClient.SendVideoAsync(this.DeviceId, file, parseMode : parseMode, replyToMessageId : replyTo, replyMarkup : markup, disableNotification : disableNotification);

                OnMessageSent(new MessageSentEventArgs(m));
            }
            catch (ApiRequestException)
            {
                return(null);
            }
            catch
            {
                return(null);
            }

            return(m);
        }
Exemplo n.º 6
0
        protected async void imageReceived(RedisChannel channel, RedisValue message)
        {
            // InputOnlineFile iof = new InputOnlineFile();
            if (_chat_Id.HasValue && message.HasValue)
            {
                var imageUrl = _alarmConfig.ImageBaseURL + message.ToString();
                try
                {
                    using (WebClient wc = new WebClient())
                    {
                        byte[] data = wc.DownloadData(imageUrl);
                        using (MemoryStream ms = new MemoryStream(data))
                        {
                            InputOnlineFile iof = new InputOnlineFile(ms, message.ToString());

                            await _botClient.SendPhotoAsync(
                                chatId : _chat_Id.Value,
                                photo : iof);
                        }
                    }
                } catch (Exception ex)
                {
                    _logger.LogError(ex, "Error sending photo to Telegram bot.");
                }
            }
        }
        protected override async Task CustomHandle(Message message)
        {
            var textForDocument = string.Empty;

            if (message.Text != null)
            {
                textForDocument = message.Text;
            }
            else if (message.Photo != null)
            {
                foreach (var photo in message.Photo)
                {
                    MemoryStream photoStream = new MemoryStream();
                    var          file        = await BotClient.GetInfoAndDownloadFileAsync(photo.FileId, photoStream);

                    textForDocument += await _imagesRecognitionService.RecognizeFromFile(photoStream.ToArray());
                }
            }
            else if (message.Voice != null)
            {
                MemoryStream voiceStream = new MemoryStream();
                var          file        = await BotClient.GetInfoAndDownloadFileAsync(message.Voice.FileId, voiceStream);

                textForDocument = await _voiceRecognitionService.RecognizeFromFile(voiceStream.ToArray());
            }

            var documentStream = _documentGenerator.GenerateFromText(textForDocument);

            var bytes    = documentStream.ToArray();
            var document = new InputOnlineFile(new MemoryStream(bytes), "Your document" + _documentGenerator.Extension);

            await BotClient.SendTextMessageAsync(message.Chat.Id, "Your file:");

            await BotClient.SendDocumentAsync(message.Chat.Id, document);
        }
Exemplo n.º 8
0
 public Task AddStickerToSetAsync(
     int userId,
     string name,
     InputOnlineFile pngSticker,
     string emojis,
     MaskPosition maskPosition           = null,
     CancellationToken cancellationToken = new CancellationToken()) => throw new NotImplementedException();
        public static async Task ClearLog()
        {
            const string logsPath      = "Storage/Logs";
            var          botClient     = Bot.Client;
            var          channelTarget = Bot.GlobalConfiguration["CommonConfig:ChannelLogs"].ToInt64();

            var dirInfo       = new DirectoryInfo(logsPath);
            var files         = dirInfo.GetFiles();
            var filteredFiles = files.Where(fileInfo => fileInfo.CreationTimeUtc < DateTime.UtcNow.AddDays(-1)).ToArray();

            if (filteredFiles.Length > 0)
            {
                Log.Information($"Found {filteredFiles.Length} of {files.Length}");
                foreach (var fileInfo in filteredFiles)
                {
                    var filePath = fileInfo.FullName;
                    Log.Information($"Uploading file {filePath}");
                    var fileStream = File.OpenRead(filePath);

                    var media = new InputOnlineFile(fileStream, fileInfo.Name);
                    await botClient.SendDocumentAsync(channelTarget, media);

                    filePath.DeleteFile();
                }
            }
            else
            {
                Log.Information("No Logs file need be processed for previous date");
            }
        }
Exemplo n.º 10
0
        public static async Task SendDefaultResources(long chatId)
        {
            using var fs = new FileStream("default-resources.zip", FileMode.Open);
            InputOnlineFile inputFile = new InputOnlineFile(fs, "default-resources.zip");

            await CheckAndSendAsync(chatId, inputFile);
        }
Exemplo n.º 11
0
 public Task <Message> SendStickerAsync(
     ChatId chatId,
     InputOnlineFile sticker,
     bool disableNotification            = false,
     int replyToMessageId                = 0,
     IReplyMarkup replyMarkup            = null,
     CancellationToken cancellationToken = new CancellationToken()) => throw new NotImplementedException();
Exemplo n.º 12
0
        public async void Bot_OnMessage(object sender, MessageEventArgs e)
        {
            if (e.Message.Text != null)
            {
                Console.WriteLine($"Received a text message in chat {e.Message.Chat.Id}.");


                if (e.Message.Text == "kek")
                {
                    var randomFile = _thingsToSay[new Random().Next(0, _thingsToSay.Count - 1)];
                    using (var voiceStream = randomFile.OpenRead())
                    {
                        InputOnlineFile voiceToSend = new InputOnlineFile(voiceStream);

                        await _botClient.SendVoiceAsync(
                            chatId : e.Message.Chat,
                            voice : voiceToSend
                            );
                    }
                }
                else
                {
                    await _botClient.SendTextMessageAsync(
                        chatId : e.Message.Chat,
                        text : "You sent:\n" + e.Message.Text + " Send 'kek' for sound"
                        );
                }
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Send voice message (or just audio file if it's not vorbis ogg)
        /// </summary>
        /// <param name="audio">Audio to send</param>
        /// <param name="chatId">Chat ID to send photo to</param>
        /// <param name="caption"></param>
        /// <param name="parseMode"></param>
        /// <param name="replyToId"></param>
        /// <param name="duration"></param>
        public static async Task <Message> SendVoice(InputOnlineFile audio, long chatId, string caption = null, ParseMode?parseMode = null, int replyToId = 0, int duration = 0)
        {
            SentrySdk.ConfigureScope(scope =>
            {
                scope.Contexts["Data"] = new
                {
                    Audio     = audio,
                    Duration  = duration,
                    ChatID    = chatId,
                    Message   = caption,
                    ParseMode = parseMode,
                    ReplyID   = replyToId
                };
            });

            try
            {
                return(await api.SendVoiceAsync(chatId, audio, caption, parseMode,
                                                duration : duration,
                                                replyToMessageId : replyToId));
            }
            catch (Exception ex)
            {
                Log.Error(ex.InnerMessageIfAny());
            }
            return(null);
        }
Exemplo n.º 14
0
        public async Task <InlineQueryResultBase> TrySendPhoto(Stream stream, string input, string stringFormat)
        {
            var telegramFile = new InputOnlineFile(stream);

            try
            {
                var sendRendered = await BotClient.SendPhotoAsync(BotConfig.PhotoStorageChatId, telegramFile);

                return(new InlineQueryResultCachedPhoto(
                           id: "0",
                           photoFileId: sendRendered.Photo[0].FileId
                           ));
            }
            catch
            {
                InlineQueryResultArticle result = new(
                    id : "0",
                    title : "String result (cannot render to image)",
                    inputMessageContent : new InputTextMessageContent("Input \n" + input + "\n\nOutput \n" + stringFormat)
                    )
                { Description = stringFormat };

                return(result);
            }
        }
    }
Exemplo n.º 15
0
        public async override Task SendMusicMessage(long id, string text, MusicInfo musicInfo, KeyboardTypes keyboardType)
        {
            // FileStream file = new FileStream(@"D:\file4.ogg", FileAccess.Read);
            Console.WriteLine("SendMusicMessage-1");

            Console.WriteLine("SendMusicMessage-2");

            Console.WriteLine("SendMusicMessage-3");
            switch (keyboardType)
            {
            case KeyboardTypes.MainKeyboard:
                await client.SendTextMessageAsync(id, text, replyMarkup : KeyboardBuilder.GetMainTypeKeyboard());

                break;

            case KeyboardTypes.KeyboardSelection:
                var             stream    = new FileStream(musicInfo.fileLocation, FileMode.Open);
                InputOnlineFile inputFile = new InputOnlineFile(stream);
                Console.WriteLine("SendMusicMessage-4");
                await client.SendVoiceAsync(id, inputFile);

                Console.WriteLine("SendMusicMessage-5");
                await client.SendTextMessageAsync(id, text, replyMarkup : KeyboardBuilder.GetKeyboardSelection());

                Console.WriteLine("SendMusicMessage-6");
                stream.Close();
                break;

            default:
                await client.SendTextMessageAsync(id, text);

                break;
            }
        }
        /// <summary>
        /// Get Affiliate report sell after successfully authenticated
        /// </summary>
        /// <param name="userAuth"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        private async Task GetData(Update up, FilterDate filterDate)
        {
            List <AffiliateReportDto> list = new List <AffiliateReportDto>();
            //if sender pm is admin? can get all affiliate sell report else affiliate only get their report

            var userAuth = GetUserByChatId(up.Message.Chat.Id);

            if (userAuth == null)
            {
                await LogOutUser(up);

                return;
            }

            try
            {
                var affiliateReportFile = await GetAffiliateReportApi(filterDate.ToString(), userAuth.UserType, userAuth.UserName);

                var inputOnlineFile = new InputOnlineFile(affiliateReportFile, "AffiliateSellReport.pdf");

                var message = await _botService.Client.SendTextMessageAsync(up.Message.Chat.Id, "Sending file...");

                await _botService.Client.SendDocumentAsync(up.Message.Chat.Id, inputOnlineFile);

                await _botService.Client.DeleteMessageAsync(up.Message.Chat.Id, message.MessageId);
            }
            catch (Exception ex)
            {
                await InvalidLogin(up, "❌ Invalid Login. " + ex.Message);
                await LogOutUser(up);
            }
        }
Exemplo n.º 17
0
        public static void Events(Message m, string[] args)
        {
            using (var db = new DFW.Furs.Database.DFWDbContext())
            {
                var nEvent  = db.EventDescriptions.Include("Events").FirstOrDefault();
                var caption = BuildCaption(nEvent);

                var buttons = new[]
                {
                    new InlineKeyboardButton {
                        CallbackData = $"events|{nEvent.Id}|prev", Text = "Previous"
                    },
                    new InlineKeyboardButton {
                        CallbackData = $"events|{nEvent.Id}|next", Text = "Next"
                    }
                };

                var menu = new InlineKeyboardMarkup(buttons);


                if (nEvent.Photo != null)
                {
                    using (var fs = new FileStream(Environment.CurrentDirectory + "/wwwroot/images/events/" + nEvent.Photo, FileMode.Open))
                    {
                        var file   = new InputOnlineFile(fs);
                        var result = Bot.Client.SendPhotoAsync(m.Chat.Id, file, caption, replyMarkup: menu).Result;
                    }
                }
                else
                {
                    Bot.Send(caption, m.Chat.Id, customMenu: menu);
                }
            }
        }
Exemplo n.º 18
0
        public async static Task SendChart(CallbackQuery callback, TelegramBotClient client)
        {
            try
            {
                double[] Elements = { 1, 2, 3, 3, 4, 5, 6, 8, 4, 7, 8, 9, 6, 3, 3, 1, 2, 5, 4 };
                Chart    chart    = new Chart();
                SMoDALib.StatisticCharts.BuildChartRelFreqPoligonFreq(Elements, chart);
                string path = HostingEnvironment.ApplicationPhysicalPath + String.Format("chartimagewg{0}.png", callback.Message.Chat.Id);

                var s = new System.IO.FileStream(path, System.IO.FileMode.OpenOrCreate);
                chart.SaveImage(s, ChartImageFormat.Png);
                s.Close();
                using (var stream = System.IO.File.Open(path, System.IO.FileMode.Open))
                {
                    InputOnlineFile iof = new InputOnlineFile(stream);
                    iof.FileName = "Chart.png";
                    var send = await client.SendDocumentAsync(callback.Message.Chat.Id, iof, "Chart");

                    stream.Close();
                    System.IO.File.Delete(path);
                }
            }
            catch (Exception ex)
            {
                Exception exc = ex;
                string    s   = ex.Message;
                await client.SendTextMessageAsync(chatId : callback.Message.Chat.Id, text : s);
            }
        }
Exemplo n.º 19
0
        private static async Task RetrySendDocument(FileInfo file, int fileIndex, MessageCategory messageCategory)
        {
            try
            {
                Bot = new TelegramBotClient(ApiToken);
                var me = Bot.GetMeAsync().Result;
                //Bot.StopReceiving();
                Bot.StartReceiving();
                var retryStream = File.Open(file.FullName, FileMode.Open, FileAccess.Read, FileShare.Read);
                var fts         = new InputOnlineFile(retryStream);

                fts.FileName = file.FullName.Split('\\').Last();
                var title = fts.FileName + Environment.NewLine + "#" + messageCategory;
                title += Environment.NewLine + "#" + messageCategory + "No" + fileIndex;
                Thread.Sleep(5000);
                var result = await Bot.SendDocumentAsync(ChatId, fts, title);

                Utility.AppendToJsonFile(result, messageCategory);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Retry failed with messag:{ex.Message}. trying again...");
                await RetrySendDocument(file, fileIndex, messageCategory);
            }
        }
Exemplo n.º 20
0
        private static async Task RetrySendAudio(FileInfo file, int k, TimeSpan duration, MessageCategory messageCategory)
        {
            try
            {
                Bot = new TelegramBotClient(ApiToken);
                var me = Bot.GetMeAsync().Result;
                //Bot.StopReceiving();
                Bot.StartReceiving();
                Thread.Sleep(5000);
                var retryStream = File.Open(file.FullName, FileMode.Open, FileAccess.Read, FileShare.Read);
                var fts         = new InputOnlineFile(retryStream);
                fts.FileName = file.FullName.Split('\\').Last();
                var title = fts.FileName + Environment.NewLine + "#" + messageCategory;
                title += Environment.NewLine + "#" + messageCategory + "No" + k;

                var result = await Bot.SendAudioAsync(ChatId, fts, duration : Convert.ToInt32(Math.Truncate(duration.TotalSeconds)), caption : fts.FileName, title : title);

                Utility.AppendToJsonFile(result, messageCategory);
            }
            catch (Exception ex)
            {
                Console.Write($"retry failed with message:{ex.Message}. retrying again ...");
                await RetrySendAudio(file, k, duration, messageCategory);
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// Кнопка отправки файлов
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void ButtonSendFile_Click(object sender, RoutedEventArgs e)
        {
            if (idBox.Text != string.Empty)
            {
                OpenFileDialog ofd = new OpenFileDialog();

                Nullable <bool> result = ofd.ShowDialog();
                string          path   = ofd.FileName;

                if (result == true)
                {
                    using (BufferedStream bs2 = new BufferedStream(File.OpenRead(path)))
                    {
                        InputOnlineFile iof = new InputOnlineFile(bs2, new FileInfo(path).Name);
                        await bot.TelegramBot.SendDocumentAsync(chatId : long.Parse(idBox.Text),
                                                                document : iof,
                                                                caption : "Ваш файл");
                    }
                }
            }
            else
            {
                MessageBox.Show("Не выбран пользователь");
            }
        }
Exemplo n.º 22
0
        private static void SendAudioToChannel()
        {
            DirectoryInfo d = new DirectoryInfo(AudioFilesPath);

            FileInfo[] Files = d.GetFiles("*.mp3");
            foreach (FileInfo audioFile in Files)
            {
                var      filePath = AudioFilesPath + "\\" + audioFile.Name;
                string   fileExt  = Path.GetExtension(filePath);
                TimeSpan duration = new TimeSpan();
                if (fileExt == ".mp3")
                {
                    //Use NAudio to get the duration of the File as a TimeSpan object
                    duration = new Mp3FileReader(filePath).TotalTime;
                }

                using (var stream = File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    InputOnlineFile file = new InputOnlineFile(stream);
                    file.FileName = filePath.Split('\\').Last();

                    var test =
                        Bot.SendAudioAsync(ChatId, file, file.FileName, duration: duration.Seconds)
                        .GetAwaiter()
                        .GetResult();
                }
            }
        }
Exemplo n.º 23
0
        private async Task ShowResultValue(Shared.Models.CallMethodResultInfo <OperationContext> callMethodResultInfo, MethodInfo methodInfo, TelegramClientInfo clientInfo, Message message)
        {
            clientInfo.CurrentParameterName = null;
            List <List <BotButtonInfo> > buttons = GetMethodParametersButtons(methodInfo, clientInfo);

            CurrentBotStructureInfo.OnButtonsGenerating(buttons, BotLevelType.Parameters, clientInfo.CurrentServiceName, clientInfo.CurrentMethodName, clientInfo);
            ReplyKeyboardMarkup replyMarkup = new ReplyKeyboardMarkup
            {
                Keyboard = BotButtonsToKeyboardButtons(buttons, clientInfo)
            };

            if (callMethodResultInfo.CallbackInfo.Data.Length > 4000)
            {
                using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(callMethodResultInfo.CallbackInfo.Data)))
                {
                    stream.Seek(0, SeekOrigin.Begin);
                    InputOnlineFile inputOnlineFile = new InputOnlineFile(stream);
                    inputOnlineFile.FileName = "reponse.txt";
                    await _botClient.SendDocumentAsync(
                        chatId : message.Chat,
                        document : inputOnlineFile,
                        caption : $"Response of {methodInfo.Name}",
                        replyMarkup : replyMarkup
                        );
                }
            }
            else
            {
                await _botClient.SendTextMessageAsync(
                    chatId : message.Chat,
                    text : callMethodResultInfo.CallbackInfo.Data,
                    replyMarkup : replyMarkup
                    );
            }
        }
Exemplo n.º 24
0
        public static async Task <Message> SendPhotoAsync(ChatId chatId, InputOnlineFile file, string caption = null,
                                                          ParseMode parse = ParseMode.Default, int replyId = 0)
        {
            try
            {
                Message message;
                await _bot.SendChatActionAsync(chatId, ChatAction.UploadPhoto);

                _log.Debug("SendPhotoAsync: {0}", chatId);

                if (caption?.Length > 200)
                {
                    message = await _botFile.SendPhotoAsync(chatId, file, replyToMessageId : replyId);

                    await _bot.SendTextMessageAsync(chatId, caption, parse, true, replyToMessageId : message.MessageId);
                }
                else
                {
                    message = await _botFile.SendPhotoAsync(chatId, file, caption, parse, replyToMessageId : replyId);
                }

                await _db.InsertMessageOutgoing(message);

                return(message);
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message);
                return(null);
            }
        }
Exemplo n.º 25
0
        public static async Task <Message> SendPhotoAsync(Message msg, InputOnlineFile file, string caption = null,
                                                          ParseMode parse = ParseMode.Default, bool reply = false)
        {
            var replyId = reply ? msg.MessageId : 0;

            return(await SendPhotoAsync(msg.Chat.Id, file, caption, parse, replyId));
        }
Exemplo n.º 26
0
        private void DocumentReceived(MessageEventArgs e, string filetoobig, out string fileName)
        {
            fileName = "";
            if (e.Message.Document.FileSize > 20_971_520)
            {
                // Отсылаем отправителю сообщение, что файл слишком большой
                // У себя это сообщение не храним, т.к. мы ничего не получили
                bot.SendTextMessageAsync(e.Message.Chat.Id, filetoobig);
                return;
            }
            else
            {
                DownloadFile(e.Message.Document.FileId, e.Message.Document.FileName);
                e.Message.Text = $"{e.Message.Document.FileName}\n" +
                                 $"Размер: {e.Message.Document.FileSize:##,# bytes}";

                // Пишем в ленту, что получили файл
                IncomingTextMessageProcessor(e);

                fileName = e.Message.Document.FileName;
                // Отсылаем файл назад
                var iof = new InputOnlineFile(e.Message.Document.FileId);
                bot.SendDocumentAsync(e.Message.Chat.Id, iof);
            }
        }
Exemplo n.º 27
0
 static async void Upload(string fileName, long id)
 {
     using (FileStream fs = System.IO.File.OpenRead(fileName))
     {
         InputOnlineFile inputOnlineFile = new InputOnlineFile(fs, fileName);
         await bot.SendDocumentAsync(id, inputOnlineFile);
     }
 }
 /// <summary>
 /// Initializes a new request with userId, name pngSticker and emojis
 /// </summary>
 /// <param name="userId">User identifier of sticker set owner</param>
 /// <param name="name">Sticker set name</param>
 /// <param name="pngSticker">Png image with the sticker</param>
 /// <param name="emojis">One or more emoji corresponding to the sticker</param>
 public AddStickerToSetRequest(long userId, string name, InputOnlineFile pngSticker, string emojis)
     : base("addStickerToSet")
 {
     UserId     = userId;
     Name       = name;
     PngSticker = pngSticker;
     Emojis     = emojis;
 }
Exemplo n.º 29
0
 public StickerWrapper(ChatId To, string InputMediaId, int inReplyOf) :
     base(To, "")
 {
     this.ChatID     = To;
     this._ChatID    = To.Identifier;
     this.inReplyOf  = inReplyOf;
     inputOnlineFile = new InputOnlineFile(InputMediaId);
 }
Exemplo n.º 30
0
 public void SendPost(byte[] message)
 {
     using (Stream stream = new MemoryStream(message))
     {
         InputOnlineFile file = new InputOnlineFile(stream);
         _client.SendPhotoAsync(_chat, file);
     }
 }