Documentation
¶
Index ¶
- Variables
- func BlockQuote(text string) string
- func Bold(text string) string
- func Code(text string) string
- func Hashtag(tag string) string
- func Italic(text string) string
- func Link(text, url string) string
- func Mention(username string) string
- func OrderedList(items []string) string
- func Pre(text string) string
- func Quote(text string) string
- func Spoiler(text string) string
- func Strikethrough(text string) string
- func Underline(text string) string
- func UnorderedList(items []string) string
- type APIError
- type AntiSpam
- type AuxData
- type BanChatMemberRequest
- type BaseRequest
- type BaseResponse
- type Bot
- type BotClient
- func (c *BotClient) AddHandler(handler HandlerFunc, filter FilterFunc, order ...int)
- func (c *BotClient) BanChatMember(ctx context.Context, req *BanChatMemberRequest) error
- func (c *BotClient) CheckAntiSpam(userID string) bool
- func (c *BotClient) Close() error
- func (c *BotClient) Connect(ctx context.Context) error
- func (c *BotClient) CreatePoll(ctx context.Context, chatID string, question string, options []string) (string, error)
- func (c *BotClient) DeleteAvatar(ctx context.Context) error
- func (c *BotClient) DeleteMessage(ctx context.Context, req *DeleteMessageRequest) error
- func (c *BotClient) DeleteMetadata(key string)
- func (c *BotClient) DeleteState(userID, key string)
- func (c *BotClient) DeleteUserState(userID string)
- func (c *BotClient) DisableHotReload()
- func (c *BotClient) Disconnect() error
- func (c *BotClient) Download(ctx context.Context, fileID string, savePath string) error
- func (c *BotClient) DownloadFile(ctx context.Context, fileID string, savePath string) error
- func (c *BotClient) DownloadProfilePicture(ctx context.Context, userID string, savePath string) error
- func (c *BotClient) EditChatKeypad(ctx context.Context, req *EditChatKeypadRequest) error
- func (c *BotClient) EditInlineKeypad(ctx context.Context, req *EditMessageKeypadRequest) error
- func (c *BotClient) EditMessage(ctx context.Context, chatID string, messageID string, newText string) error
- func (c *BotClient) EditMessageText(ctx context.Context, req *EditMessageTextRequest) error
- func (c *BotClient) EnableHotReload()
- func (c *BotClient) Enter(ctx context.Context) (*BotClient, error)
- func (c *BotClient) Exit() error
- func (c *BotClient) ForwardMessage(ctx context.Context, req *ForwardMessageRequest) (string, error)
- func (c *BotClient) ForwardMessages(ctx context.Context, fromChatID string, messageIDs []string, toChatID string) ([]string, error)
- func (c *BotClient) GetBotInfo(ctx context.Context) (*Bot, error)
- func (c *BotClient) GetChat(ctx context.Context, chatID string) (*Chat, error)
- func (c *BotClient) GetChatAdministrators(ctx context.Context, req *GetChatAdministratorsRequest) (*GetChatAdministratorsResponse, error)
- func (c *BotClient) GetChatMember(ctx context.Context, req *GetChatMemberRequest) (*GetChatMemberResponse, error)
- func (c *BotClient) GetChatMemberCount(ctx context.Context, req *GetChatMemberCountRequest) (*GetChatMemberCountResponse, error)
- func (c *BotClient) GetFile(ctx context.Context, fileID string) (*GetFileResponse, error)
- func (c *BotClient) GetMe(ctx context.Context) (*Bot, error)
- func (c *BotClient) GetMembers(ctx context.Context, chatID string) ([]ChatMember, error)
- func (c *BotClient) GetMetadata(key string) (interface{}, bool)
- func (c *BotClient) GetPollStatus(ctx context.Context, chatID string, messageID string) (*PollStatus, error)
- func (c *BotClient) GetReloadManager() *ReloadManager
- func (c *BotClient) GetSelectionItem(ctx context.Context, req *GetSelectionItemRequest) (*GetSelectionItemResponse, error)
- func (c *BotClient) GetState(userID, key string) (interface{}, bool)
- func (c *BotClient) GetUpdates(ctx context.Context, offsetID *string, limit int) (*GetUpdatesResponse, error)
- func (c *BotClient) GetUserInfo(ctx context.Context, userID string) (*User, error)
- func (c *BotClient) IsHotReloadEnabled() bool
- func (c *BotClient) Middleware(middleware MiddlewareFunc)
- func (c *BotClient) OnAudio(handler HandlerFunc)
- func (c *BotClient) OnCallbackQuery(handler HandlerFunc)
- func (c *BotClient) OnChatUpdates(handler HandlerFunc)
- func (c *BotClient) OnCommand(command string, handler HandlerFunc)
- func (c *BotClient) OnContact(handler HandlerFunc)
- func (c *BotClient) OnDocument(handler HandlerFunc)
- func (c *BotClient) OnInlineQuery(handler HandlerFunc)
- func (c *BotClient) OnLocation(handler HandlerFunc)
- func (c *BotClient) OnMessageUpdates(handler HandlerFunc)
- func (c *BotClient) OnPhoto(handler HandlerFunc)
- func (c *BotClient) OnPoll(handler HandlerFunc)
- func (c *BotClient) OnShutdown(handler HandlerFunc)
- func (c *BotClient) OnStart(handler HandlerFunc)
- func (c *BotClient) OnSticker(handler HandlerFunc)
- func (c *BotClient) OnUpdate(handler HandlerFunc)
- func (c *BotClient) OnVideo(handler HandlerFunc)
- func (c *BotClient) PinChatMessage(ctx context.Context, req *PinChatMessageRequest) error
- func (c *BotClient) ProcessUpdate(ctx context.Context, update *Update) error
- func (c *BotClient) PromoteChatMember(ctx context.Context, req *PromoteChatMemberRequest) error
- func (c *BotClient) RemoveHandler(handler HandlerFunc)
- func (c *BotClient) RequestSendFile(ctx context.Context, fileType FileTypeEnum) (*RequestSendFileResponse, error)
- func (c *BotClient) ResetAntiSpam(userID string)
- func (c *BotClient) Run(ctx context.Context, pollingOpts ...PollingOptions) error
- func (c *BotClient) SearchSelectionItems(ctx context.Context, req *SearchSelectionItemsRequest) (*SearchSelectionItemsResponse, error)
- func (c *BotClient) SendChatActivity(ctx context.Context, chatID string, activity string) error
- func (c *BotClient) SendContact(ctx context.Context, req *SendContactRequest) (string, error)
- func (c *BotClient) SendDocument(ctx context.Context, chatID string, filePath string, caption ...string) (string, error)
- func (c *BotClient) SendFile(ctx context.Context, req *SendFileRequest) (string, error)
- func (c *BotClient) SendGif(ctx context.Context, chatID string, filePath string, caption ...string) (string, error)
- func (c *BotClient) SendLocation(ctx context.Context, req *SendLocationRequest) (string, error)
- func (c *BotClient) SendMessage(ctx context.Context, req *SendMessageRequest) (string, error)
- func (c *BotClient) SendMusic(ctx context.Context, chatID string, filePath string, caption ...string) (string, error)
- func (c *BotClient) SendPhoto(ctx context.Context, chatID string, filePath string, caption ...string) (string, error)
- func (c *BotClient) SendPoll(ctx context.Context, req *SendPollRequest) (string, error)
- func (c *BotClient) SendSticker(ctx context.Context, chatID string, filePath string) (string, error)
- func (c *BotClient) SendVideo(ctx context.Context, chatID string, filePath string, caption ...string) (string, error)
- func (c *BotClient) SendVoice(ctx context.Context, chatID string, filePath string, caption ...string) (string, error)
- func (c *BotClient) SetChatPermissions(ctx context.Context, chatID string, permissions map[string]bool) error
- func (c *BotClient) SetCommands(ctx context.Context, req *SetCommandsRequest) error
- func (c *BotClient) SetMetadata(key string, value interface{})
- func (c *BotClient) SetPin(ctx context.Context, chatID string, messageID string) error
- func (c *BotClient) SetState(userID, key string, value interface{})
- func (c *BotClient) SetUnpin(ctx context.Context, chatID string, messageID string) error
- func (c *BotClient) Start(ctx context.Context, opts ...interface{}) error
- func (c *BotClient) StartPolling(ctx context.Context, opts PollingOptions) error
- func (c *BotClient) StartWebhook(ctx context.Context, opts WebhookOptions) error
- func (c *BotClient) Stop(ctx context.Context) error
- func (c *BotClient) TerminateOtherSessions(ctx context.Context) error
- func (c *BotClient) UnbanChatMember(ctx context.Context, req *UnbanChatMemberRequest) error
- func (c *BotClient) UnpinAllChatMessages(ctx context.Context, chatID string) error
- func (c *BotClient) UnpinChatMessage(ctx context.Context, req *UnpinChatMessageRequest) error
- func (c *BotClient) UpdateBotEndpoints(ctx context.Context, url string, endpointType UpdateEndpointTypeEnum) error
- func (c *BotClient) UpdateProfile(ctx context.Context, firstName, lastName, bio string) error
- func (c *BotClient) UpdateUsername(ctx context.Context, username string) error
- func (c *BotClient) Upload(ctx context.Context, filePath string, fileType FileTypeEnum) (*File, error)
- func (c *BotClient) UploadAvatar(ctx context.Context, filePath string) (*File, error)
- func (c *BotClient) UploadFile(uploadURL, filePath string) (*FileUploadResponse, error)
- func (c *BotClient) UploadFileDirectly(ctx context.Context, filePath string, fileType FileTypeEnum) (*File, error)
- func (c *BotClient) VotePoll(ctx context.Context, chatID string, messageID string, optionIndex int) error
- type BotCommand
- type ButtonCalendarTypeEnum
- type ButtonLocationTypeEnum
- type ButtonSelectionGetEnum
- type ButtonSelectionItem
- type ButtonSelectionSearchEnum
- type ButtonSelectionTypeEnum
- type ButtonTextboxTypeKeypadEnum
- type ButtonTextboxTypeLineEnum
- type ButtonTypeEnum
- type Chat
- type ChatActivityEnum
- type ChatKeypadTypeEnum
- type ChatMember
- type ChatMemberStatusEnum
- type ChatTypeEnum
- type ClientOption
- type ContactMessage
- type DeleteMessageRequest
- type EditChatKeypadRequest
- type EditMessageKeypadRequest
- type EditMessageTextRequest
- type File
- type FileTypeEnum
- type FileUploadResponse
- type FilterFunc
- type FilterTypeEnum
- type FormattedMessage
- type ForwardMessageRequest
- type ForwardMessageResponse
- type ForwardedFrom
- type ForwardedFromEnum
- type GetChatAdministratorsRequest
- type GetChatAdministratorsResponse
- type GetChatMemberCountRequest
- type GetChatMemberCountResponse
- type GetChatMemberRequest
- type GetChatMemberResponse
- type GetChatRequest
- type GetFileRequest
- type GetFileResponse
- type GetSelectionItemRequest
- type GetSelectionItemResponse
- type GetUpdatesRequest
- type GetUpdatesResponse
- type Handler
- type HandlerFunc
- type InlineKeyboardButton
- type InlineKeyboardMarkup
- type InlineMessage
- type KeyboardButton
- type KeyboardButtonPollType
- type Location
- type LoginUrl
- type Message
- type MessageFormat
- type MessageIDResponse
- type MessageSenderEnum
- type MiddlewareFunc
- type NetworkStabilityManager
- type PaymentStatus
- type PaymentStatusEnum
- type PinChatMessageRequest
- type Poll
- type PollStatus
- type PollStatusEnum
- type PollingOptions
- type PromoteChatMemberRequest
- type ReceiveInlineMessageRequest
- type ReceiveQueryRequest
- type ReceiveUpdateRequest
- type ReloadManager
- type ReplyKeyboardMarkup
- type ReplyKeyboardRemove
- type RequestSendFileRequest
- type RequestSendFileResponse
- type ResponseParameters
- type SearchSelectionItemsRequest
- type SearchSelectionItemsResponse
- type SendContactRequest
- type SendFileRequest
- type SendLocationRequest
- type SendMessageRequest
- type SendPollRequest
- type SetCommandsRequest
- type StateManager
- func (sm *StateManager) DeleteState(userID, key string)
- func (sm *StateManager) DeleteUserState(userID string)
- func (sm *StateManager) GetAllUserStates(userID string) (map[string]interface{}, bool)
- func (sm *StateManager) GetState(userID, key string) (interface{}, bool)
- func (sm *StateManager) SetState(userID, key string, value interface{})
- type Sticker
- type UnbanChatMemberRequest
- type UnpinChatMessageRequest
- type Update
- type UpdateBotEndpointsRequest
- type UpdateEndpointTypeEnum
- type UpdateTypeEnum
- type User
- type WebAppInfo
- type WebhookOptions
Constants ¶
This section is empty.
Variables ¶
var ErrBotAlreadyRunning = fmt.Errorf("بات در حال حاضر در حال اجراست")
ErrBotAlreadyRunning خطایی برای تلاش در راهاندازی مجدد بات در حال اجرا
var ErrBotBlocked = fmt.Errorf("بات توسط روبیکا مسدود شده است")
ErrBotBlocked خطایی برای بات مسدود شده
var ErrBotNotRunning = fmt.Errorf("بات در حال حاضر متوقف است")
ErrBotNotRunning خطایی برای تلاش در متوقف کردن باتی که در حال اجرا نیست
var ErrChatNotFound = fmt.Errorf("چت مورد نظر یافت نشد")
ErrChatNotFound خطایی برای چت یافت نشده
var ErrDownloadFailed = fmt.Errorf("دانلود فایل با شکست مواجه شد")
ErrDownloadFailed خطایی برای شکست در دانلود فایل
var ErrFileNotFound = fmt.Errorf("فایل مورد نظر یافت نشد")
ErrFileNotFound خطایی برای فایل یافت نشده
var ErrFileTooLarge = fmt.Errorf("حجم فایل بیش از حد مجاز است")
ErrFileTooLarge خطایی برای فایل بسیار بزرگ
var ErrHandlerFailed = fmt.Errorf("اجرای هندلر با شکست مواجه شد")
ErrHandlerFailed خطایی برای شکست در اجرای یک هندلر
var ErrHotReloadFailed = fmt.Errorf("عملیات بارگذاری مجدد (Hot-Reload) با شکست مواجه شد")
ErrHotReloadFailed خطایی برای شکست در عملیات Hot-Reload
var ErrInternalServer = fmt.Errorf("خطای داخلی سرور روبیکا رخ داده است")
ErrInternalServer خطایی برای خطای داخلی سرور
var ErrInvalidChatType = fmt.Errorf("نوع چت نامعتبر است")
ErrInvalidChatType خطایی برای نوع چت نامعتبر
var ErrInvalidFile = fmt.Errorf("فایل ورودی نامعتبر است")
ErrInvalidFile خطایی برای فایل نامعتبر
var ErrInvalidMediaType = fmt.Errorf("نوع رسانه (Media Type) نامعتبر است")
ErrInvalidMediaType خطایی برای نوع رسانه نامعتبر
var ErrInvalidParameter = fmt.Errorf("پارامتر ورودی نامعتبر است")
ErrInvalidParameter خطایی برای پارامتر نامعتبر
var ErrInvalidToken = fmt.Errorf("توکن بات نامعتبر است")
ErrInvalidToken خطایی برای توکن نامعتبر
var ErrMessageNotFound = fmt.Errorf("پیام مورد نظر یافت نشد")
ErrMessageNotFound خطایی برای پیام یافت نشده
var ErrNetwork = fmt.Errorf("خطا در اتصال به شبکه")
ErrNetwork خطایی برای خطای شبکه
var ErrPermissionDenied = fmt.Errorf("شما دسترسی لازم برای انجام این عملیات را ندارید")
ErrPermissionDenied خطایی برای عدم دسترسی
var ErrPollingFailed = fmt.Errorf("فرآیند دریافت آپدیتها (پولینگ) با شکست مواجه شد")
ErrPollingFailed خطایی برای شکست در فرآیند پولینگ
var ErrStateNotFound = fmt.Errorf("وضعیت مورد نظر برای کاربر یافت نشد")
ErrStateNotFound خطایی برای وضعیت (state) یافت نشده
var ErrTimeout = fmt.Errorf("زمان انتظار برای پاسخ سرور به پایان رسید")
ErrTimeout خطایی برای اتمام زمان انتظار (Timeout)
var ErrTooManyRequests = fmt.Errorf("تعداد درخواستها بیش از حد مجاز است. لطفاً کمی صبر کنید")
ErrTooManyRequests خطایی برای درخواستهای زیاد
var ErrUnsupportedMethod = fmt.Errorf("این متد توسط API رسمی روبیکا پشتیبانی نمیشود")
ErrUnsupportedMethod خطایی برای متدهای پشتیبانی نشده
var ErrUploadFailed = fmt.Errorf("آپلود فایل با شکست مواجه شد")
ErrUploadFailed خطایی برای شکست در آپلود فایل
var ErrUserBlocked = fmt.Errorf("کاربر مورد نظر مسدود شده است")
ErrUserBlocked خطایی برای کاربر مسدود شده
var ErrUserBlockedByAntiSpam = fmt.Errorf("کاربر به دلیل فعالیت مشکوک توسط سیستم ضد اسپم مسدود شد")
ErrUserBlockedByAntiSpam خطایی برای مسدود شدن کاربر توسط سیستم ضد اسپم
var ErrWebhookSetupFailed = fmt.Errorf("تنظیم وبهوک با شکست مواجه شد")
ErrWebhookSetupFailed خطایی برای شکست در تنظیم وبهوک
Functions ¶
func OrderedList ¶
OrderedList ایجاد لیست مرتب (با فرمت Markdown)
func Underline ¶
Underline متن را زیرخطدار میکند (با استفاده از تگ HTML) نکته: زیرخطدار بخش استاندارد Markdown نیست و ممکن است در همه پلتفرمها پشتیبانی نشود.
func UnorderedList ¶
UnorderedList ایجاد لیست نامرتب (با فرمت Markdown)
Types ¶
type APIError ¶
type APIError struct {
StatusCode int `json:"-"` // وضعیت HTTP
Message string `json:"message"`
Code string `json:"code,omitempty"` // کد خطای اختصاصی API (در صورت وجود)
}
APIError ساختاری برای خطاهای بازگشتی از API روبیکا
type AntiSpam ¶
type AntiSpam struct {
// contains filtered or unexported fields
}
AntiSpam برای جلوگیری از اسپم و درخواستهای مکرر کاربران
func (*AntiSpam) Check ¶
Check بررسی اینکه آیا کاربر اسپم میکند یا خیر اگر کاربر اسپم نکند، true برمیگرداند. در غیر این صورت false برمیگرداند.
func (*AntiSpam) SetCooldown ¶
SetCooldown تنظیم زمان کولداون
type BanChatMemberRequest ¶
BanChatMemberRequest درخواست مسدود کردن عضو چت
type BaseResponse ¶
type BaseResponse struct {
OK bool `json:"ok"`
ErrorCode int `json:"error_code,omitempty"`
Description string `json:"description,omitempty"`
Parameters *ResponseParameters `json:"parameters,omitempty"`
}
BaseResponse مدل پایه برای پاسخها
type Bot ¶
type Bot struct {
BotID string `json:"bot_id"`
BotTitle string `json:"bot_title"`
Avatar *File `json:"avatar"`
Description string `json:"description"`
Username string `json:"username"`
StartMessage string `json:"start_message"`
}
Bot اطلاعات بات
type BotClient ¶
type BotClient struct {
// contains filtered or unexported fields
}
BotClient کلاینت اصلی بات
func NewClient ¶
func NewClient(token string, opts ...ClientOption) *BotClient
NewClient ایجاد یک نمونه جدید از BotClient (نسخه اصلاحشده)
func (*BotClient) AddHandler ¶
func (c *BotClient) AddHandler(handler HandlerFunc, filter FilterFunc, order ...int)
AddHandler اضافه کردن هندلر
func (*BotClient) BanChatMember ¶
func (c *BotClient) BanChatMember(ctx context.Context, req *BanChatMemberRequest) error
BanChatMember مسدود کردن عضو چت
func (*BotClient) CheckAntiSpam ¶
CheckAntiSpam بررسی ضد اسپم
func (*BotClient) CreatePoll ¶
func (c *BotClient) CreatePoll(ctx context.Context, chatID string, question string, options []string) (string, error)
CreatePoll ایجاد نظرسنجی
func (*BotClient) DeleteAvatar ¶
DeleteAvatar حذف آواتار
func (*BotClient) DeleteMessage ¶
func (c *BotClient) DeleteMessage(ctx context.Context, req *DeleteMessageRequest) error
DeleteMessage حذف پیام
func (*BotClient) DeleteMetadata ¶
DeleteMetadata حذف متادیتا
func (*BotClient) DeleteState ¶
DeleteState حذف وضعیت برای کاربر
func (*BotClient) DeleteUserState ¶
DeleteUserState حذف تمام وضعیتهای کاربر
func (*BotClient) DisableHotReload ¶
func (c *BotClient) DisableHotReload()
DisableHotReload غیرفعالسازی قابلیت Hot-Reload
func (*BotClient) DownloadFile ¶
DownloadFile دانلود فایل
func (*BotClient) DownloadProfilePicture ¶
func (c *BotClient) DownloadProfilePicture(ctx context.Context, userID string, savePath string) error
DownloadProfilePicture دانلود عکس پروفایل
func (*BotClient) EditChatKeypad ¶
func (c *BotClient) EditChatKeypad(ctx context.Context, req *EditChatKeypadRequest) error
EditChatKeypad ویرایش کیبورد چت
func (*BotClient) EditInlineKeypad ¶
func (c *BotClient) EditInlineKeypad(ctx context.Context, req *EditMessageKeypadRequest) error
EditInlineKeypad ویرایش کیبورد پیام
func (*BotClient) EditMessage ¶
func (c *BotClient) EditMessage(ctx context.Context, chatID string, messageID string, newText string) error
EditMessage ویرایش پیام
func (*BotClient) EditMessageText ¶
func (c *BotClient) EditMessageText(ctx context.Context, req *EditMessageTextRequest) error
EditMessageText ویرایش متن پیام
func (*BotClient) EnableHotReload ¶
func (c *BotClient) EnableHotReload()
EnableHotReload فعالسازی قابلیت Hot-Reload
func (*BotClient) ForwardMessage ¶
ForwardMessage فوروارد پیام
func (*BotClient) ForwardMessages ¶
func (c *BotClient) ForwardMessages(ctx context.Context, fromChatID string, messageIDs []string, toChatID string) ([]string, error)
ForwardMessages فوروارد چندین پیام
func (*BotClient) GetBotInfo ¶
GetBotInfo دریافت اطلاعات کامل بات
func (*BotClient) GetChatAdministrators ¶
func (c *BotClient) GetChatAdministrators(ctx context.Context, req *GetChatAdministratorsRequest) (*GetChatAdministratorsResponse, error)
GetChatAdministrators دریافت مدیران چت
func (*BotClient) GetChatMember ¶
func (c *BotClient) GetChatMember(ctx context.Context, req *GetChatMemberRequest) (*GetChatMemberResponse, error)
GetChatMember دریافت اطلاعات عضو چت
func (*BotClient) GetChatMemberCount ¶
func (c *BotClient) GetChatMemberCount(ctx context.Context, req *GetChatMemberCountRequest) (*GetChatMemberCountResponse, error)
GetChatMemberCount دریافت تعداد اعضای چت
func (*BotClient) GetMembers ¶
GetMembers دریافت اعضا
func (*BotClient) GetMetadata ¶
GetMetadata دریافت متادیتا
func (*BotClient) GetPollStatus ¶
func (c *BotClient) GetPollStatus(ctx context.Context, chatID string, messageID string) (*PollStatus, error)
GetPollStatus دریافت وضعیت نظرسنجی
func (*BotClient) GetReloadManager ¶
func (c *BotClient) GetReloadManager() *ReloadManager
GetReloadManager دسترسی به مدیر Hot-Reload را فراهم میکند
func (*BotClient) GetSelectionItem ¶
func (c *BotClient) GetSelectionItem(ctx context.Context, req *GetSelectionItemRequest) (*GetSelectionItemResponse, error)
GetSelectionItem دریافت آیتمهای انتخابی
func (*BotClient) GetUpdates ¶
func (c *BotClient) GetUpdates(ctx context.Context, offsetID *string, limit int) (*GetUpdatesResponse, error)
GetUpdates دریافت آپدیتها
func (*BotClient) GetUserInfo ¶
GetUserInfo دریافت اطلاعات کاربر
func (*BotClient) IsHotReloadEnabled ¶
IsHotReloadEnabled بررسی وضعیت Hot-Reload
func (*BotClient) Middleware ¶
func (c *BotClient) Middleware(middleware MiddlewareFunc)
Middleware اضافه کردن میدلور
func (*BotClient) OnAudio ¶
func (c *BotClient) OnAudio(handler HandlerFunc)
OnAudio هندلر برای پیامهای صوتی
func (*BotClient) OnCallbackQuery ¶
func (c *BotClient) OnCallbackQuery(handler HandlerFunc)
OnCallbackQuery هندلر برای کوئریهای دکمه
func (*BotClient) OnChatUpdates ¶
func (c *BotClient) OnChatUpdates(handler HandlerFunc)
OnChatUpdates هندلر برای آپدیتهای چت
func (*BotClient) OnCommand ¶
func (c *BotClient) OnCommand(command string, handler HandlerFunc)
OnCommand هندلر برای دستورات
func (*BotClient) OnContact ¶
func (c *BotClient) OnContact(handler HandlerFunc)
OnContact هندلر برای پیامهای مخاطب
func (*BotClient) OnDocument ¶
func (c *BotClient) OnDocument(handler HandlerFunc)
OnDocument هندلر برای پیامهای سند
func (*BotClient) OnInlineQuery ¶
func (c *BotClient) OnInlineQuery(handler HandlerFunc)
OnInlineQuery هندلر برای کوئریهای اینلاین
func (*BotClient) OnLocation ¶
func (c *BotClient) OnLocation(handler HandlerFunc)
OnLocation هندلر برای پیامهای موقعیت مکانی
func (*BotClient) OnMessageUpdates ¶
func (c *BotClient) OnMessageUpdates(handler HandlerFunc)
OnMessageUpdates هندلر برای آپدیتهای پیام
func (*BotClient) OnPhoto ¶
func (c *BotClient) OnPhoto(handler HandlerFunc)
OnPhoto هندلر برای پیامهای عکس
func (*BotClient) OnPoll ¶
func (c *BotClient) OnPoll(handler HandlerFunc)
OnPoll هندلر برای پیامهای نظرسنجی
func (*BotClient) OnShutdown ¶
func (c *BotClient) OnShutdown(handler HandlerFunc)
OnShutdown هندلر برای خاموشی بات
func (*BotClient) OnStart ¶
func (c *BotClient) OnStart(handler HandlerFunc)
OnStart هندلر برای شروع بات
func (*BotClient) OnSticker ¶
func (c *BotClient) OnSticker(handler HandlerFunc)
OnSticker هندلر برای پیامهای استیکر
func (*BotClient) OnUpdate ¶
func (c *BotClient) OnUpdate(handler HandlerFunc)
OnUpdate هندلر برای همه آپدیتها
func (*BotClient) OnVideo ¶
func (c *BotClient) OnVideo(handler HandlerFunc)
OnVideo هندلر برای پیامهای ویدیویی
func (*BotClient) PinChatMessage ¶
func (c *BotClient) PinChatMessage(ctx context.Context, req *PinChatMessageRequest) error
PinChatMessage پین کردن پیام
func (*BotClient) ProcessUpdate ¶
ProcessUpdate پردازش یک آپدیت (متد عمومی)
func (*BotClient) PromoteChatMember ¶
func (c *BotClient) PromoteChatMember(ctx context.Context, req *PromoteChatMemberRequest) error
PromoteChatMember ارتقای عضو چت
func (*BotClient) RemoveHandler ¶
func (c *BotClient) RemoveHandler(handler HandlerFunc)
RemoveHandler حذف هندلر
func (*BotClient) RequestSendFile ¶
func (c *BotClient) RequestSendFile(ctx context.Context, fileType FileTypeEnum) (*RequestSendFileResponse, error)
RequestSendFile درخواست آدرس آپلود
func (*BotClient) ResetAntiSpam ¶
ResetAntiSpam بازنشانی ضد اسپم برای کاربر
func (*BotClient) Run ¶
func (c *BotClient) Run(ctx context.Context, pollingOpts ...PollingOptions) error
Run اجرای بات با پولینگ
func (*BotClient) SearchSelectionItems ¶
func (c *BotClient) SearchSelectionItems(ctx context.Context, req *SearchSelectionItemsRequest) (*SearchSelectionItemsResponse, error)
SearchSelectionItems جستجوی آیتمهای انتخابی
func (*BotClient) SendChatActivity ¶
SendChatActivity ارسال فعالیت چت
func (*BotClient) SendContact ¶
SendContact ارسال مخاطب
func (*BotClient) SendDocument ¶
func (c *BotClient) SendDocument(ctx context.Context, chatID string, filePath string, caption ...string) (string, error)
SendDocument ارسال سند
func (*BotClient) SendGif ¶
func (c *BotClient) SendGif(ctx context.Context, chatID string, filePath string, caption ...string) (string, error)
SendGif ارسال گیف
func (*BotClient) SendLocation ¶
SendLocation ارسال موقعیت مکانی
func (*BotClient) SendMessage ¶
SendMessage ارسال پیام متنی
func (*BotClient) SendMusic ¶
func (c *BotClient) SendMusic(ctx context.Context, chatID string, filePath string, caption ...string) (string, error)
SendMusic ارسال موزیک
func (*BotClient) SendPhoto ¶
func (c *BotClient) SendPhoto(ctx context.Context, chatID string, filePath string, caption ...string) (string, error)
SendPhoto ارسال عکس
func (*BotClient) SendSticker ¶
func (c *BotClient) SendSticker(ctx context.Context, chatID string, filePath string) (string, error)
SendSticker ارسال استیکر
func (*BotClient) SendVideo ¶
func (c *BotClient) SendVideo(ctx context.Context, chatID string, filePath string, caption ...string) (string, error)
SendVideo ارسال ویدیو
func (*BotClient) SendVoice ¶
func (c *BotClient) SendVoice(ctx context.Context, chatID string, filePath string, caption ...string) (string, error)
SendVoice ارسال پیام صوتی
func (*BotClient) SetChatPermissions ¶
func (c *BotClient) SetChatPermissions(ctx context.Context, chatID string, permissions map[string]bool) error
SetChatPermissions تنظیم مجوزهای چت
func (*BotClient) SetCommands ¶
func (c *BotClient) SetCommands(ctx context.Context, req *SetCommandsRequest) error
SetCommands تنظیم دستورات بات
func (*BotClient) SetMetadata ¶
SetMetadata تنظیم متادیتا
func (*BotClient) StartPolling ¶
func (c *BotClient) StartPolling(ctx context.Context, opts PollingOptions) error
StartPolling شروع دریافت آپدیتها با پولینگ (هوشمند شده)
func (*BotClient) StartWebhook ¶
func (c *BotClient) StartWebhook(ctx context.Context, opts WebhookOptions) error
StartWebhook راهاندازی سرور وبهوک (بهینه شده)
func (*BotClient) TerminateOtherSessions ¶
TerminateOtherSessions خاتمه جلسات دیگر
func (*BotClient) UnbanChatMember ¶
func (c *BotClient) UnbanChatMember(ctx context.Context, req *UnbanChatMemberRequest) error
UnbanChatMember رفع مسدودیت عضو چت
func (*BotClient) UnpinAllChatMessages ¶
UnpinAllChatMessages آنپین کردن همه پیامها
func (*BotClient) UnpinChatMessage ¶
func (c *BotClient) UnpinChatMessage(ctx context.Context, req *UnpinChatMessageRequest) error
UnpinChatMessage آنپین کردن پیام
func (*BotClient) UpdateBotEndpoints ¶
func (c *BotClient) UpdateBotEndpoints(ctx context.Context, url string, endpointType UpdateEndpointTypeEnum) error
UpdateBotEndpoints بهروزرسانی endpointهای بات
func (*BotClient) UpdateProfile ¶
UpdateProfile بهروزرسانی پروفایل
func (*BotClient) UpdateUsername ¶
UpdateUsername بهروزرسانی نام کاربری
func (*BotClient) Upload ¶
func (c *BotClient) Upload(ctx context.Context, filePath string, fileType FileTypeEnum) (*File, error)
Upload آپلود فایل (مخفف)
func (*BotClient) UploadAvatar ¶
UploadAvatar آپلود آواتار
func (*BotClient) UploadFile ¶
func (c *BotClient) UploadFile(uploadURL, filePath string) (*FileUploadResponse, error)
UploadFile آپلود فایل
func (*BotClient) UploadFileDirectly ¶
func (c *BotClient) UploadFileDirectly(ctx context.Context, filePath string, fileType FileTypeEnum) (*File, error)
UploadFileDirectly آپلود فایل و دریافت اطلاعات کامل
type BotCommand ¶
BotCommand دستورات بات
type ButtonCalendarTypeEnum ¶
type ButtonCalendarTypeEnum string
const ( ButtonCalendarDatePersian ButtonCalendarTypeEnum = "DatePersian" ButtonCalendarDateGregorian ButtonCalendarTypeEnum = "DateGregorian" )
type ButtonLocationTypeEnum ¶
type ButtonLocationTypeEnum string
const ( ButtonLocationPicker ButtonLocationTypeEnum = "Picker" ButtonLocationView ButtonLocationTypeEnum = "View" )
type ButtonSelectionGetEnum ¶
type ButtonSelectionGetEnum string
const ( ButtonSelectionGetLocal ButtonSelectionGetEnum = "Local" ButtonSelectionGetApi ButtonSelectionGetEnum = "Api" )
type ButtonSelectionItem ¶
type ButtonSelectionItem struct {
Text string `json:"text"`
ImageUrl string `json:"image_url"`
Type ButtonSelectionTypeEnum `json:"type"`
}
ButtonSelectionItem آیتم در دکمه انتخاب
type ButtonSelectionSearchEnum ¶
type ButtonSelectionSearchEnum string
const ( ButtonSelectionSearchNone ButtonSelectionSearchEnum = "None" ButtonSelectionSearchLocal ButtonSelectionSearchEnum = "Local" ButtonSelectionSearchApi ButtonSelectionSearchEnum = "Api" )
type ButtonSelectionTypeEnum ¶
type ButtonSelectionTypeEnum string
const ( ButtonSelectionTextOnly ButtonSelectionTypeEnum = "TextOnly" ButtonSelectionTextImgThu ButtonSelectionTypeEnum = "TextImgThu" ButtonSelectionTextImgBig ButtonSelectionTypeEnum = "TextImgBig" )
type ButtonTextboxTypeKeypadEnum ¶
type ButtonTextboxTypeKeypadEnum string
const ( ButtonTextboxKeypadString ButtonTextboxTypeKeypadEnum = "String" ButtonTextboxKeypadNumber ButtonTextboxTypeKeypadEnum = "Number" )
type ButtonTextboxTypeLineEnum ¶
type ButtonTextboxTypeLineEnum string
const ( ButtonTextboxLineSingle ButtonTextboxTypeLineEnum = "SingleLine" ButtonTextboxLineMulti ButtonTextboxTypeLineEnum = "MultiLine" )
type ButtonTypeEnum ¶
type ButtonTypeEnum string
const ( ButtonTypeSimple ButtonTypeEnum = "Simple" ButtonTypeSelection ButtonTypeEnum = "Selection" ButtonTypeCalendar ButtonTypeEnum = "Calendar" ButtonTypeNumberPicker ButtonTypeEnum = "NumberPicker" ButtonTypeStringPicker ButtonTypeEnum = "StringPicker" ButtonTypeLocation ButtonTypeEnum = "Location" ButtonTypePayment ButtonTypeEnum = "Payment" ButtonTypeCameraImage ButtonTypeEnum = "CameraImage" ButtonTypeCameraVideo ButtonTypeEnum = "CameraVideo" ButtonTypeGalleryImage ButtonTypeEnum = "GalleryImage" ButtonTypeGalleryVideo ButtonTypeEnum = "GalleryVideo" ButtonTypeFile ButtonTypeEnum = "File" ButtonTypeAudio ButtonTypeEnum = "Audio" ButtonTypeRecordAudio ButtonTypeEnum = "RecordAudio" ButtonTypeMyPhoneNumber ButtonTypeEnum = "MyPhoneNumber" ButtonTypeMyLocation ButtonTypeEnum = "MyLocation" ButtonTypeTextbox ButtonTypeEnum = "Textbox" ButtonTypeLink ButtonTypeEnum = "Link" ButtonTypeAskMyPhoneNumber ButtonTypeEnum = "AskMyPhoneNumber" ButtonTypeAskMyLocation ButtonTypeEnum = "AskMyLocation" ButtonTypeBarcode ButtonTypeEnum = "Barcode" ButtonTypeWebApp ButtonTypeEnum = "WebApp" // نوع جدید برای دکمههای وب اپ ButtonTypeLogin ButtonTypeEnum = "Login" // نوع جدید برای دکمههای لاگین ButtonTypeGame ButtonTypeEnum = "Game" // نوع جدید برای دکمههای بازی )
type Chat ¶
type Chat struct {
ChatID string `json:"chat_id"`
ChatType ChatTypeEnum `json:"chat_type"`
UserID string `json:"user_id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Title string `json:"title"`
Username string `json:"username"`
}
Chat اطلاعات چت
type ChatActivityEnum ¶
type ChatActivityEnum string
const ( ChatActivityTyping ChatActivityEnum = "typing" ChatActivityUploadPhoto ChatActivityEnum = "upload_photo" ChatActivityRecordVideo ChatActivityEnum = "record_video" ChatActivityUploadVideo ChatActivityEnum = "upload_video" ChatActivityRecordAudio ChatActivityEnum = "record_audio" ChatActivityUploadAudio ChatActivityEnum = "upload_audio" ChatActivityUploadDocument ChatActivityEnum = "upload_document" ChatActivityFindLocation ChatActivityEnum = "find_location" ChatActivityRecordVideoNote ChatActivityEnum = "record_video_note" ChatActivityUploadVideoNote ChatActivityEnum = "upload_video_note" ChatActivityChooseSticker ChatActivityEnum = "choose_sticker" )
type ChatKeypadTypeEnum ¶
type ChatKeypadTypeEnum string
const ( NoneKeypad ChatKeypadTypeEnum = "None" NewKeypad ChatKeypadTypeEnum = "New" RemoveKeypad ChatKeypadTypeEnum = "Remove" )
type ChatMember ¶
type ChatMember struct {
User Chat `json:"user"`
Status string `json:"status"`
JoinDate string `json:"join_date"`
}
ChatMember عضو چت
type ChatMemberStatusEnum ¶
type ChatMemberStatusEnum string
const ( MemberCreator ChatMemberStatusEnum = "Creator" MemberAdministrator ChatMemberStatusEnum = "Administrator" MemberMember ChatMemberStatusEnum = "Member" MemberRestricted ChatMemberStatusEnum = "Restricted" MemberLeft ChatMemberStatusEnum = "Left" MemberKicked ChatMemberStatusEnum = "Kicked" )
type ChatTypeEnum ¶
type ChatTypeEnum string
const ( UserChat ChatTypeEnum = "User" BotChat ChatTypeEnum = "Bot" GroupChat ChatTypeEnum = "Group" ChannelChat ChatTypeEnum = "Channel" )
type ClientOption ¶
type ClientOption func(*BotClient)
ClientOption برای تنظیمات اولیه کلاینت
func WithHTTPClient ¶
func WithHTTPClient(client *http.Client) ClientOption
WithHTTPClient برای تنظیم کلاینت HTTP سفارشی
func WithHotReload ¶
func WithHotReload(enabled bool) ClientOption
WithHotReload فعالسازی قابلیت Hot-Reload
func WithIgnoreTimeout ¶
func WithIgnoreTimeout(ignore bool) ClientOption
WithIgnoreTimeout تنظیم نادیده گرفتن خطاهای timeout
func WithMaxRetries ¶
func WithMaxRetries(retries int) ClientOption
WithMaxRetries تنظیم حداکثر تلاش مجدد
func WithRateLimitDelay ¶
func WithRateLimitDelay(delay time.Duration) ClientOption
WithRateLimitDelay تنظیم تأخیر نرخ محدودیت
type ContactMessage ¶
type ContactMessage struct {
PhoneNumber string `json:"phone_number"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
}
ContactMessage پیام مخاطب
type DeleteMessageRequest ¶
type DeleteMessageRequest struct {
ChatID string `json:"chat_id"`
MessageID string `json:"message_id"`
}
DeleteMessageRequest درخواست حذف پیام
type EditChatKeypadRequest ¶
type EditChatKeypadRequest struct {
ChatID string `json:"chat_id"`
ReplyKeyboard *ReplyKeyboardMarkup `json:"reply_keyboard,omitempty"`
RemoveKeyboard *ReplyKeyboardRemove `json:"remove_keyboard,omitempty"`
ChatKeypadType ChatKeypadTypeEnum `json:"chat_keypad_type"`
}
EditChatKeypadRequest درخواست ویرایش کیبورد چت (پاسخ)
type EditMessageKeypadRequest ¶
type EditMessageKeypadRequest struct {
ChatID string `json:"chat_id"`
MessageID string `json:"message_id"`
InlineKeyboard *InlineKeyboardMarkup `json:"inline_keyboard"`
}
EditMessageKeypadRequest درخواست ویرایش کیبورد پیام (اینلاین)
type EditMessageTextRequest ¶
type EditMessageTextRequest struct {
ChatID string `json:"chat_id"`
MessageID string `json:"message_id"`
Text string `json:"text"`
InlineKeyboardMarkup *InlineKeyboardMarkup `json:"inline_keyboard,omitempty"`
}
EditMessageTextRequest درخواست ویرایش متن پیام
type File ¶
type File struct {
FileID string `json:"file_id"`
FileName string `json:"file_name"`
Size int64 `json:"size"`
Type FileTypeEnum `json:"type,omitempty"`
}
File اطلاعات فایل
type FileTypeEnum ¶
type FileTypeEnum string
const ( FileType FileTypeEnum = "File" ImageType FileTypeEnum = "Image" VoiceType FileTypeEnum = "Voice" VideoType FileTypeEnum = "Video" MusicType FileTypeEnum = "Music" GifType FileTypeEnum = "Gif" PhotoType FileTypeEnum = "Photo" StickerType FileTypeEnum = "Sticker" AudioType FileTypeEnum = "Audio" // نوع جدید برای فایلهای صوتی )
type FileUploadResponse ¶
type FileUploadResponse struct {
FileID string `json:"file_id"`
}
FileUploadResponse پاسخ آپلود فایل
type FilterFunc ¶
FilterFunc برای فیلتر کردن آپدیتها
type FilterTypeEnum ¶
type FilterTypeEnum string
const ( FilterTypeText FilterTypeEnum = "Text" FilterTypePhoto FilterTypeEnum = "Photo" FilterTypeAudio FilterTypeEnum = "Audio" FilterTypeVideo FilterTypeEnum = "Video" FilterTypeDocument FilterTypeEnum = "Document" FilterTypeSticker FilterTypeEnum = "Sticker" FilterTypeLocation FilterTypeEnum = "Location" FilterTypeContact FilterTypeEnum = "Contact" FilterTypePoll FilterTypeEnum = "Poll" FilterTypeCommand FilterTypeEnum = "Command" FilterTypeCallback FilterTypeEnum = "Callback" FilterTypeInline FilterTypeEnum = "Inline" FilterTypeEdited FilterTypeEnum = "Edited" FilterTypeForward FilterTypeEnum = "Forward" FilterTypeReply FilterTypeEnum = "Reply" FilterTypeGroup FilterTypeEnum = "Group" FilterTypeChannel FilterTypeEnum = "Channel" FilterTypePrivate FilterTypeEnum = "Private" FilterTypeBot FilterTypeEnum = "Bot" FilterTypeUser FilterTypeEnum = "User" )
type FormattedMessage ¶
type FormattedMessage struct {
Text string `json:"text"`
Format MessageFormat `json:"format"`
}
FormattedMessage پیام با فرمت خاص
func NewFormattedMessage ¶
func NewFormattedMessage(text string, format MessageFormat) *FormattedMessage
NewFormattedMessage ایجاد یک پیام با فرمت خاص
type ForwardMessageRequest ¶
type ForwardMessageRequest struct {
FromChatID string `json:"from_chat_id"`
MessageID string `json:"message_id"`
ToChatID string `json:"to_chat_id"`
DisableNotification bool `json:"disable_notification,omitempty"`
}
ForwardMessageRequest درخواست فوروارد پیام
type ForwardMessageResponse ¶
type ForwardMessageResponse struct {
NewMessageID string `json:"new_message_id"`
}
ForwardMessageResponse پاسخ فوروارد پیام
type ForwardedFrom ¶
type ForwardedFrom struct {
TypeFrom ForwardedFromEnum `json:"type_from"`
MessageID string `json:"message_id"`
FromChatID string `json:"from_chat_id"`
FromSenderID string `json:"from_sender_id"`
}
ForwardedFrom اطلاعات فوروارد پیام
type ForwardedFromEnum ¶
type ForwardedFromEnum string
const ( ForwardedFromUser ForwardedFromEnum = "User" ForwardedFromChannel ForwardedFromEnum = "Channel" ForwardedFromBot ForwardedFromEnum = "Bot" )
type GetChatAdministratorsRequest ¶
type GetChatAdministratorsRequest struct {
ChatID string `json:"chat_id"`
}
GetChatAdministratorsRequest درخواست دریافت مدیران چت
type GetChatAdministratorsResponse ¶
type GetChatAdministratorsResponse struct {
Administrators []ChatMember `json:"administrators"`
}
GetChatAdministratorsResponse پاسخ دریافت مدیران چت
type GetChatMemberCountRequest ¶
type GetChatMemberCountRequest struct {
ChatID string `json:"chat_id"`
}
GetChatMemberCountRequest درخواست دریافت تعداد اعضای چت
type GetChatMemberCountResponse ¶
type GetChatMemberCountResponse struct {
Count int `json:"count"`
}
GetChatMemberCountResponse پاسخ دریافت تعداد اعضای چت
type GetChatMemberRequest ¶
GetChatMemberRequest درخواست دریافت اطلاعات عضو چت
type GetChatMemberResponse ¶
type GetChatMemberResponse struct {
Member ChatMember `json:"member"`
}
GetChatMemberResponse پاسخ دریافت اطلاعات عضو چت
type GetChatRequest ¶
type GetChatRequest struct {
ChatID string `json:"chat_id"`
}
GetChatRequest درخواست دریافت اطلاعات چت
type GetFileRequest ¶
type GetFileRequest struct {
FileID string `json:"file_id"`
}
GetFileRequest درخواست دریافت اطلاعات فایل
type GetFileResponse ¶
type GetFileResponse struct {
DownloadURL string `json:"download_url"`
FileName string `json:"file_name"`
Size int64 `json:"size"` // <-- این خط را به int64 تغییر دهید
}
GetFileResponse پاسخ دریافت اطلاعات فایل
type GetSelectionItemRequest ¶
type GetSelectionItemRequest struct {
SelectionID string `json:"selection_id"`
Query string `json:"query,omitempty"`
}
GetSelectionItemRequest درخواست دریافت آیتمهای انتخابی
type GetSelectionItemResponse ¶
type GetSelectionItemResponse struct {
Items []ButtonSelectionItem `json:"items"`
}
GetSelectionItemResponse پاسخ دریافت آیتمهای انتخابی
type GetUpdatesRequest ¶
type GetUpdatesRequest struct {
OffsetID string `json:"offset_id,omitempty"`
Limit int `json:"limit"`
}
GetUpdatesRequest درخواست دریافت آپدیتها
type GetUpdatesResponse ¶
type GetUpdatesResponse struct {
Updates []Update `json:"updates"`
NextOffsetID string `json:"next_offset_id"`
}
GetUpdatesResponse پاسخ دریافت آپدیتها
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler اطلاعات هندلر
type HandlerFunc ¶
HandlerFunc برای پردازش آپدیتها
type InlineKeyboardButton ¶
type InlineKeyboardButton struct {
Text string `json:"text"`
URL string `json:"url,omitempty"`
LoginURL *LoginUrl `json:"login_url,omitempty"`
CallbackData string `json:"callback_data,omitempty"`
SwitchInlineQuery string `json:"switch_inline_query,omitempty"`
SwitchInlineQueryCurrentChat string `json:"switch_inline_query_current_chat,omitempty"`
}
InlineKeyboardButton دکمه کیبورد اینلاین
func NewInlineKeyboardButton ¶
func NewInlineKeyboardButton(text string) *InlineKeyboardButton
NewInlineKeyboardButton ایجاد یک دکمه کیبورد اینلاین
func (*InlineKeyboardButton) WithCallbackData ¶
func (b *InlineKeyboardButton) WithCallbackData(data string) *InlineKeyboardButton
WithCallbackData تنظیم داده callback برای دکمه
func (*InlineKeyboardButton) WithSwitchInlineQuery ¶
func (b *InlineKeyboardButton) WithSwitchInlineQuery(query string) *InlineKeyboardButton
WithSwitchInlineQuery تنظیم سوئیچ اینلاین کوئری برای دکمه
func (*InlineKeyboardButton) WithURL ¶
func (b *InlineKeyboardButton) WithURL(url string) *InlineKeyboardButton
WithURL تنظیم URL برای دکمه
type InlineKeyboardMarkup ¶
type InlineKeyboardMarkup struct {
InlineKeyboard [][]*InlineKeyboardButton `json:"inline_keyboard"`
}
InlineKeyboardMarkup کیبورد اینلاین
func NewInlineKeyboard ¶
func NewInlineKeyboard(rows ...[]*InlineKeyboardButton) *InlineKeyboardMarkup
NewInlineKeyboard ایجاد یک کیبورد اینلاین
type InlineMessage ¶
type InlineMessage struct {
SenderID string `json:"sender_id"`
Text string `json:"text"`
File *File `json:"file"`
Location *Location `json:"location"`
AuxData *AuxData `json:"aux_data"`
// نکته: در پاسخهای مربوط به receiveInlineMessage، این فیلد به صورت رشته (string) برگردانده میشود.
MessageID string `json:"message_id"`
ChatID string `json:"chat_id"`
}
InlineMessage پیام اینلاین
type KeyboardButton ¶
type KeyboardButton struct {
Text string `json:"text"`
RequestContact bool `json:"request_contact,omitempty"`
RequestLocation bool `json:"request_location,omitempty"`
RequestPoll *KeyboardButtonPollType `json:"request_poll,omitempty"`
WebApp *WebAppInfo `json:"web_app,omitempty"`
}
KeyboardButton دکمه کیبورد پاسخ
func NewReplyKeyboardButton ¶
func NewReplyKeyboardButton(text string) *KeyboardButton
NewReplyKeyboardButton ایجاد یک دکمه کیبورد پاسخ
func (*KeyboardButton) WithRequestContact ¶
func (b *KeyboardButton) WithRequestContact() *KeyboardButton
WithRequestContact تنظیم درخواست شماره تلفن برای دکمه
func (*KeyboardButton) WithRequestLocation ¶
func (b *KeyboardButton) WithRequestLocation() *KeyboardButton
WithRequestLocation تنظیم درخواست موقعیت مکانی برای دکمه
type KeyboardButtonPollType ¶
type KeyboardButtonPollType struct {
Type string `json:"type"` // 'quiz' or 'regular'
}
KeyboardButtonPollType نوع نظرسنجی برای دکمه کیبورد
type LoginUrl ¶
type LoginUrl struct {
URL string `json:"url"`
ForwardText *string `json:"forward_text,omitempty"`
BotUsername *string `json:"bot_username,omitempty"`
RequestWriteAccess *bool `json:"request_write_access,omitempty"`
}
LoginUrl اطلاعات برای دکمه لاگین
type Message ¶
type Message struct {
// نکته: در پاسخهای مربوط به getUpdates و receiveUpdate، این فیلد به صورت عدد (int64) برگردانده میشود.
MessageID string `json:"message_id"`
Text string `json:"text"`
Time string `json:"time"`
IsEdited bool `json:"is_edited"`
SenderType MessageSenderEnum `json:"sender_type"`
SenderID string `json:"sender_id"`
AuxData *AuxData `json:"aux_data"`
File *File `json:"file"`
ReplyToMessageID string `json:"reply_to_message_id"`
ForwardedFrom *ForwardedFrom `json:"forwarded_from"`
ForwardedNoLink string `json:"forwarded_no_link"`
Location *Location `json:"location"`
Sticker *Sticker `json:"sticker"`
ContactMessage *ContactMessage `json:"contact_message"`
Poll *Poll `json:"poll"`
Payment *PaymentStatus `json:"payment"`
// --- ویژگیهای جدید نسخه 2.0.0 ---
Metadata map[string]interface{} `json:"metadata,omitempty"` // متادیتای دلخواه برای پیام
IsMarkdown bool `json:"is_markdown,omitempty"` // آیا پیام با فرمت Markdown است
Font string `json:"font,omitempty"` // فونت متن پیام
}
Message پیام
type MessageFormat ¶
type MessageFormat string
MessageFormat فرمتهای مختلف پیام
const ( FormatPlain MessageFormat = "plain" FormatMarkdown MessageFormat = "markdown" FormatHTML MessageFormat = "html" )
type MessageIDResponse ¶
type MessageIDResponse struct {
MessageID string `json:"message_id"`
}
MessageIDResponse پاسخ حاوی آیدی پیام
type MessageSenderEnum ¶
type MessageSenderEnum string
const ( UserSender MessageSenderEnum = "User" BotSender MessageSenderEnum = "Bot" )
type MiddlewareFunc ¶
type MiddlewareFunc func(ctx context.Context, update *Update, next HandlerFunc) error
MiddlewareFunc برای middleware
type NetworkStabilityManager ¶
type NetworkStabilityManager struct {
// contains filtered or unexported fields
}
NetworkStabilityManager مدیریت پایداری شبکه
func NewNetworkStabilityManager ¶
func NewNetworkStabilityManager(client *BotClient) *NetworkStabilityManager
NewNetworkStabilityManager ایجاد یک نمونه جدید
func (*NetworkStabilityManager) CalculateBackoffDelay ¶
func (nsm *NetworkStabilityManager) CalculateBackoffDelay(retryCount int) time.Duration
CalculateBackoffDelay محاسبه تأخیر برای تلاش مجدد با الگوریتم نمایی و Jitter
func (*NetworkStabilityManager) IsRetryableError ¶
func (nsm *NetworkStabilityManager) IsRetryableError(err error) bool
IsRetryableError بررسی اینکه آیا یک خطا قابل تلاش مجدد است یا خیر
type PaymentStatus ¶
type PaymentStatus struct {
PaymentID string `json:"payment_id"`
Status PaymentStatusEnum `json:"status"`
}
PaymentStatus وضعیت پرداخت
type PaymentStatusEnum ¶
type PaymentStatusEnum string
const ( PaymentPaid PaymentStatusEnum = "Paid" PaymentNotPaid PaymentStatusEnum = "NotPaid" )
type PinChatMessageRequest ¶
type PinChatMessageRequest struct {
ChatID string `json:"chat_id"`
MessageID string `json:"message_id"`
DisableNotification bool `json:"disable_notification,omitempty"`
}
PinChatMessageRequest درخواست پین کردن پیام
type Poll ¶
type Poll struct {
Question string `json:"question"`
Options []string `json:"options"`
PollStatus *PollStatus `json:"poll_status"`
}
Poll نظرسنجی
type PollStatus ¶
type PollStatus struct {
State PollStatusEnum `json:"state"`
SelectionIndex int `json:"selection_index"`
PercentVoteOptions []int `json:"percent_vote_options"`
TotalVote int `json:"total_vote"`
ShowTotalVotes bool `json:"show_total_votes"`
}
PollStatus وضعیت نظرسنجی
type PollStatusEnum ¶
type PollStatusEnum string
const ( OpenPoll PollStatusEnum = "Open" ClosedPoll PollStatusEnum = "Closed" )
type PollingOptions ¶
type PollingOptions struct {
Handler HandlerFunc
RetryTimeout time.Duration // این فیلد دیگر به صورت مستقیم استفاده نمیشود و توسط NetworkStabilityManager مدیریت میشود
Limit int
AllowEmptyUpdates bool
PollInterval time.Duration
Timeout time.Duration
}
PollingOptions تنظیمات فرآیند Polling
type PromoteChatMemberRequest ¶
type PromoteChatMemberRequest struct {
ChatID string `json:"chat_id"`
UserID string `json:"user_id"`
IsAdministrator *bool `json:"is_administrator,omitempty"`
CanChangeInfo *bool `json:"can_change_info,omitempty"`
CanPostMessages *bool `json:"can_post_messages,omitempty"`
CanEditMessages *bool `json:"can_edit_messages,omitempty"`
CanDeleteMessages *bool `json:"can_delete_messages,omitempty"`
CanInviteUsers *bool `json:"can_invite_users,omitempty"`
CanPinMessages *bool `json:"can_pin_messages,omitempty"`
CanManageVideoChats *bool `json:"can_manage_video_chats,omitempty"`
CanManageChat *bool `json:"can_manage_chat,omitempty"`
CanManageTopics *bool `json:"can_manage_topics,omitempty"`
}
PromoteChatMemberRequest درخواست ارتقای عضو چت
type ReceiveInlineMessageRequest ¶
type ReceiveInlineMessageRequest struct {
InlineMessage *InlineMessage `json:"inline_message"`
}
ReceiveInlineMessageRequest درخواست دریافت پیام اینلاین (برای وبهوک)
type ReceiveQueryRequest ¶
type ReceiveQueryRequest struct {
// نکته: این فیلد در وبهوک به صورت string برگردانده میشود.
QueryID string `json:"query_id"`
ChatID string `json:"chat_id"`
SenderID string `json:"sender_id"`
Data string `json:"data"`
}
ReceiveQueryRequest درخواست دریافت کوئری (برای وبهوک)
type ReceiveUpdateRequest ¶
type ReceiveUpdateRequest struct {
Update *Update `json:"update"`
}
ReceiveUpdateRequest درخواست دریافت آپدیتها (برای وبهوک)
type ReloadManager ¶
type ReloadManager struct {
// contains filtered or unexported fields
}
ReloadManager مدیریت قابلیت بارگذاری مجدد (Hot-Reload)
func NewReloadManager ¶
func NewReloadManager(client *BotClient) *ReloadManager
NewReloadManager ایجاد یک نمونه جدید از ReloadManager
func (*ReloadManager) OnReload ¶
func (rm *ReloadManager) OnReload(fn func())
OnReload ثبت یک تابع برای اجرا پس از هر بارگذاری مجدد
func (*ReloadManager) StartWatching ¶
func (rm *ReloadManager) StartWatching()
StartWatching شروع نظارت بر تغییرات فایلها
func (*ReloadManager) StopWatching ¶
func (rm *ReloadManager) StopWatching()
StopWatching توقف نظارت بر تغییرات فایلها
func (*ReloadManager) TriggerReload ¶
func (rm *ReloadManager) TriggerReload()
TriggerReload اجرای فرآیند بارگذاری مجدد
type ReplyKeyboardMarkup ¶
type ReplyKeyboardMarkup struct {
Keyboard [][]*KeyboardButton `json:"keyboard"`
IsPersistent bool `json:"is_persistent,omitempty"`
ResizeKeyboard bool `json:"resize_keyboard,omitempty"`
OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"`
InputFieldPlaceholder string `json:"input_field_placeholder,omitempty"`
Selective bool `json:"selective,omitempty"`
}
ReplyKeyboardMarkup کیبورد پاسخ
func NewReplyKeyboard ¶
func NewReplyKeyboard(rows ...[]*KeyboardButton) *ReplyKeyboardMarkup
NewReplyKeyboard ایجاد یک کیبورد پاسخ
func (*ReplyKeyboardMarkup) WithOneTimeKeyboard ¶
func (kb *ReplyKeyboardMarkup) WithOneTimeKeyboard(oneTime bool) *ReplyKeyboardMarkup
WithOneTimeKeyboard تنظیم کیبورد یکبار مصرف
func (*ReplyKeyboardMarkup) WithResizeKeyboard ¶
func (kb *ReplyKeyboardMarkup) WithResizeKeyboard(resize bool) *ReplyKeyboardMarkup
WithResizeKeyboard تنظیم تغییر اندازه کیبورد
type ReplyKeyboardRemove ¶
type ReplyKeyboardRemove struct {
RemoveKeyboard bool `json:"remove_keyboard"`
Selective bool `json:"selective,omitempty"`
}
ReplyKeyboardRemove حذف کیبورد پاسخ
func NewRemoveKeyboard ¶
func NewRemoveKeyboard() *ReplyKeyboardRemove
NewRemoveKeyboard ایجاد یک دستور برای حذف کیبورد
type RequestSendFileRequest ¶
type RequestSendFileRequest struct {
Type FileTypeEnum `json:"type"`
}
RequestSendFileRequest درخواست آدرس آپلود
type RequestSendFileResponse ¶
type RequestSendFileResponse struct {
UploadURL string `json:"upload_url"`
}
RequestSendFileResponse پاسخ حاوی آدرس آپلود
type ResponseParameters ¶
type ResponseParameters struct {
MigrateToChatID int64 `json:"migrate_to_chat_id,omitempty"`
RetryAfter int `json:"retry_after,omitempty"`
}
ResponseParameters پارامترهای پاسخ
type SearchSelectionItemsRequest ¶
type SearchSelectionItemsRequest struct {
SelectionID string `json:"selection_id"`
Query string `json:"query"`
}
SearchSelectionItemsRequest درخواست جستجوی آیتمهای انتخابی
type SearchSelectionItemsResponse ¶
type SearchSelectionItemsResponse struct {
Items []ButtonSelectionItem `json:"items"`
}
SearchSelectionItemsResponse پاسخ جستجوی آیتمهای انتخابی
type SendContactRequest ¶
type SendContactRequest struct {
ChatID string `json:"chat_id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
PhoneNumber string `json:"phone_number"`
DisableNotification bool `json:"disable_notification,omitempty"`
ReplyToMessageID string `json:"reply_to_message_id,omitempty"`
InlineKeyboardMarkup *InlineKeyboardMarkup `json:"inline_keyboard,omitempty"`
ReplyKeyboardMarkup *ReplyKeyboardMarkup `json:"reply_keyboard,omitempty"`
}
SendContactRequest درخواست ارسال مخاطب
type SendFileRequest ¶
type SendFileRequest struct {
ChatID string `json:"chat_id"`
FileID string `json:"file_id"`
Text string `json:"text,omitempty"`
ReplyToMessageID string `json:"reply_to_message_id,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
InlineKeyboardMarkup *InlineKeyboardMarkup `json:"inline_keyboard,omitempty"`
ReplyKeyboardMarkup *ReplyKeyboardMarkup `json:"reply_keyboard,omitempty"`
}
SendFileRequest درخواست ارسال فایل
type SendLocationRequest ¶
type SendLocationRequest struct {
ChatID string `json:"chat_id"`
Latitude string `json:"latitude"`
Longitude string `json:"longitude"`
DisableNotification bool `json:"disable_notification,omitempty"`
ReplyToMessageID string `json:"reply_to_message_id,omitempty"`
InlineKeyboardMarkup *InlineKeyboardMarkup `json:"inline_keyboard,omitempty"`
ReplyKeyboardMarkup *ReplyKeyboardMarkup `json:"reply_keyboard,omitempty"`
}
SendLocationRequest درخواست ارسال موقعیت مکانی
type SendMessageRequest ¶
type SendMessageRequest struct {
ChatID string `json:"chat_id"`
Text string `json:"text"`
DisableNotification bool `json:"disable_notification,omitempty"`
ReplyToMessageID string `json:"reply_to_message_id,omitempty"`
InlineKeyboardMarkup *InlineKeyboardMarkup `json:"inline_keyboard,omitempty"`
ReplyKeyboardMarkup *ReplyKeyboardMarkup `json:"reply_keyboard,omitempty"`
}
SendMessageRequest درخواست ارسال پیام
type SendPollRequest ¶
type SendPollRequest struct {
ChatID string `json:"chat_id"`
Question string `json:"question"`
Options []string `json:"options"`
}
SendPollRequest درخواست ارسال نظرسنجی
type SetCommandsRequest ¶
type SetCommandsRequest struct {
BotCommands []BotCommand `json:"bot_commands"`
}
SetCommandsRequest درخواست تنظیم دستورات بات
type StateManager ¶
type StateManager struct {
// contains filtered or unexported fields
}
StateManager برای مدیریت وضعیتهای کاربران
func NewStateManager ¶
func NewStateManager() *StateManager
NewStateManager یک نمونه جدید از StateManager ایجاد میکند
func (*StateManager) DeleteState ¶
func (sm *StateManager) DeleteState(userID, key string)
DeleteState یک کلید را برای کاربر مشخص حذف میکند
func (*StateManager) DeleteUserState ¶
func (sm *StateManager) DeleteUserState(userID string)
DeleteUserState تمام وضعیتهای یک کاربر را حذف میکند
func (*StateManager) GetAllUserStates ¶
func (sm *StateManager) GetAllUserStates(userID string) (map[string]interface{}, bool)
GetAllUserStates تمام وضعیتهای یک کاربر را برمیگرداند
func (*StateManager) GetState ¶
func (sm *StateManager) GetState(userID, key string) (interface{}, bool)
GetState یک مقدار را برای کاربر و کلید مشخص برمیگرداند
func (*StateManager) SetState ¶
func (sm *StateManager) SetState(userID, key string, value interface{})
SetState یک مقدار را برای کاربر مشخص ذخیره میکند
type Sticker ¶
type Sticker struct {
StickerID string `json:"sticker_id"`
File *File `json:"file"`
EmojiCharacter string `json:"emoji_character"`
}
Sticker استیکر
type UnbanChatMemberRequest ¶
type UnbanChatMemberRequest struct {
ChatID string `json:"chat_id"`
UserID string `json:"user_id"`
}
UnbanChatMemberRequest درخواست رفع مسدودیت عضو چت
type UnpinChatMessageRequest ¶
type UnpinChatMessageRequest struct {
ChatID string `json:"chat_id"`
MessageID string `json:"message_id"`
}
UnpinChatMessageRequest درخواست آنپین کردن پیام
type Update ¶
type Update struct {
Type UpdateTypeEnum `json:"type"`
ChatID string `json:"chat_id"`
// نکته: در API این فیلد به صورت string برگردانده میشود.
RemovedMessageID *string `json:"removed_message_id"`
NewMessage *Message `json:"new_message"`
UpdatedMessage *Message `json:"updated_message"`
UpdatedPayment *PaymentStatus `json:"updated_payment"`
}
Update آپدیت
type UpdateBotEndpointsRequest ¶
type UpdateBotEndpointsRequest struct {
URL string `json:"url"`
Type UpdateEndpointTypeEnum `json:"type"`
}
UpdateBotEndpointsRequest درخواست بهروزرسانی endpointهای بات
type UpdateEndpointTypeEnum ¶
type UpdateEndpointTypeEnum string
const ( ReceiveUpdate UpdateEndpointTypeEnum = "ReceiveUpdate" ReceiveInlineMessage UpdateEndpointTypeEnum = "ReceiveInlineMessage" ReceiveQuery UpdateEndpointTypeEnum = "ReceiveQuery" GetSelectionItem UpdateEndpointTypeEnum = "GetSelectionItem" SearchSelectionItems UpdateEndpointTypeEnum = "SearchSelectionItems" )
type UpdateTypeEnum ¶
type UpdateTypeEnum string
const ( UpdatedMessage UpdateTypeEnum = "UpdatedMessage" NewMessage UpdateTypeEnum = "NewMessage" RemovedMessage UpdateTypeEnum = "RemovedMessage" StartedBot UpdateTypeEnum = "StartedBot" StoppedBot UpdateTypeEnum = "StoppedBot" UpdatedPayment UpdateTypeEnum = "UpdatedPayment" CallbackQuery UpdateTypeEnum = "CallbackQuery" // نوع جدید برای کوئریهای دکمه InlineQuery UpdateTypeEnum = "InlineQuery" // نوع جدید برای کوئریهای اینلاین )
type User ¶
type User struct {
UserID string `json:"user_id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Username string `json:"username"`
Bio string `json:"bio"`
IsVerified bool `json:"is_verified"`
IsPrivate bool `json:"is_private"`
Avatar *File `json:"avatar"`
LastSeen string `json:"last_seen"`
}
User اطلاعات کاربر
type WebAppInfo ¶
type WebAppInfo struct {
URL string `json:"url"`
}
WebAppInfo اطلاعات برای دکمه وب اپ
type WebhookOptions ¶
type WebhookOptions struct {
Port int
Path string
Handler HandlerFunc
Secret string // برای احراز هویت (امنیت)
}
WebhookOptions تنظیمات وبهوک