4 Commits

Author SHA1 Message Date
ef78c5d9b4 v0.4.4-1 2026-02-10 15:01:33 +03:00
a04375efbd v0.4.4 2026-02-10 14:56:13 +03:00
c1bdc2fdf6 v0.4.3 2026-02-10 14:32:48 +03:00
83dca1ab39 v0.4.2.1 2026-02-10 14:27:24 +03:00
3 changed files with 84 additions and 22 deletions

View File

@@ -7,10 +7,16 @@ import (
"git.nix13.pw/scuroneko/extypes"
)
const (
ButtonStyleDanger KeyboardButtonStyle = "danger"
ButtonStyleSuccess KeyboardButtonStyle = "success"
ButtonStylePrimary KeyboardButtonStyle = "primary"
)
type InlineKbButtonBuilder struct {
text string
iconCustomEmojiID string
style InlineKeyboardButtonStyle
style KeyboardButtonStyle
url string
callbackData string
}
@@ -22,7 +28,7 @@ func (b InlineKbButtonBuilder) SetIconCustomEmojiId(id string) InlineKbButtonBui
b.iconCustomEmojiID = id
return b
}
func (b InlineKbButtonBuilder) SetStyle(style InlineKeyboardButtonStyle) InlineKbButtonBuilder {
func (b InlineKbButtonBuilder) SetStyle(style KeyboardButtonStyle) InlineKbButtonBuilder {
b.style = style
return b
}
@@ -66,20 +72,27 @@ func (in *InlineKeyboard) append(button InlineKeyboardButton) *InlineKeyboard {
in.CurrentLine = in.CurrentLine.Push(button)
return in
}
func (in *InlineKeyboard) AddUrlButton(text, url string) *InlineKeyboard {
return in.append(InlineKeyboardButton{Text: text, URL: url})
}
func (in *InlineKeyboard) AddUrlButtonStyle(text string, style KeyboardButtonStyle, url string) *InlineKeyboard {
return in.append(InlineKeyboardButton{Text: text, Style: style, URL: url})
}
func (in *InlineKeyboard) AddCallbackButton(text string, cmd string, args ...any) *InlineKeyboard {
return in.append(InlineKeyboardButton{
Text: text, CallbackData: NewCallbackData(cmd, args...).ToJson(),
})
}
func (in *InlineKeyboard) AddCallbackButtonStyle(text string, style KeyboardButtonStyle, cmd string, args ...any) *InlineKeyboard {
return in.append(InlineKeyboardButton{
Text: text, Style: style,
CallbackData: NewCallbackData(cmd, args...).ToJson(),
})
}
func (in *InlineKeyboard) AddButton(b InlineKbButtonBuilder) *InlineKeyboard {
return in.append(b.build())
}
func (in *InlineKeyboard) AddCustomButton(button InlineKeyboardButton) *InlineKeyboard {
return in.append(button)
}
func (in *InlineKeyboard) AddLine() *InlineKeyboard {
if in.CurrentLine.Len() == 0 {

View File

@@ -50,17 +50,41 @@ type MessageReplyMarkup struct {
}
type Message struct {
MessageID int `json:"message_id"`
MessageThreadID int `json:"message_thread_id,omitempty"`
From *User `json:"from,omitempty"`
Chat *Chat `json:"chat,omitempty"`
Text string `json:"text"`
MessageID int `json:"message_id"`
MessageThreadID int `json:"message_thread_id,omitempty"`
BusinessConnectionId string `json:"business_connection_id,omitempty"`
From *User `json:"from,omitempty"`
Photo extypes.Slice[*PhotoSize] `json:"photo,omitempty"`
Caption string `json:"caption,omitempty"`
ReplyToMessage *Message `json:"reply_to_message"`
SenderChat *Chat `json:"sender_chat,omitempty"`
SenderBoostCount int `json:"sender_boost_count,omitempty"`
SenderBusinessBot *User `json:"sender_business_bot,omitempty"`
Chat *Chat `json:"chat,omitempty"`
IsTopicMessage bool `json:"is_topic_message,omitempty"`
IsAutomaticForward bool `json:"is_automatic_forward,omitempty"`
IsFromOffline bool `json:"is_from_offline,omitempty"`
IsPaidPost bool `json:"is_paid_post,omitempty"`
MediaGroupId string `json:"media_group_id,omitempty"`
AuthorSignature string `json:"author_signature,omitempty"`
PaidStarCount int `json:"paid_star_count,omitempty"`
ReplyToMessage *Message `json:"reply_to_message,omitempty"`
Text string `json:"text"`
Photo extypes.Slice[*PhotoSize] `json:"photo,omitempty"`
Caption string `json:"caption,omitempty"`
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
Date int `json:"date"`
EditDate int `json:"edit_date"`
ReplyMarkup *MessageReplyMarkup `json:"reply_markup,omitempty"`
Entities []MessageEntity `json:"entities,omitempty"`
LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`
SuggestedPostInfo *SuggestedPostInfo `json:"suggested_post_info,omitempty"`
EffectID string `json:"effect_id,omitempty"`
}
type InaccessableMessage struct {
@@ -72,8 +96,33 @@ type InaccessableMessage struct {
type MaybeInaccessibleMessage struct {
}
type MessageEntityType string
const (
MessageEntityMention MessageEntityType = "mention"
MessageEntityHashtag MessageEntityType = "hashtag"
MessageEntityCashtag MessageEntityType = "cashtag"
MessageEntityBotCommand MessageEntityType = "bot_command"
MessageEntityUrl MessageEntityType = "url"
MessageEntityEmail MessageEntityType = "email"
MessageEntityPhoneNumber MessageEntityType = "phone_number"
MessageEntityBold MessageEntityType = "bold"
MessageEntityItalic MessageEntityType = "italic"
MessageEntityUnderline MessageEntityType = "underline"
MessageEntityStrike MessageEntityType = "strikethrough"
MessageEntitySpoiler MessageEntityType = "spoiler"
MessageEntityBlockquote MessageEntityType = "blockquote"
MessageEntityExpandableBlockquote MessageEntityType = "expandable_blockquote"
MessageEntityCode MessageEntityType = "code"
MessageEntityPre MessageEntityType = "pre"
MessageEntityTextLink MessageEntityType = "text_link"
MessageEntityTextMention MessageEntityType = "text_mention"
MessageEntityCustomEmoji MessageEntityType = "custom_emoji"
)
type MessageEntity struct {
Type string `json:"type"`
Type MessageEntityType `json:"type"`
Offset int `json:"offset"`
Length int `json:"length"`
URL string `json:"url,omitempty"`
@@ -128,13 +177,13 @@ type InlineKeyboardMarkup struct {
InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard,omitempty"`
}
type InlineKeyboardButtonStyle string
type KeyboardButtonStyle string
type InlineKeyboardButton struct {
Text string `json:"text"`
URL string `json:"url,omitempty"`
CallbackData string `json:"callback_data,omitempty"`
Style InlineKeyboardButtonStyle `json:"style,omitempty"`
IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"`
Text string `json:"text"`
URL string `json:"url,omitempty"`
CallbackData string `json:"callback_data,omitempty"`
Style KeyboardButtonStyle `json:"style,omitempty"`
IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"`
}
type ReplyKeyboardMarkup struct {

View File

@@ -1,8 +1,8 @@
package laniakea
const (
VersionString = "0.4.2"
VersionString = "0.4.4-1"
VersionMajor = 0
VersionMinor = 4
VersionPatch = 2
VersionPatch = 4
)