Add additional fields to advertisemend methods
This commit is contained in:
@ -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"),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
20
keybase.go
20
keybase.go
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
8
types.go
8
types.go
@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user