_id stringlengths 2 7 | title stringlengths 1 118 | partition stringclasses 3
values | text stringlengths 52 85.5k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q31300 | NewStickerShare | train | func NewStickerShare(chatID int64, fileID string) StickerConfig {
return StickerConfig{
BaseFile: BaseFile{
BaseChat: BaseChat{ChatID: chatID},
FileID: fileID,
UseExisting: true,
},
}
} | go | {
"resource": ""
} |
q31301 | NewVideoUpload | train | func NewVideoUpload(chatID int64, file interface{}) VideoConfig {
return VideoConfig{
BaseFile: BaseFile{
BaseChat: BaseChat{ChatID: chatID},
File: file,
UseExisting: false,
},
}
} | go | {
"resource": ""
} |
q31302 | NewVideoShare | train | func NewVideoShare(chatID int64, fileID string) VideoConfig {
return VideoConfig{
BaseFile: BaseFile{
BaseChat: BaseChat{ChatID: chatID},
FileID: fileID,
UseExisting: true,
},
}
} | go | {
"resource": ""
} |
q31303 | NewAnimationUpload | train | func NewAnimationUpload(chatID int64, file interface{}) AnimationConfig {
return AnimationConfig{
BaseFile: BaseFile{
BaseChat: BaseChat{ChatID: chatID},
File: file,
UseExisting: false,
},
}
} | go | {
"resource": ""
} |
q31304 | NewAnimationShare | train | func NewAnimationShare(chatID int64, fileID string) AnimationConfig {
return AnimationConfig{
BaseFile: BaseFile{
BaseChat: BaseChat{ChatID: chatID},
FileID: fileID,
UseExisting: true,
},
}
} | go | {
"resource": ""
} |
q31305 | NewVideoNoteUpload | train | func NewVideoNoteUpload(chatID int64, length int, file interface{}) VideoNoteConfig {
return VideoNoteConfig{
BaseFile: BaseFile{
BaseChat: BaseChat{ChatID: chatID},
File: file,
UseExisting: false,
},
Length: length,
}
} | go | {
"resource": ""
} |
q31306 | NewVideoNoteShare | train | func NewVideoNoteShare(chatID int64, length int, fileID string) VideoNoteConfig {
return VideoNoteConfig{
BaseFile: BaseFile{
BaseChat: BaseChat{ChatID: chatID},
FileID: fileID,
UseExisting: true,
},
Length: length,
}
} | go | {
"resource": ""
} |
q31307 | NewVoiceUpload | train | func NewVoiceUpload(chatID int64, file interface{}) VoiceConfig {
return VoiceConfig{
BaseFile: BaseFile{
BaseChat: BaseChat{ChatID: chatID},
File: file,
UseExisting: false,
},
}
} | go | {
"resource": ""
} |
q31308 | NewVoiceShare | train | func NewVoiceShare(chatID int64, fileID string) VoiceConfig {
return VoiceConfig{
BaseFile: BaseFile{
BaseChat: BaseChat{ChatID: chatID},
FileID: fileID,
UseExisting: true,
},
}
} | go | {
"resource": ""
} |
q31309 | NewMediaGroup | train | func NewMediaGroup(chatID int64, files []interface{}) MediaGroupConfig {
return MediaGroupConfig{
BaseChat: BaseChat{
ChatID: chatID,
},
InputMedia: files,
}
} | go | {
"resource": ""
} |
q31310 | NewContact | train | func NewContact(chatID int64, phoneNumber, firstName string) ContactConfig {
return ContactConfig{
BaseChat: BaseChat{
ChatID: chatID,
},
PhoneNumber: phoneNumber,
FirstName: firstName,
}
} | go | {
"resource": ""
} |
q31311 | NewLocation | train | func NewLocation(chatID int64, latitude float64, longitude float64) LocationConfig {
return LocationConfig{
BaseChat: BaseChat{
ChatID: chatID,
},
Latitude: latitude,
Longitude: longitude,
}
} | go | {
"resource": ""
} |
q31312 | NewVenue | train | func NewVenue(chatID int64, title, address string, latitude, longitude float64) VenueConfig {
return VenueConfig{
BaseChat: BaseChat{
ChatID: chatID,
},
Title: title,
Address: address,
Latitude: latitude,
Longitude: longitude,
}
} | go | {
"resource": ""
} |
q31313 | NewChatAction | train | func NewChatAction(chatID int64, action string) ChatActionConfig {
return ChatActionConfig{
BaseChat: BaseChat{ChatID: chatID},
Action: action,
}
} | go | {
"resource": ""
} |
q31314 | NewWebhook | train | func NewWebhook(link string) WebhookConfig {
u, _ := url.Parse(link)
return WebhookConfig{
URL: u,
}
} | go | {
"resource": ""
} |
q31315 | NewWebhookWithCert | train | func NewWebhookWithCert(link string, file interface{}) WebhookConfig {
u, _ := url.Parse(link)
return WebhookConfig{
URL: u,
Certificate: file,
}
} | go | {
"resource": ""
} |
q31316 | NewInlineQueryResultArticle | train | func NewInlineQueryResultArticle(id, title, messageText string) InlineQueryResultArticle {
return InlineQueryResultArticle{
Type: "article",
ID: id,
Title: title,
InputMessageContent: InputTextMessageContent{
Text: messageText,
},
}
} | go | {
"resource": ""
} |
q31317 | NewInlineQueryResultArticleMarkdown | train | func NewInlineQueryResultArticleMarkdown(id, title, messageText string) InlineQueryResultArticle {
return InlineQueryResultArticle{
Type: "article",
ID: id,
Title: title,
InputMessageContent: InputTextMessageContent{
Text: messageText,
ParseMode: "Markdown",
},
}
} | go | {
"resource": ""
} |
q31318 | NewInlineQueryResultGIF | train | func NewInlineQueryResultGIF(id, url string) InlineQueryResultGIF {
return InlineQueryResultGIF{
Type: "gif",
ID: id,
URL: url,
}
} | go | {
"resource": ""
} |
q31319 | NewInlineQueryResultCachedGIF | train | func NewInlineQueryResultCachedGIF(id, gifID string) InlineQueryResultCachedGIF {
return InlineQueryResultCachedGIF{
Type: "gif",
ID: id,
GifID: gifID,
}
} | go | {
"resource": ""
} |
q31320 | NewInlineQueryResultMPEG4GIF | train | func NewInlineQueryResultMPEG4GIF(id, url string) InlineQueryResultMPEG4GIF {
return InlineQueryResultMPEG4GIF{
Type: "mpeg4_gif",
ID: id,
URL: url,
}
} | go | {
"resource": ""
} |
q31321 | NewInlineQueryResultPhoto | train | func NewInlineQueryResultPhoto(id, url string) InlineQueryResultPhoto {
return InlineQueryResultPhoto{
Type: "photo",
ID: id,
URL: url,
}
} | go | {
"resource": ""
} |
q31322 | NewInlineQueryResultPhotoWithThumb | train | func NewInlineQueryResultPhotoWithThumb(id, url, thumb string) InlineQueryResultPhoto {
return InlineQueryResultPhoto{
Type: "photo",
ID: id,
URL: url,
ThumbURL: thumb,
}
} | go | {
"resource": ""
} |
q31323 | NewInlineQueryResultVideo | train | func NewInlineQueryResultVideo(id, url string) InlineQueryResultVideo {
return InlineQueryResultVideo{
Type: "video",
ID: id,
URL: url,
}
} | go | {
"resource": ""
} |
q31324 | NewInlineQueryResultCachedVideo | train | func NewInlineQueryResultCachedVideo(id, videoID, title string) InlineQueryResultCachedVideo {
return InlineQueryResultCachedVideo{
Type: "video",
ID: id,
VideoID: videoID,
Title: title,
}
} | go | {
"resource": ""
} |
q31325 | NewInlineQueryResultAudio | train | func NewInlineQueryResultAudio(id, url, title string) InlineQueryResultAudio {
return InlineQueryResultAudio{
Type: "audio",
ID: id,
URL: url,
Title: title,
}
} | go | {
"resource": ""
} |
q31326 | NewInlineQueryResultCachedAudio | train | func NewInlineQueryResultCachedAudio(id, audioID string) InlineQueryResultCachedAudio {
return InlineQueryResultCachedAudio{
Type: "audio",
ID: id,
AudioID: audioID,
}
} | go | {
"resource": ""
} |
q31327 | NewInlineQueryResultVoice | train | func NewInlineQueryResultVoice(id, url, title string) InlineQueryResultVoice {
return InlineQueryResultVoice{
Type: "voice",
ID: id,
URL: url,
Title: title,
}
} | go | {
"resource": ""
} |
q31328 | NewInlineQueryResultCachedVoice | train | func NewInlineQueryResultCachedVoice(id, voiceID, title string) InlineQueryResultCachedVoice {
return InlineQueryResultCachedVoice{
Type: "voice",
ID: id,
VoiceID: voiceID,
Title: title,
}
} | go | {
"resource": ""
} |
q31329 | NewInlineQueryResultDocument | train | func NewInlineQueryResultDocument(id, url, title, mimeType string) InlineQueryResultDocument {
return InlineQueryResultDocument{
Type: "document",
ID: id,
URL: url,
Title: title,
MimeType: mimeType,
}
} | go | {
"resource": ""
} |
q31330 | NewInlineQueryResultCachedDocument | train | func NewInlineQueryResultCachedDocument(id, documentID, title string) InlineQueryResultCachedDocument {
return InlineQueryResultCachedDocument{
Type: "document",
ID: id,
DocumentID: documentID,
Title: title,
}
} | go | {
"resource": ""
} |
q31331 | NewInlineQueryResultLocation | train | func NewInlineQueryResultLocation(id, title string, latitude, longitude float64) InlineQueryResultLocation {
return InlineQueryResultLocation{
Type: "location",
ID: id,
Title: title,
Latitude: latitude,
Longitude: longitude,
}
} | go | {
"resource": ""
} |
q31332 | NewEditMessageText | train | func NewEditMessageText(chatID int64, messageID int, text string) EditMessageTextConfig {
return EditMessageTextConfig{
BaseEdit: BaseEdit{
ChatID: chatID,
MessageID: messageID,
},
Text: text,
}
} | go | {
"resource": ""
} |
q31333 | NewEditMessageCaption | train | func NewEditMessageCaption(chatID int64, messageID int, caption string) EditMessageCaptionConfig {
return EditMessageCaptionConfig{
BaseEdit: BaseEdit{
ChatID: chatID,
MessageID: messageID,
},
Caption: caption,
}
} | go | {
"resource": ""
} |
q31334 | NewEditMessageReplyMarkup | train | func NewEditMessageReplyMarkup(chatID int64, messageID int, replyMarkup InlineKeyboardMarkup) EditMessageReplyMarkupConfig {
return EditMessageReplyMarkupConfig{
BaseEdit: BaseEdit{
ChatID: chatID,
MessageID: messageID,
ReplyMarkup: &replyMarkup,
},
}
} | go | {
"resource": ""
} |
q31335 | NewHideKeyboard | train | func NewHideKeyboard(selective bool) ReplyKeyboardHide {
log.Println("NewHideKeyboard is deprecated, please use NewRemoveKeyboard")
return ReplyKeyboardHide{
HideKeyboard: true,
Selective: selective,
}
} | go | {
"resource": ""
} |
q31336 | NewKeyboardButtonRow | train | func NewKeyboardButtonRow(buttons ...KeyboardButton) []KeyboardButton {
var row []KeyboardButton
row = append(row, buttons...)
return row
} | go | {
"resource": ""
} |
q31337 | NewReplyKeyboard | train | func NewReplyKeyboard(rows ...[]KeyboardButton) ReplyKeyboardMarkup {
var keyboard [][]KeyboardButton
keyboard = append(keyboard, rows...)
return ReplyKeyboardMarkup{
ResizeKeyboard: true,
Keyboard: keyboard,
}
} | go | {
"resource": ""
} |
q31338 | NewInlineKeyboardButtonData | train | func NewInlineKeyboardButtonData(text, data string) InlineKeyboardButton {
return InlineKeyboardButton{
Text: text,
CallbackData: &data,
}
} | go | {
"resource": ""
} |
q31339 | NewInlineKeyboardButtonURL | train | func NewInlineKeyboardButtonURL(text, url string) InlineKeyboardButton {
return InlineKeyboardButton{
Text: text,
URL: &url,
}
} | go | {
"resource": ""
} |
q31340 | NewInlineKeyboardButtonSwitch | train | func NewInlineKeyboardButtonSwitch(text, sw string) InlineKeyboardButton {
return InlineKeyboardButton{
Text: text,
SwitchInlineQuery: &sw,
}
} | go | {
"resource": ""
} |
q31341 | NewInlineKeyboardRow | train | func NewInlineKeyboardRow(buttons ...InlineKeyboardButton) []InlineKeyboardButton {
var row []InlineKeyboardButton
row = append(row, buttons...)
return row
} | go | {
"resource": ""
} |
q31342 | NewInlineKeyboardMarkup | train | func NewInlineKeyboardMarkup(rows ...[]InlineKeyboardButton) InlineKeyboardMarkup {
var keyboard [][]InlineKeyboardButton
keyboard = append(keyboard, rows...)
return InlineKeyboardMarkup{
InlineKeyboard: keyboard,
}
} | go | {
"resource": ""
} |
q31343 | NewCallback | train | func NewCallback(id, text string) CallbackConfig {
return CallbackConfig{
CallbackQueryID: id,
Text: text,
ShowAlert: false,
}
} | go | {
"resource": ""
} |
q31344 | NewCallbackWithAlert | train | func NewCallbackWithAlert(id, text string) CallbackConfig {
return CallbackConfig{
CallbackQueryID: id,
Text: text,
ShowAlert: true,
}
} | go | {
"resource": ""
} |
q31345 | NewInvoice | train | func NewInvoice(chatID int64, title, description, payload, providerToken, startParameter, currency string, prices *[]LabeledPrice) InvoiceConfig {
return InvoiceConfig{
BaseChat: BaseChat{ChatID: chatID},
Title: title,
Description: description,
Payload: payload,
ProviderToken: provi... | go | {
"resource": ""
} |
q31346 | NewSetChatPhotoUpload | train | func NewSetChatPhotoUpload(chatID int64, file interface{}) SetChatPhotoConfig {
return SetChatPhotoConfig{
BaseFile: BaseFile{
BaseChat: BaseChat{ChatID: chatID},
File: file,
UseExisting: false,
},
}
} | go | {
"resource": ""
} |
q31347 | NewSetChatPhotoShare | train | func NewSetChatPhotoShare(chatID int64, fileID string) SetChatPhotoConfig {
return SetChatPhotoConfig{
BaseFile: BaseFile{
BaseChat: BaseChat{ChatID: chatID},
FileID: fileID,
UseExisting: true,
},
}
} | go | {
"resource": ""
} |
q31348 | Time | train | func (m *Message) Time() time.Time {
return time.Unix(int64(m.Date), 0)
} | go | {
"resource": ""
} |
q31349 | IsCommand | train | func (m *Message) IsCommand() bool {
if m.Entities == nil || len(*m.Entities) == 0 {
return false
}
entity := (*m.Entities)[0]
return entity.Offset == 0 && entity.IsCommand()
} | go | {
"resource": ""
} |
q31350 | ParseURL | train | func (e MessageEntity) ParseURL() (*url.URL, error) {
if e.URL == "" {
return nil, errors.New(ErrBadURL)
}
return url.Parse(e.URL)
} | go | {
"resource": ""
} |
q31351 | Link | train | func (f *File) Link(token string) string {
return fmt.Sprintf(FileEndpoint, token, f.FilePath)
} | go | {
"resource": ""
} |
q31352 | NewBotAPIWithClient | train | func NewBotAPIWithClient(token string, client *http.Client) (*BotAPI, error) {
bot := &BotAPI{
Token: token,
Client: client,
Buffer: 100,
shutdownChannel: make(chan interface{}),
}
self, err := bot.GetMe()
if err != nil {
return nil, err
}
bot.Self = self
return bot, nil
} | go | {
"resource": ""
} |
q31353 | MakeRequest | train | func (bot *BotAPI) MakeRequest(endpoint string, params url.Values) (APIResponse, error) {
method := fmt.Sprintf(APIEndpoint, bot.Token, endpoint)
resp, err := bot.Client.PostForm(method, params)
if err != nil {
return APIResponse{}, err
}
defer resp.Body.Close()
var apiResp APIResponse
bytes, err := bot.deco... | go | {
"resource": ""
} |
q31354 | decodeAPIResponse | train | func (bot *BotAPI) decodeAPIResponse(responseBody io.Reader, resp *APIResponse) (_ []byte, err error) {
if !bot.Debug {
dec := json.NewDecoder(responseBody)
err = dec.Decode(resp)
return
}
// if debug, read reponse body
data, err := ioutil.ReadAll(responseBody)
if err != nil {
return
}
err = json.Unmar... | go | {
"resource": ""
} |
q31355 | makeMessageRequest | train | func (bot *BotAPI) makeMessageRequest(endpoint string, params url.Values) (Message, error) {
resp, err := bot.MakeRequest(endpoint, params)
if err != nil {
return Message{}, err
}
var message Message
json.Unmarshal(resp.Result, &message)
bot.debugLog(endpoint, params, message)
return message, nil
} | go | {
"resource": ""
} |
q31356 | UploadFile | train | func (bot *BotAPI) UploadFile(endpoint string, params map[string]string, fieldname string, file interface{}) (APIResponse, error) {
ms := multipartstreamer.New()
switch f := file.(type) {
case string:
ms.WriteFields(params)
fileHandle, err := os.Open(f)
if err != nil {
return APIResponse{}, err
}
defe... | go | {
"resource": ""
} |
q31357 | GetFileDirectURL | train | func (bot *BotAPI) GetFileDirectURL(fileID string) (string, error) {
file, err := bot.GetFile(FileConfig{fileID})
if err != nil {
return "", err
}
return file.Link(bot.Token), nil
} | go | {
"resource": ""
} |
q31358 | GetMe | train | func (bot *BotAPI) GetMe() (User, error) {
resp, err := bot.MakeRequest("getMe", nil)
if err != nil {
return User{}, err
}
var user User
json.Unmarshal(resp.Result, &user)
bot.debugLog("getMe", nil, user)
return user, nil
} | go | {
"resource": ""
} |
q31359 | IsMessageToMe | train | func (bot *BotAPI) IsMessageToMe(message Message) bool {
return strings.Contains(message.Text, "@"+bot.Self.UserName)
} | go | {
"resource": ""
} |
q31360 | Send | train | func (bot *BotAPI) Send(c Chattable) (Message, error) {
switch c.(type) {
case Fileable:
return bot.sendFile(c.(Fileable))
default:
return bot.sendChattable(c)
}
} | go | {
"resource": ""
} |
q31361 | debugLog | train | func (bot *BotAPI) debugLog(context string, v url.Values, message interface{}) {
if bot.Debug {
log.Printf("%s req : %+v\n", context, v)
log.Printf("%s resp: %+v\n", context, message)
}
} | go | {
"resource": ""
} |
q31362 | sendExisting | train | func (bot *BotAPI) sendExisting(method string, config Fileable) (Message, error) {
v, err := config.values()
if err != nil {
return Message{}, err
}
message, err := bot.makeMessageRequest(method, v)
if err != nil {
return Message{}, err
}
return message, nil
} | go | {
"resource": ""
} |
q31363 | uploadAndSend | train | func (bot *BotAPI) uploadAndSend(method string, config Fileable) (Message, error) {
params, err := config.params()
if err != nil {
return Message{}, err
}
file := config.getFile()
resp, err := bot.UploadFile(method, params, config.name(), file)
if err != nil {
return Message{}, err
}
var message Message
... | go | {
"resource": ""
} |
q31364 | sendFile | train | func (bot *BotAPI) sendFile(config Fileable) (Message, error) {
if config.useExistingFile() {
return bot.sendExisting(config.method(), config)
}
return bot.uploadAndSend(config.method(), config)
} | go | {
"resource": ""
} |
q31365 | sendChattable | train | func (bot *BotAPI) sendChattable(config Chattable) (Message, error) {
v, err := config.values()
if err != nil {
return Message{}, err
}
message, err := bot.makeMessageRequest(config.method(), v)
if err != nil {
return Message{}, err
}
return message, nil
} | go | {
"resource": ""
} |
q31366 | GetUserProfilePhotos | train | func (bot *BotAPI) GetUserProfilePhotos(config UserProfilePhotosConfig) (UserProfilePhotos, error) {
v := url.Values{}
v.Add("user_id", strconv.Itoa(config.UserID))
if config.Offset != 0 {
v.Add("offset", strconv.Itoa(config.Offset))
}
if config.Limit != 0 {
v.Add("limit", strconv.Itoa(config.Limit))
}
resp... | go | {
"resource": ""
} |
q31367 | GetFile | train | func (bot *BotAPI) GetFile(config FileConfig) (File, error) {
v := url.Values{}
v.Add("file_id", config.FileID)
resp, err := bot.MakeRequest("getFile", v)
if err != nil {
return File{}, err
}
var file File
json.Unmarshal(resp.Result, &file)
bot.debugLog("GetFile", v, file)
return file, nil
} | go | {
"resource": ""
} |
q31368 | GetUpdates | train | func (bot *BotAPI) GetUpdates(config UpdateConfig) ([]Update, error) {
v := url.Values{}
if config.Offset != 0 {
v.Add("offset", strconv.Itoa(config.Offset))
}
if config.Limit > 0 {
v.Add("limit", strconv.Itoa(config.Limit))
}
if config.Timeout > 0 {
v.Add("timeout", strconv.Itoa(config.Timeout))
}
resp,... | go | {
"resource": ""
} |
q31369 | SetWebhook | train | func (bot *BotAPI) SetWebhook(config WebhookConfig) (APIResponse, error) {
if config.Certificate == nil {
v := url.Values{}
v.Add("url", config.URL.String())
if config.MaxConnections != 0 {
v.Add("max_connections", strconv.Itoa(config.MaxConnections))
}
return bot.MakeRequest("setWebhook", v)
}
param... | go | {
"resource": ""
} |
q31370 | GetWebhookInfo | train | func (bot *BotAPI) GetWebhookInfo() (WebhookInfo, error) {
resp, err := bot.MakeRequest("getWebhookInfo", url.Values{})
if err != nil {
return WebhookInfo{}, err
}
var info WebhookInfo
err = json.Unmarshal(resp.Result, &info)
return info, err
} | go | {
"resource": ""
} |
q31371 | GetUpdatesChan | train | func (bot *BotAPI) GetUpdatesChan(config UpdateConfig) (UpdatesChannel, error) {
ch := make(chan Update, bot.Buffer)
go func() {
for {
select {
case <-bot.shutdownChannel:
return
default:
}
updates, err := bot.GetUpdates(config)
if err != nil {
log.Println(err)
log.Println("Failed... | go | {
"resource": ""
} |
q31372 | StopReceivingUpdates | train | func (bot *BotAPI) StopReceivingUpdates() {
if bot.Debug {
log.Println("Stopping the update receiver routine...")
}
close(bot.shutdownChannel)
} | go | {
"resource": ""
} |
q31373 | ListenForWebhook | train | func (bot *BotAPI) ListenForWebhook(pattern string) UpdatesChannel {
ch := make(chan Update, bot.Buffer)
http.HandleFunc(pattern, func(w http.ResponseWriter, r *http.Request) {
bytes, _ := ioutil.ReadAll(r.Body)
r.Body.Close()
var update Update
json.Unmarshal(bytes, &update)
ch <- update
})
return ch
... | go | {
"resource": ""
} |
q31374 | AnswerInlineQuery | train | func (bot *BotAPI) AnswerInlineQuery(config InlineConfig) (APIResponse, error) {
v := url.Values{}
v.Add("inline_query_id", config.InlineQueryID)
v.Add("cache_time", strconv.Itoa(config.CacheTime))
v.Add("is_personal", strconv.FormatBool(config.IsPersonal))
v.Add("next_offset", config.NextOffset)
data, err := js... | go | {
"resource": ""
} |
q31375 | AnswerCallbackQuery | train | func (bot *BotAPI) AnswerCallbackQuery(config CallbackConfig) (APIResponse, error) {
v := url.Values{}
v.Add("callback_query_id", config.CallbackQueryID)
if config.Text != "" {
v.Add("text", config.Text)
}
v.Add("show_alert", strconv.FormatBool(config.ShowAlert))
if config.URL != "" {
v.Add("url", config.URL... | go | {
"resource": ""
} |
q31376 | KickChatMember | train | func (bot *BotAPI) KickChatMember(config KickChatMemberConfig) (APIResponse, error) {
v := url.Values{}
if config.SuperGroupUsername == "" {
v.Add("chat_id", strconv.FormatInt(config.ChatID, 10))
} else {
v.Add("chat_id", config.SuperGroupUsername)
}
v.Add("user_id", strconv.Itoa(config.UserID))
if config.U... | go | {
"resource": ""
} |
q31377 | LeaveChat | train | func (bot *BotAPI) LeaveChat(config ChatConfig) (APIResponse, error) {
v := url.Values{}
if config.SuperGroupUsername == "" {
v.Add("chat_id", strconv.FormatInt(config.ChatID, 10))
} else {
v.Add("chat_id", config.SuperGroupUsername)
}
bot.debugLog("leaveChat", v, nil)
return bot.MakeRequest("leaveChat", v... | go | {
"resource": ""
} |
q31378 | GetChat | train | func (bot *BotAPI) GetChat(config ChatConfig) (Chat, error) {
v := url.Values{}
if config.SuperGroupUsername == "" {
v.Add("chat_id", strconv.FormatInt(config.ChatID, 10))
} else {
v.Add("chat_id", config.SuperGroupUsername)
}
resp, err := bot.MakeRequest("getChat", v)
if err != nil {
return Chat{}, err
... | go | {
"resource": ""
} |
q31379 | GetChatAdministrators | train | func (bot *BotAPI) GetChatAdministrators(config ChatConfig) ([]ChatMember, error) {
v := url.Values{}
if config.SuperGroupUsername == "" {
v.Add("chat_id", strconv.FormatInt(config.ChatID, 10))
} else {
v.Add("chat_id", config.SuperGroupUsername)
}
resp, err := bot.MakeRequest("getChatAdministrators", v)
if... | go | {
"resource": ""
} |
q31380 | GetChatMembersCount | train | func (bot *BotAPI) GetChatMembersCount(config ChatConfig) (int, error) {
v := url.Values{}
if config.SuperGroupUsername == "" {
v.Add("chat_id", strconv.FormatInt(config.ChatID, 10))
} else {
v.Add("chat_id", config.SuperGroupUsername)
}
resp, err := bot.MakeRequest("getChatMembersCount", v)
if err != nil {... | go | {
"resource": ""
} |
q31381 | GetChatMember | train | func (bot *BotAPI) GetChatMember(config ChatConfigWithUser) (ChatMember, error) {
v := url.Values{}
if config.SuperGroupUsername == "" {
v.Add("chat_id", strconv.FormatInt(config.ChatID, 10))
} else {
v.Add("chat_id", config.SuperGroupUsername)
}
v.Add("user_id", strconv.Itoa(config.UserID))
resp, err := bo... | go | {
"resource": ""
} |
q31382 | UnbanChatMember | train | func (bot *BotAPI) UnbanChatMember(config ChatMemberConfig) (APIResponse, error) {
v := url.Values{}
if config.SuperGroupUsername != "" {
v.Add("chat_id", config.SuperGroupUsername)
} else if config.ChannelUsername != "" {
v.Add("chat_id", config.ChannelUsername)
} else {
v.Add("chat_id", strconv.FormatInt(c... | go | {
"resource": ""
} |
q31383 | RestrictChatMember | train | func (bot *BotAPI) RestrictChatMember(config RestrictChatMemberConfig) (APIResponse, error) {
v := url.Values{}
if config.SuperGroupUsername != "" {
v.Add("chat_id", config.SuperGroupUsername)
} else if config.ChannelUsername != "" {
v.Add("chat_id", config.ChannelUsername)
} else {
v.Add("chat_id", strconv.... | go | {
"resource": ""
} |
q31384 | PromoteChatMember | train | func (bot *BotAPI) PromoteChatMember(config PromoteChatMemberConfig) (APIResponse, error) {
v := url.Values{}
if config.SuperGroupUsername != "" {
v.Add("chat_id", config.SuperGroupUsername)
} else if config.ChannelUsername != "" {
v.Add("chat_id", config.ChannelUsername)
} else {
v.Add("chat_id", strconv.Fo... | go | {
"resource": ""
} |
q31385 | GetGameHighScores | train | func (bot *BotAPI) GetGameHighScores(config GetGameHighScoresConfig) ([]GameHighScore, error) {
v, _ := config.values()
resp, err := bot.MakeRequest(config.method(), v)
if err != nil {
return []GameHighScore{}, err
}
var highScores []GameHighScore
err = json.Unmarshal(resp.Result, &highScores)
return highSc... | go | {
"resource": ""
} |
q31386 | AnswerShippingQuery | train | func (bot *BotAPI) AnswerShippingQuery(config ShippingConfig) (APIResponse, error) {
v := url.Values{}
v.Add("shipping_query_id", config.ShippingQueryID)
v.Add("ok", strconv.FormatBool(config.OK))
if config.OK == true {
data, err := json.Marshal(config.ShippingOptions)
if err != nil {
return APIResponse{}, ... | go | {
"resource": ""
} |
q31387 | AnswerPreCheckoutQuery | train | func (bot *BotAPI) AnswerPreCheckoutQuery(config PreCheckoutConfig) (APIResponse, error) {
v := url.Values{}
v.Add("pre_checkout_query_id", config.PreCheckoutQueryID)
v.Add("ok", strconv.FormatBool(config.OK))
if config.OK != true {
v.Add("error", config.ErrorMessage)
}
bot.debugLog("answerPreCheckoutQuery", ... | go | {
"resource": ""
} |
q31388 | DeleteMessage | train | func (bot *BotAPI) DeleteMessage(config DeleteMessageConfig) (APIResponse, error) {
v, err := config.values()
if err != nil {
return APIResponse{}, err
}
bot.debugLog(config.method(), v, nil)
return bot.MakeRequest(config.method(), v)
} | go | {
"resource": ""
} |
q31389 | GetInviteLink | train | func (bot *BotAPI) GetInviteLink(config ChatConfig) (string, error) {
v := url.Values{}
if config.SuperGroupUsername == "" {
v.Add("chat_id", strconv.FormatInt(config.ChatID, 10))
} else {
v.Add("chat_id", config.SuperGroupUsername)
}
resp, err := bot.MakeRequest("exportChatInviteLink", v)
if err != nil {
... | go | {
"resource": ""
} |
q31390 | PinChatMessage | train | func (bot *BotAPI) PinChatMessage(config PinChatMessageConfig) (APIResponse, error) {
v, err := config.values()
if err != nil {
return APIResponse{}, err
}
bot.debugLog(config.method(), v, nil)
return bot.MakeRequest(config.method(), v)
} | go | {
"resource": ""
} |
q31391 | UnpinChatMessage | train | func (bot *BotAPI) UnpinChatMessage(config UnpinChatMessageConfig) (APIResponse, error) {
v, err := config.values()
if err != nil {
return APIResponse{}, err
}
bot.debugLog(config.method(), v, nil)
return bot.MakeRequest(config.method(), v)
} | go | {
"resource": ""
} |
q31392 | SetChatTitle | train | func (bot *BotAPI) SetChatTitle(config SetChatTitleConfig) (APIResponse, error) {
v, err := config.values()
if err != nil {
return APIResponse{}, err
}
bot.debugLog(config.method(), v, nil)
return bot.MakeRequest(config.method(), v)
} | go | {
"resource": ""
} |
q31393 | SetChatDescription | train | func (bot *BotAPI) SetChatDescription(config SetChatDescriptionConfig) (APIResponse, error) {
v, err := config.values()
if err != nil {
return APIResponse{}, err
}
bot.debugLog(config.method(), v, nil)
return bot.MakeRequest(config.method(), v)
} | go | {
"resource": ""
} |
q31394 | SetChatPhoto | train | func (bot *BotAPI) SetChatPhoto(config SetChatPhotoConfig) (APIResponse, error) {
params, err := config.params()
if err != nil {
return APIResponse{}, err
}
file := config.getFile()
return bot.UploadFile(config.method(), params, config.name(), file)
} | go | {
"resource": ""
} |
q31395 | DeleteChatPhoto | train | func (bot *BotAPI) DeleteChatPhoto(config DeleteChatPhotoConfig) (APIResponse, error) {
v, err := config.values()
if err != nil {
return APIResponse{}, err
}
bot.debugLog(config.method(), v, nil)
return bot.MakeRequest(config.method(), v)
} | go | {
"resource": ""
} |
q31396 | values | train | func (chat *BaseChat) values() (url.Values, error) {
v := url.Values{}
if chat.ChannelUsername != "" {
v.Add("chat_id", chat.ChannelUsername)
} else {
v.Add("chat_id", strconv.FormatInt(chat.ChatID, 10))
}
if chat.ReplyToMessageID != 0 {
v.Add("reply_to_message_id", strconv.Itoa(chat.ReplyToMessageID))
}
... | go | {
"resource": ""
} |
q31397 | values | train | func (config MessageConfig) values() (url.Values, error) {
v, err := config.BaseChat.values()
if err != nil {
return v, err
}
v.Add("text", config.Text)
v.Add("disable_web_page_preview", strconv.FormatBool(config.DisableWebPagePreview))
if config.ParseMode != "" {
v.Add("parse_mode", config.ParseMode)
}
re... | go | {
"resource": ""
} |
q31398 | values | train | func (config ForwardConfig) values() (url.Values, error) {
v, err := config.BaseChat.values()
if err != nil {
return v, err
}
v.Add("from_chat_id", strconv.FormatInt(config.FromChatID, 10))
v.Add("message_id", strconv.Itoa(config.MessageID))
return v, nil
} | go | {
"resource": ""
} |
q31399 | values | train | func (config DocumentConfig) values() (url.Values, error) {
v, err := config.BaseChat.values()
if err != nil {
return v, err
}
v.Add(config.name(), config.FileID)
if config.Caption != "" {
v.Add("caption", config.Caption)
if config.ParseMode != "" {
v.Add("parse_mode", config.ParseMode)
}
}
return v... | go | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.