Add additional fields to advertisemend methods

This commit is contained in:
Sam
2019-11-04 08:19:19 -05:00
parent 7263387124
commit b247e10f1b
3 changed files with 30 additions and 6 deletions

View File

@ -10,8 +10,8 @@ func ExampleKeybase_AdvertiseCommand() {
c := BotAdvertisement{
Type: "public",
BotCommands: []BotCommand{
NewBotCommand("help", "Get help using this bot"),
NewBotCommand("hello", "Say hello"),
NewBotCommand("help", "Get help using this bot", "!help <command>"),
NewBotCommand("hello", "Say hello", "!hello"),
},
}

View File

@ -37,10 +37,26 @@ func NewKeybase(path ...string) *Keybase {
}
// NewBotCommand returns a new BotCommand instance
func NewBotCommand(name string, description string) BotCommand {
return BotCommand{
func NewBotCommand(name, description, usage string, extendedDescription ...BotCommandExtendedDescription) BotCommand {
result := BotCommand{
Name: name,
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,
}
}

View File

@ -299,6 +299,14 @@ type Channel struct {
type BotCommand struct {
Name string `json:"name"`
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 {