/*
Helper handler to check if the message provided is a command and if so, executes the command
*/
Helper handler to check if the message provided is a command and if so, executes the command
/ * Helper handler to check if the message provided is a command and if so executes the command * /
func runCommand(session *discordgo.Session, message *discordgo.Message, guild *discordgo.Guild, channel *discordgo.Channel, member *discordgo.Member,
	userProfile *types.UserProfile, timer *event.Timer) {
	messageParts := strings.Split(message.Content, " ")
	if len(messageParts) <= 1 {
		return
	}
	commandKey := strings.ToUpper(messageParts[1])
	if command, commPresent := commandsMap[commandKey]; commPresent {
		timer.AddMark(event.TimerMarkCommandBegin + commandKey)
		params := messageParts[2:]
		if !checker.HasPermission(message.Author.ID, member.Roles, guild, command.GetPermLevel()) {
			session.ChannelMessageSend(channel.ID, "Sorry, you don't have a high enough permission level to access this command.")
			log.Println("!!PERMISSION VIOLATION!! Processing command: " + commandKey + " from user: {" + message.Author.String() + "}| With Params:{" +
				strings.Join(params, ",") + "}")
			return
		}
		log.Println("Processing command: " + commandKey + " from user: {" + message.Author.String() + "}| With Params:{" + strings.Join(params, ",") + "}")
		session.ChannelTyping(message.ChannelID)
		pack := commands.NewCommPackage(session, message, guild, member, channel, params, userProfile, timer)
		command.Execute(&pack)
		timer.AddMark(event.TimerMarkCommandEnd + commandKey)
	}
}
func runCommand ( session * discordgo . Session , message * discordgo . Message , guild * discordgo . Guild , channel * discordgo . Channel , member * discordgo . Member , userProfile * types . UserProfile , timer * event . Timer ) { messageParts := strings . Split ( message . Content , " " ) if len ( messageParts ) <= 1 { return } commandKey := strings . ToUpper ( messageParts [ 1 ] ) if command , commPresent := commandsMap [ commandKey ] ; commPresent { timer . AddMark ( event . TimerMarkCommandBegin + commandKey ) params := messageParts [ 2 : ] if ! checker . HasPermission ( message . Author . ID , member . Roles , guild , command . GetPermLevel ( ) ) { session . ChannelMessageSend ( channel . ID , " " ) log . Println ( " " + commandKey + " " + message . Author . String ( ) + " " + strings . Join ( params , " " ) + " " ) return } log . Println ( " " + commandKey + " " + message . Author . String ( ) + " " + strings . Join ( params , " " ) + " " ) session . ChannelTyping ( message . ChannelID ) pack := commands . NewCommPackage ( session , message , guild , member , channel , params , userProfile , timer ) command . Execute ( & pack ) timer . AddMark ( event . TimerMarkCommandEnd + commandKey ) } }
Helper handler to check if the message provided is a command and if so, executes the command
Helper handler to check if the message provided is a command and if so executes the command
// bad command, missing command after prefix