Implement Persentance with SQLite3 (#6)
This commit is contained in:
		@ -12,18 +12,21 @@ type Component interface {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CreateMessageComponent creates a discord component
 | 
			
		||||
func (discord *Discord) CreateMessageComponent(channelID string, content string, components []Component) {
 | 
			
		||||
func (discord *Discord) CreateMessageComponent(channelID string, content string, components []Component) string {
 | 
			
		||||
 | 
			
		||||
	dComponents := make([]discordgo.MessageComponent, len(components))
 | 
			
		||||
	for i, v := range components {
 | 
			
		||||
		dComponents[i] = v.toMessageComponent()
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if _, err := discord.session.ChannelMessageSendComplex(channelID, &discordgo.MessageSend{
 | 
			
		||||
	result, err := discord.session.ChannelMessageSendComplex(channelID, &discordgo.MessageSend{
 | 
			
		||||
		Components: dComponents,
 | 
			
		||||
		Content:    content,
 | 
			
		||||
	}); err != nil {
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Print(err)
 | 
			
		||||
		return ""
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return result.ID
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user