Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ff29716
chore: use go-faster org repos
tdakkota Dec 9, 2021
a8c2a0c
refactor: use generated OAS Server
tdakkota Dec 9, 2021
26de281
fix(me): do not return NotImplementedError
tdakkota Dec 9, 2021
af7ba83
feat: initial botapi implementation
tdakkota Dec 10, 2021
93343d9
chore: go mod tidy
tdakkota Dec 11, 2021
130b010
fix(botapi): increase keepalive
tdakkota Dec 12, 2021
aff6ad2
feat(botapi): initial message sending support
tdakkota Dec 12, 2021
3f59371
ci: disable dupl for a while
tdakkota Dec 12, 2021
7f740cf
chore: fix error wrapping
tdakkota Dec 12, 2021
68db786
chore: go mod tidy
tdakkota Dec 12, 2021
5ae0d10
fix(botapi): peer ID generation
tdakkota Dec 13, 2021
c97ea85
fix(poll): call gaps Logout
tdakkota Dec 12, 2021
e283c82
fix(botapi): do not use update hook
tdakkota Dec 12, 2021
860683c
fix(botdoc): do not validate URLs
tdakkota Dec 15, 2021
8df13e6
chore: commit generated files
tdakkota Dec 15, 2021
5ed40f1
chore(botapi): update code due to schema changes
tdakkota Dec 15, 2021
09bf922
chore: drop telebot dependency
tdakkota Dec 15, 2021
4c6f441
feat(botapi): update to use peers manager and bbolt
tdakkota Dec 17, 2021
f4ac493
fix(botapi): set UserResolver for HTML, close bbolt
tdakkota Dec 17, 2021
e2799ae
chore(pool): add bbolt extension for db files
tdakkota Dec 17, 2021
654a621
chore: add bot db files to gitignore
tdakkota Dec 17, 2021
c9cdaf3
feat(botapi): implement LeaveChat
tdakkota Dec 17, 2021
def35b9
fix(botstorage): do not acquire write lock on reading
tdakkota Dec 17, 2021
dbd6f86
fix(botapi): return chat not found if int is invalid
tdakkota Dec 17, 2021
fd4584a
fix(botapi): user mapping
tdakkota Dec 18, 2021
f30c777
feat(botapi): implement more methods
tdakkota Dec 18, 2021
6e8376c
test(botapi): add more tests
tdakkota Dec 19, 2021
a0cf0f8
fix(pool): set update hook
tdakkota Dec 19, 2021
7a42ad8
test(botapi): add markup mapping tests
tdakkota Dec 20, 2021
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@
*.iml
out
gen

# Bot db files
state/*.bbolt
3 changes: 2 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ linters:
- deadcode
- depguard
- dogsled
- dupl
# False positive: botapi has a lot of similar unimplemented methods
# - dupl
- errcheck
- gochecknoinits
- goconst
Expand Down
75 changes: 25 additions & 50 deletions _oas/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -3159,8 +3159,7 @@
},
"url": {
"description": "HTTP or tg:// url to be opened when the button is pressed. Links tg://user?id=\u003cuser_id\u003e can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings",
"type": "string",
"format": "uri"
"type": "string"
},
"login_url": {
"$ref": "#/components/schemas/LoginUrl"
Expand Down Expand Up @@ -3359,8 +3358,7 @@
},
"url": {
"description": "URL of the result",
"type": "string",
"format": "uri"
"type": "string"
},
"hide_url": {
"description": "Pass True, if you don't want the URL to be shown in the message",
Expand All @@ -3372,8 +3370,7 @@
},
"thumb_url": {
"description": "URL of the thumbnail for the result",
"type": "string",
"format": "uri"
"type": "string"
},
"thumb_width": {
"description": "Thumbnail width",
Expand Down Expand Up @@ -3412,8 +3409,7 @@
},
"audio_url": {
"description": "A valid URL for the audio file",
"type": "string",
"format": "uri"
"type": "string"
},
"title": {
"description": "Title",
Expand Down Expand Up @@ -3904,8 +3900,7 @@
},
"thumb_url": {
"description": "URL of the thumbnail for the result",
"type": "string",
"format": "uri"
"type": "string"
},
"thumb_width": {
"description": "Thumbnail width",
Expand Down Expand Up @@ -3964,8 +3959,7 @@
},
"document_url": {
"description": "A valid URL for the file",
"type": "string",
"format": "uri"
"type": "string"
},
"mime_type": {
"description": "Mime type of the content of the file, either “application/pdf” or “application/zip”",
Expand All @@ -3983,8 +3977,7 @@
},
"thumb_url": {
"description": "URL of the thumbnail (JPEG only) for the file",
"type": "string",
"format": "uri"
"type": "string"
},
"thumb_width": {
"description": "Thumbnail width",
Expand Down Expand Up @@ -4053,8 +4046,7 @@
},
"gif_url": {
"description": "A valid URL for the GIF file. File size must not exceed 1MB",
"type": "string",
"format": "uri"
"type": "string"
},
"gif_width": {
"description": "Width of the GIF",
Expand All @@ -4076,8 +4068,7 @@
},
"thumb_url": {
"description": "URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result",
"type": "string",
"format": "uri"
"type": "string"
},
"thumb_mime_type": {
"description": "MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg”",
Expand Down Expand Up @@ -4172,8 +4163,7 @@
},
"thumb_url": {
"description": "URL of the thumbnail for the result",
"type": "string",
"format": "uri"
"type": "string"
},
"thumb_width": {
"description": "Thumbnail width",
Expand Down Expand Up @@ -4213,8 +4203,7 @@
},
"mpeg4_url": {
"description": "A valid URL for the MP4 file. File size must not exceed 1MB",
"type": "string",
"format": "uri"
"type": "string"
},
"mpeg4_width": {
"description": "Video width",
Expand All @@ -4236,8 +4225,7 @@
},
"thumb_url": {
"description": "URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result",
"type": "string",
"format": "uri"
"type": "string"
},
"thumb_mime_type": {
"description": "MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg”",
Expand Down Expand Up @@ -4294,13 +4282,11 @@
},
"photo_url": {
"description": "A valid URL of the photo. Photo must be in JPEG format. Photo size must not exceed 5MB",
"type": "string",
"format": "uri"
"type": "string"
},
"thumb_url": {
"description": "URL of the thumbnail for the photo",
"type": "string",
"format": "uri"
"type": "string"
},
"photo_width": {
"description": "Width of the photo",
Expand Down Expand Up @@ -4405,8 +4391,7 @@
},
"thumb_url": {
"description": "URL of the thumbnail for the result",
"type": "string",
"format": "uri"
"type": "string"
},
"thumb_width": {
"description": "Thumbnail width",
Expand Down Expand Up @@ -4447,17 +4432,15 @@
},
"video_url": {
"description": "A valid URL for the embedded video player or video file",
"type": "string",
"format": "uri"
"type": "string"
},
"mime_type": {
"description": "Mime type of the content of video url, “text/html” or “video/mp4”",
"type": "string"
},
"thumb_url": {
"description": "URL of the thumbnail (JPEG only) for the video",
"type": "string",
"format": "uri"
"type": "string"
},
"title": {
"description": "Title for the result",
Expand Down Expand Up @@ -4534,8 +4517,7 @@
},
"voice_url": {
"description": "A valid URL for the voice recording",
"type": "string",
"format": "uri"
"type": "string"
},
"title": {
"description": "Recording title",
Expand Down Expand Up @@ -4658,8 +4640,7 @@
},
"photo_url": {
"description": "URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for",
"type": "string",
"format": "uri"
"type": "string"
},
"photo_size": {
"description": "Photo size",
Expand Down Expand Up @@ -5266,8 +5247,7 @@
"properties": {
"url": {
"description": "An HTTP URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in Receiving authorization data.NOTE: You must always check the hash of the received data to verify the authentication and the integrity of the data as described in Checking authorization",
"type": "string",
"format": "uri"
"type": "string"
},
"forward_text": {
"description": "New text of the button in forwarded messages",
Expand Down Expand Up @@ -5593,8 +5573,7 @@
},
"url": {
"description": "For “text_link” only, url that will be opened after user taps on the text",
"type": "string",
"format": "uri"
"type": "string"
},
"user": {
"$ref": "#/components/schemas/User"
Expand Down Expand Up @@ -7270,8 +7249,7 @@
"properties": {
"url": {
"description": "Webhook URL, may be empty if webhook is not set up",
"type": "string",
"format": "uri"
"type": "string"
},
"has_custom_certificate": {
"description": "True, if a custom certificate was provided for webhook certificate checks",
Expand Down Expand Up @@ -7365,8 +7343,7 @@
},
"url": {
"description": "URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @Botfather, specify the URL that opens your game — note that this will only work if the query comes from a callback_game button.Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter",
"type": "string",
"format": "uri"
"type": "string"
},
"cache_time": {
"description": "The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0",
Expand Down Expand Up @@ -8782,8 +8759,7 @@
},
"photo_url": {
"description": "URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for",
"type": "string",
"format": "uri"
"type": "string"
},
"photo_size": {
"description": "Photo size",
Expand Down Expand Up @@ -9788,8 +9764,7 @@
"properties": {
"url": {
"description": "HTTPS url to send updates to. Use an empty string to remove webhook integration",
"type": "string",
"format": "uri"
"type": "string"
},
"certificate": {
"description": "Upload your public key certificate so that the root certificate in use can be checked. See our self-signed guide for details",
Expand Down
8 changes: 2 additions & 6 deletions botdoc/oas.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"strconv"
"strings"

"github.com/ogen-go/errors"
"github.com/ogen-go/jx"
"github.com/go-faster/errors"
"github.com/go-faster/jx"
"github.com/ogen-go/ogen"
)

Expand Down Expand Up @@ -69,10 +69,6 @@ func (a API) typeOAS(f Field) *ogen.Schema {
if b.Min > 0 {
p.MinLength = &b.Min
}

if strings.Contains(f.Name, "url") {
p.Format = "uri"
}
case Integer:
p.Type = "integer"
// Telegram uses int64 (int53, really) for IDs.
Expand Down
26 changes: 0 additions & 26 deletions cmd/bot-example/main.go

This file was deleted.

55 changes: 0 additions & 55 deletions cmd/botapi/get_me.go

This file was deleted.

Loading