123456789101112131415161718192021222324252627282930313233343536373839 |
- package tgbot
- import (
- "encoding/json"
- tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
- )
- func CreateChatInviteLink(botApi *tgbotapi.BotAPI, config tgbotapi.CreateChatInviteLinkConfig) (*tgbotapi.ChatInviteLink, error) {
- resp, err := botApi.Request(config)
- if err != nil {
- return nil, err
- }
- var message tgbotapi.ChatInviteLink
- err = json.Unmarshal(resp.Result, &message)
- if err != nil {
- return nil, err
- }
- return &message, nil
- }
- func ApproveChatJoinRequest(botApi *tgbotapi.BotAPI, config tgbotapi.ApproveChatJoinRequestConfig) error {
- resp, err := botApi.Request(config)
- if err != nil {
- return err
- }
- var message tgbotapi.Message
- err = json.Unmarshal(resp.Result, &message)
- if err != nil {
- return err
- }
- return nil
- }
|