mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
fix: build and lots of obsolete warnings
This commit is contained in:
@@ -115,7 +115,7 @@ public class Store : CommonHandler
|
||||
catch (Exception)
|
||||
{
|
||||
answer = "Товар недоступен";
|
||||
await Bot.EditMessageTextAsync(Chat.Id,
|
||||
await Bot.EditMessageText(Chat.Id,
|
||||
messageId,
|
||||
$"<b>{From.ToHtml()} попытался купить \"{storeItem.Name}\", но товара в наличии не оказалось.",
|
||||
ParseMode.Html);
|
||||
@@ -124,7 +124,7 @@ public class Store : CommonHandler
|
||||
}
|
||||
|
||||
reputation = await _reputation.SetUserReputationAsync(Chat, From, reputation - storeItem.Price);
|
||||
await Bot.EditMessageTextAsync(Chat.Id,
|
||||
await Bot.EditMessageText(Chat.Id,
|
||||
messageId,
|
||||
$"<b>{From.ToHtml()} ({reputation})</b> купил \"{storeItem.Name}\".",
|
||||
ParseMode.Html);
|
||||
@@ -141,17 +141,17 @@ public class Store : CommonHandler
|
||||
switch (randomMedia.Type)
|
||||
{
|
||||
case InputMediaType.Photo:
|
||||
await Bot.SendPhotoAsync(Chat.Id, file,
|
||||
await Bot.SendVideo(Chat.Id, file,
|
||||
caption: randomMedia.Caption,
|
||||
replyToMessageId: messageId,
|
||||
replyParameters: messageId,
|
||||
parseMode: ParseMode.Html,
|
||||
hasSpoiler: randomMedia.Nsfw
|
||||
);
|
||||
break;
|
||||
case InputMediaType.Video:
|
||||
await Bot.SendVideoAsync(Chat.Id, file,
|
||||
await Bot.SendVideo(Chat.Id, file,
|
||||
caption: randomMedia.Caption,
|
||||
replyToMessageId: messageId,
|
||||
replyParameters: messageId,
|
||||
parseMode: ParseMode.Html,
|
||||
hasSpoiler: randomMedia.Nsfw
|
||||
);
|
||||
|
||||
@@ -5,14 +5,14 @@ namespace West.TelegramBot.ContentStore.Model;
|
||||
|
||||
public class RandomMedia
|
||||
{
|
||||
public RandomMedia(IInputFile file, string? caption = null, bool nsfw = false)
|
||||
public RandomMedia(InputFile file, string? caption = null, bool nsfw = false)
|
||||
{
|
||||
File = file;
|
||||
Caption = caption;
|
||||
Nsfw = nsfw;
|
||||
}
|
||||
|
||||
public IInputFile File;
|
||||
public InputFile File;
|
||||
public string? Caption;
|
||||
public bool Nsfw;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public class AnimBoobsService : AbstractNsfwService
|
||||
// https://bugs.telegram.org/c/23674 workaround
|
||||
var video = await _httpClient.GetStreamAsync($"https://westdev.me/_boobs/media/{fileName}");
|
||||
|
||||
return new RandomMedia(new InputFile(video, fileName))
|
||||
return new RandomMedia(new InputFileStream(video, fileName))
|
||||
{
|
||||
Type = InputMediaType.Video,
|
||||
Nsfw = true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Text.Json;
|
||||
using Telegram.Bot.Types;
|
||||
using West.TelegramBot.ContentStore.Model;
|
||||
|
||||
@@ -18,7 +18,7 @@ public abstract class AnimalAsAService : IRandomMediaService
|
||||
public async Task<RandomMedia> GetRandomMediaAsync(Chat chat, User user)
|
||||
{
|
||||
var resp = await _httpClient.GetAsync("images/search");
|
||||
var catImage = JsonConvert.DeserializeObject<List<AnimalImage>>(await resp.Content.ReadAsStringAsync())![0];
|
||||
var catImage = JsonSerializer.Deserialize<List<AnimalImage>>(await resp.Content.ReadAsStringAsync())![0];
|
||||
return new RandomMedia(new InputFileUrl(catImage.Url));
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public abstract class AbstractKittiesService : IRandomMediaService
|
||||
var response = await _api.GetKittiesImageAsync(VideoType);
|
||||
|
||||
return new RandomMedia(
|
||||
new InputFile(response.Content),
|
||||
new InputFileStream(response.Content),
|
||||
new HtmlString().Url(response.Source, response.Title).ToString(),
|
||||
true
|
||||
);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Text.Json;
|
||||
using Telegram.Bot.Types;
|
||||
using West.TelegramBot.ContentStore.Model;
|
||||
using West.TelegramBot.ContentStore.Option;
|
||||
@@ -20,7 +20,7 @@ public class OBoobsService : AbstractNsfwService
|
||||
{
|
||||
// "/boobs/{start=0; sql offset}/{count=1; sql limit}/{order=-id;[id,rank,-rank,interest,-interest,random]}/
|
||||
var httpResp = await _httpClient.GetAsync("boobs/1/1/random");
|
||||
var boobsResponse = JsonConvert.DeserializeObject<List<OBoobsItem>>(await httpResp.Content.ReadAsStringAsync());
|
||||
var boobsResponse = JsonSerializer.Deserialize<List<OBoobsItem>>(await httpResp.Content.ReadAsStringAsync());
|
||||
var boobsItem = boobsResponse![0];
|
||||
var boobsId = boobsItem.Id.ToString("D5");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user