-
Notifications
You must be signed in to change notification settings - Fork 11
/
botmanager.go
81 lines (60 loc) · 2.99 KB
/
botmanager.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package telego
import (
objs "github.com/SakoDroid/telego/objects"
)
// botManager is a tool for manaing personal info of the bot.
type botManager struct {
bot *Bot
}
/*
GetMe returns the received informations about the bot from api server.
---------------------
Official telegarm doc :
A simple method for testing your bot's authentication token. Requires no parameters. Returns basic information about the bot in form of a User object.
*/
func (bm *botManager) GetMe() (*objs.Result[*objs.User], error) {
return bm.bot.apiInterface.GetMe()
}
/*
SetDescription sets the description of the bot for the specified langauge. Description is shown in the chat with the bot if the chat is empty.
Arguments :
1. description : New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language.
2. languageCode : A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description.
*/
func (bm *botManager) SetDescription(description, languageCode string) (*objs.Result[bool], error) {
return bm.bot.apiInterface.SetMyDescription(description, languageCode)
}
/*
SetShortDescription sets the short description of the bot for the specified langauge. Short description is shown on the bot's profile page and is sent together with the link when users share the bot.
Arguments :
1. shortDescription : New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language.
2. languageCode : A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description.
*/
func (bm *botManager) SetShortDescription(shortDescription, languageCode string) (*objs.Result[bool], error) {
return bm.bot.apiInterface.SetMyShortDescription(shortDescription, languageCode)
}
/*
GetDescription returns description of the bot based on the specified language.
*/
func (bm *botManager) GetDescription(languageCode string) (*objs.Result[*objs.BotDescription], error) {
return bm.bot.apiInterface.GetMyDescription(languageCode)
}
/*
GetShortDescription returns short description of the bot based on the specified language.
*/
func (bm *botManager) GetShortDescription(languageCode string) (*objs.Result[*objs.BotDescription], error) {
return bm.bot.apiInterface.GetMyDescription(languageCode)
}
// GetName returns the bot's name according to the language code
func (bm *botManager) GetName(languageCode string) (*objs.Result[*objs.BotName], error) {
return bm.bot.apiInterface.GetMyName(languageCode)
}
/*
SetName sets bot's name in the specified language
Arguments :
1. name : bot's new name
2. languageCode : A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name.
*/
func (bm *botManager) SetName(name, languageCode string) (*objs.Result[bool], error) {
return bm.bot.apiInterface.SetMyName(name, languageCode)
}