Add additional fields to advertisemend methods
This commit is contained in:
@ -10,8 +10,8 @@ func ExampleKeybase_AdvertiseCommand() {
|
|||||||
c := BotAdvertisement{
|
c := BotAdvertisement{
|
||||||
Type: "public",
|
Type: "public",
|
||||||
BotCommands: []BotCommand{
|
BotCommands: []BotCommand{
|
||||||
NewBotCommand("help", "Get help using this bot"),
|
NewBotCommand("help", "Get help using this bot", "!help <command>"),
|
||||||
NewBotCommand("hello", "Say hello"),
|
NewBotCommand("hello", "Say hello", "!hello"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
20
keybase.go
20
keybase.go
@ -37,10 +37,26 @@ func NewKeybase(path ...string) *Keybase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewBotCommand returns a new BotCommand instance
|
// NewBotCommand returns a new BotCommand instance
|
||||||
func NewBotCommand(name string, description string) BotCommand {
|
func NewBotCommand(name, description, usage string, extendedDescription ...BotCommandExtendedDescription) BotCommand {
|
||||||
return BotCommand{
|
result := BotCommand{
|
||||||
Name: name,
|
Name: name,
|
||||||
Description: description,
|
Description: description,
|
||||||
|
Usage: usage,
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(extendedDescription) > 0 {
|
||||||
|
result.ExtendedDescription = &extendedDescription[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewBotCommandExtendedDescription
|
||||||
|
func NewBotCommandExtendedDescription(title, desktopBody, mobileBody string) BotCommandExtendedDescription {
|
||||||
|
return BotCommandExtendedDescription{
|
||||||
|
Title: title,
|
||||||
|
DesktopBody: desktopBody,
|
||||||
|
MobileBody: mobileBody,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
8
types.go
8
types.go
@ -299,6 +299,14 @@ type Channel struct {
|
|||||||
type BotCommand struct {
|
type BotCommand struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
|
Usage string `json:"usage"`
|
||||||
|
ExtendedDescription *BotCommandExtendedDescription `json:"extended_description,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type BotCommandExtendedDescription struct {
|
||||||
|
Title string `json:"title"`
|
||||||
|
DesktopBody string `json:"desktop_body"`
|
||||||
|
MobileBody string `json:"mobile_body"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type BotAdvertisement struct {
|
type BotAdvertisement struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user