Skip to content

Commit

Permalink
Targeted .NET 6.0, and fixed photo bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
arvindd committed Nov 5, 2023
1 parent a31393f commit 69cf93d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 6 additions & 1 deletion FSharp.Examples.Polling/FSharp.Examples.Polling.fsproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Worker">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Util.fs" />
Expand All @@ -12,6 +12,11 @@
<Compile Include="Extensions.fs" />
<Compile Include="Program.fs" />
</ItemGroup>
<ItemGroup>
<None Include="Files\tux.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,16 @@ module UpdateHandlerFuncs =
|> Async.AwaitTask |> ignore

let filePath = @"Files/tux.png"
use fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read)

let fileName =
filePath.Split(Path.DirectorySeparatorChar)
|> Array.last
let inputStream =
InputFileStream(new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read),
fileName)

botClient.SendPhotoAsync(
chatId = message.Chat.Id,
photo = InputFileStream(fileStream, fileName),
photo = inputStream,
caption = "Nice Picture",
cancellationToken = cts)
|> Async.AwaitTask |> Async.Ignore
Expand Down

0 comments on commit 69cf93d

Please sign in to comment.