问题
I have create one api for sending multiple videos at the same time in a loop with telegram bot using c#.
I am also getting success for uploading videos on telegram bot.
However, I am facing one issue on this task. Right now I am uploading 1 or 2 videos at the same time in the loop and it's works. But when I try with 10 or more videos, only 2 or 3 videos get uploaded successfully, and suddenly my utility stops.
It would be very helpful if someone could identify my mistake in the following code. I am not getting any errors any but my all the videos don't get uploaded and utility stops.
Here this is my code:
public async Task SendCasesOnTelegramBot()
{
DataSet ds = DataAccess.ExecuteDataset(Setting.ConnectionString(), "GetPostForTelegramBot");
if (ds != null && ds.Tables.Count > 0)
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
string VideoUrl = null;
VideoUrl = CaseMediaPath + ds.Tables[0].Rows[i]["Url"].ToString();
var sb = new StringBuilder();
sb.Append("abc");
await Bot.SendVideoAsync("@abc", video: VideoUrl, caption: sb.ToString(), replyMarkup: ReplyMarkup);
await Task.Delay(180000); // i am also try like this but not getting success
}
}
}
This is my API, it works very well but only for a few videos.
来源:https://stackoverflow.com/questions/46148978/send-multiple-videos-at-the-same-time-on-telegram-bot-using-c