Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Command = &commands.YAGCommand{ CmdCategory: commands.CategoryFun, Name: "SimpleEmbed", Aliases: []string{"se"}, Description: "A more simpler version of CustomEmbed, controlled completely using switches.", ArgSwitches: []*dcmd.ArgDef{ &dcmd.ArgDef{Switch: "channel", Help: "Optional channel to send in", Type: dcmd.Channel}, &dcmd.ArgDef{Switch: "title", Type: dcmd.String, Default: ""}, &dcmd.ArgDef{Switch: "desc", Type: dcmd.String, Help: "Text in the 'description' field", Default: ""}, &dcmd.ArgDef{Switch: "color", Help: "Either hex code or name", Type: dcmd.String, Default: ""}, &dcmd.ArgDef{Switch: "url", Help: "Url of this embed", Type: dcmd.String, Default: ""}, &dcmd.ArgDef{Switch: "thumbnail", Help: "Url to a thumbnail", Type: dcmd.String, Default: ""}, &dcmd.ArgDef{Switch: "author", Help: "The text in the 'author' field", Type: dcmd.String, Default: ""}, &dcmd.ArgDef{Switch: "authoricon", Help: "Url to a icon for the 'author' field", Type: dcmd.String, Default: ""}, &dcmd.ArgDef{Switch: "footer", Help: "Text content for the footer", Type: dcmd.String, Default: ""}, &dcmd.ArgDef{Switch: "footericon", Help: "Url to a icon for the 'footer' field", Type: dcmd.String, Default: ""}, }, RunFunc: func(data *dcmd.Data) (interface{}, error) { embed := &discordgo.MessageEmbed{ Title: data.Switch("title").Str(), Description: data.Switch("desc").Str(), URL: data.Switch("url").Str(), } if color := data.Switch("color").Str(); color != "" { parsedColor, ok := ParseColor(color) if !ok { return "Unknown color: " + color + ", can be either hex color code or name for a known color", nil } embed.Color = parsedColor } if author := data.Switch("author").Str(); author != "" { embed.Author = &discordgo.MessageEmbedAuthor{ Name: author, IconURL: data.Switch("authoricon").Str(), } } if thumbnail := data.Switch("thumbnail").Str(); thumbnail != "" { embed.Thumbnail = &discordgo.MessageEmbedThumbnail{ URL: thumbnail, } } footer := data.Switch("footer").Str() footerIcon := data.Switch("footericon").Str() if footer != "" || footerIcon != "" { embed.Footer = &discordgo.MessageEmbedFooter{ Text: footer, IconURL: footerIcon, } } cID := data.Msg.ChannelID c := data.Switch("channel") if c.Value != nil { cID = c.Value.(*dstate.ChannelState).ID } _, err := common.BotSession.ChannelMessageSendEmbed(cID, embed) if err != nil { return err, err } if cID != data.Msg.ChannelID { return "Done", nil } return nil, nil }, }
Functions ¶
func ParseColor ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.