func (b *Bot) processCmd(s *discordgo.Session, m *discordgo.MessageCreate) {
	if m.ChannelID != b.BotCh {
		// Command must be posted in bot channel; if not, command won't be processed
		return
	}
	cmds := regexp.MustCompile("\\s+").Split(m.Content[len(b.Prefix):], -1)
	trim := strings.TrimPrefix(cmds[0], b.Prefix)
	res := b.find(trim)
	if res == nil {
		// Command not found
		return
	}
	var commands []string
	for key := range b.Commands {
		commands = append(commands, key)
	}
	ci := cmd.CommandInfo{
		AdminRole: b.AdminRole,
		Ses:       s,
		Msg:       m,
		Service:   b.Service,
		ListingID: b.Listing,
		BotChID:   b.BotCh,
		AppID:     b.App,
		Prefix:    b.Prefix,
		CmdName:   trim,
		CmdOps:    cmds,
		CmdList:   commands,
	}
	// Run command
	res.Cmd(ci)
}
// processCmd attemps to process any string that is prefixed with bot notifier
//
// Valid commands will be run while invalid commands will be ignored
//
// Example bot commands:
//
// ?search
//
// ?search help
processCmd attemps to process any string that is prefixed with bot notifier

Valid commands will be run while invalid commands will be ignored

Example bot commands.

?search

?search help
// processCmd attemps to process any string that is prefixed with bot notifier // // Valid commands will be run while invalid commands will be ignored // // Example bot commands : // // ?search // // ?search help
func (b *Bot) processCmd(s *discordgo.Session, m *discordgo.MessageCreate) {
	if m.ChannelID != b.BotCh {
		return
	}
	cmds := regexp.MustCompile("\\s+").Split(m.Content[len(b.Prefix):], -1)
	trim := strings.TrimPrefix(cmds[0], b.Prefix)
	res := b.find(trim)
	if res == nil {
		return
	}
	var commands []string
	for key := range b.Commands {
		commands = append(commands, key)
	}
	ci := cmd.CommandInfo{
		AdminRole: b.AdminRole,
		Ses:       s,
		Msg:       m,
		Service:   b.Service,
		ListingID: b.Listing,
		BotChID:   b.BotCh,
		AppID:     b.App,
		Prefix:    b.Prefix,
		CmdName:   trim,
		CmdOps:    cmds,
		CmdList:   commands,
	}
	res.Cmd(ci)
}
func ( b * Bot ) processCmd ( s * discordgo . Session , m * discordgo . MessageCreate ) { if m . ChannelID != b . BotCh { return } cmds := regexp . MustCompile ( " \\ " ) . Split ( m . Content [ len ( b . Prefix ) : ] , - 1 ) trim := strings . TrimPrefix ( cmds [ 0 ] , b . Prefix ) res := b . find ( trim ) if res == nil { return } var commands [ ] string for key := range b . Commands { commands = append ( commands , key ) } ci := cmd . CommandInfo { AdminRole : b . AdminRole , Ses : s , Msg : m , Service : b . Service , ListingID : b . Listing , BotChID : b . BotCh , AppID : b . App , Prefix : b . Prefix , CmdName : trim , CmdOps : cmds , CmdList : commands , } res . Cmd ( ci ) }
processCmd attemps to process any string that is prefixed with bot notifier
processCmd attemps to process any string that is prefixed with bot notifier
// Command must be posted in bot channel; if not, command won't be processed // Command not found // Run command