func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {

	// Ignore all messages created by the bot itself
	// This isn't required in this specific example but it's a good practice.
	if m.Author.ID == s.State.User.ID {
		return
	}

	// If the message is "ping" reply with "Pong!"
	if strings.HasPrefix(m.Content, "!ответ") {
		data := strings.Split(m.Content, " ")

		if len(data) < 3 {
			log.Error("No message or profileID")
			return
		}

		userID := data[1]
		message := strings.Join(data[2:], " ")

		api.Messages.Send(vk.RequestParams{
			"peer_id": userID,
			"message": message,
		})
	}
}
// This function will be called (due to AddHandler above) every time a new
// message is created on any channel that the autenticated bot has access to.
This function will be called (due to AddHandler above) every time a new
message is created on any channel that the autenticated bot has access to.
// This function will be called ( due to AddHandler above ) every time a new // message is created on any channel that the autenticated bot has access to .
func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
	if m.Author.ID == s.State.User.ID {
		return
	}
	if strings.HasPrefix(m.Content, "!ответ") {
		data := strings.Split(m.Content, " ")
		if len(data) < 3 {
			log.Error("No message or profileID")
			return
		}
		userID := data[1]
		message := strings.Join(data[2:], " ")
		api.Messages.Send(vk.RequestParams{
			"peer_id": userID,
			"message": message,
		})
	}
}
func messageCreate ( s * discordgo . Session , m * discordgo . MessageCreate ) { if m . Author . ID == s . State . User . ID { return } if strings . HasPrefix ( m . Content , " data := strings . Split ( m . Content , " " ) if len ( data ) < 3 { log . Error ( " " ) return } userID := data [ 1 ] message := strings . Join ( data [ 2 : ] , " " ) api . Messages . Send ( vk . RequestParams { " " : userID , " " : message , } ) } }
This function will be called (due to AddHandler above) every time a new
message is created on any channel that the autenticated bot has access to.
This function will be called ( due to AddHandler above ) every time a new message is created on any channel that the autenticated bot has access to .
// Ignore all messages created by the bot itself // This isn't required in this specific example but it's a good practice. // If the message is "ping" reply with "Pong!"