v0.5.0
This commit is contained in:
6
bot.go
6
bot.go
@@ -262,12 +262,6 @@ func (b *Bot) Run() {
|
||||
middleware.Execute(ctx, b.dbContext)
|
||||
}
|
||||
|
||||
for _, plugin := range b.plugins {
|
||||
if plugin.UpdateListener != nil {
|
||||
(*plugin.UpdateListener)(ctx, b.dbContext)
|
||||
}
|
||||
}
|
||||
|
||||
if u.CallbackQuery != nil {
|
||||
b.handleCallback(u, ctx)
|
||||
} else {
|
||||
|
||||
@@ -23,7 +23,7 @@ type Api struct {
|
||||
func NewAPI(token string) *Api {
|
||||
l := slog.CreateLogger().Level(utils.GetLoggerLevel()).Prefix("API")
|
||||
l.AddWriter(l.CreateJsonStdoutWriter())
|
||||
client := &http.Client{Timeout: time.Second * 10}
|
||||
client := &http.Client{Timeout: time.Second * 45}
|
||||
return &Api{token, client, l}
|
||||
}
|
||||
func (api *Api) CloseApi() error {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package tgapi
|
||||
|
||||
import "git.nix13.pw/scuroneko/extypes"
|
||||
|
||||
type MessageReplyMarkup struct {
|
||||
InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"`
|
||||
}
|
||||
@@ -26,7 +28,7 @@ type Message struct {
|
||||
|
||||
Text string `json:"text"`
|
||||
|
||||
Photo []*PhotoSize `json:"photo,omitempty"`
|
||||
Photo extypes.Slice[*PhotoSize] `json:"photo,omitempty"`
|
||||
Caption string `json:"caption,omitempty"`
|
||||
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
|
||||
|
||||
|
||||
6
utils.go
6
utils.go
@@ -1,5 +1,7 @@
|
||||
package laniakea
|
||||
|
||||
import "git.nix13.pw/scuroneko/laniakea/utils"
|
||||
|
||||
func Ptr[T any](v T) *T { return &v }
|
||||
|
||||
func Val[T any](p *T, def T) T {
|
||||
@@ -8,3 +10,7 @@ func Val[T any](p *T, def T) T {
|
||||
}
|
||||
return def
|
||||
}
|
||||
|
||||
const VersionString = utils.VersionString
|
||||
|
||||
var EscapeMarkdown = utils.EscapeMarkdown
|
||||
|
||||
Reference in New Issue
Block a user