Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![.NET Core](https://github.com/Dolfik1/Funogram/workflows/.NET/badge.svg)
[![NuGet](https://img.shields.io/nuget/v/Funogram.svg)](https://www.nuget.org/packages/Funogram/)
[![NuGet](https://img.shields.io/nuget/v/Funogram.Telegram.svg)](https://www.nuget.org/packages/Funogram.Telegram/)
[![NuGet](https://img.shields.io/badge/Bot%20API-8.3-blue?logo=telegram)](https://www.nuget.org/packages/Funogram.Telegram/)
[![NuGet](https://img.shields.io/badge/Bot%20API-9.0-blue?logo=telegram)](https://www.nuget.org/packages/Funogram.Telegram/)

<img src="https://github.com/Dolfik1/Funogram/raw/master/docs/files/img/logo.png" alt="Funogram Logo" width="200" align="right" />

Expand Down
61 changes: 34 additions & 27 deletions src/Funogram.Generator/Methods/MethodsParser.fs
Original file line number Diff line number Diff line change
Expand Up @@ -43,33 +43,40 @@ let loadRemapData remapPath config =
config

let private returnTypeRegexes =
[|
// Returns the list of gifts that can be sent by the bot to users. Requires no parameters. Returns a Gifts object

// invite links
Regex("Returns the new invite link as a ([A|a]rray of \w+|\w+)\s")
Regex("Returns the new invite link as ([A|a]rray of \w+|\w+)\s")
Regex("Returns the edited invite link as a ([A|a]rray of \w+|\w+)\s")
Regex("Returns the revoked invite link as ([A|a]rray of \w+|\w+)\s")
Regex("Returns the created invoice link as ([A|a]rray of \w+|\w+)\s.")

Regex("On success, a ([A|a]rray of \w+|\w+)\s")
Regex("On success, an ([A|a]rray of \w+|\w+)\s")
Regex("An ([A|a]rray of \w+|\w+) objects is returned")
Regex("[R|r]eturns basic information about the bot in form of a ([A|a]rray of \w+|\w+)")
Regex("[R|r]eturns information about the created topic as a ([A|a]rray of \w+|\w+)")

Regex("([A|a]rray of \w+|\w+) is returned, otherwise ([A|a]rray of \w+|\w+)")

Regex("[R|r]eturns a ([A|a]rray of \w+|\w+)\s")
Regex("[R|r]eturns the uploaded (\w+)\s")
Regex("[R|r]eturns the ([A|a]rray of \w+|\w+)\s")
Regex("[R|r]eturns an ([A|a]rray of \w+|\w+)\s")
Regex("[R|r]eturns ([A|a]rray of \w+|\w+)\s")


Regex("\s([A|a]rray of \w+|\w+)\sis returned")
|]
let rxs =
[|
// Returns the list of gifts that can be sent by the bot to users. Requires no parameters. Returns a Gifts object

// invite links
Regex("Returns the new invite link as a ([A|a]rray of \w+|\w+)\s")
Regex("Returns the new invite link as ([A|a]rray of \w+|\w+)\s")
Regex("Returns the edited invite link as a ([A|a]rray of \w+|\w+)\s")
Regex("Returns the revoked invite link as ([A|a]rray of \w+|\w+)\s")
Regex("Returns the created invoice link as ([A|a]rray of \w+|\w+)\s.")

Regex("On success, a ([A|a]rray of \w+|\w+)\s")
Regex("On success, an ([A|a]rray of \w+|\w+)\s")
Regex("An ([A|a]rray of \w+|\w+) objects is returned")
Regex("[R|r]eturns basic information about the bot in form of a ([A|a]rray of \w+|\w+)")
Regex("[R|r]eturns information about the created topic as a ([A|a]rray of \w+|\w+)")

Regex("([A|a]rray of \w+|\w+) is returned, otherwise ([A|a]rray of \w+|\w+)")

Regex("[R|r]eturns a ([A|a]rray of \w+|\w+)\s")
Regex("[R|r]eturns the uploaded (\w+)\s")
Regex("[R|r]eturns the ([A|a]rray of \w+|\w+)\s")
Regex("[R|r]eturns an ([A|a]rray of \w+|\w+)\s")
Regex("[R|r]eturns ([A|a]rray of \w+|\w+)\s")


Regex("\s([A|a]rray of \w+|\w+)\sis returned")
|]

// Sometimes they have the following format in documentation:
// Returns the list of gifts blablabla. Returns a Gifts object.
// so, let's pass first "Returns" if any
let prefixedRxs = rxs |> Array.map(fun r -> Regex($"Returns the .+\. {r}"))
Array.append prefixedRxs rxs

let private parseReturnType (str: string) =
let m =
Expand Down
Loading