add google4u

master^2
cribb-it 2022-08-16 13:32:53 +01:00
parent 044ab7a79c
commit 4fe6dc452e
1 changed files with 23 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"io/ioutil"
"net/url"
"os"
"reflect"
"sort"
@ -692,3 +693,25 @@ func (c *Commands) handleServerInfo(s *discordgo.Session, m *discordgo.MessageCr
return nil
}
func (c *Commands) handleGoogle4U(s *discordgo.Session, m *discordgo.MessageCreate) error {
args := strings.Split(m.Content, " ")
if len(args) < 2 {
return errors.New("You did not specify anything to google")
}
input := m.Content[strings.Index(m.Content, " "):len(m.Content)]
desc := "https://letmegooglethat.com/?q=" + url.QueryEscape(input)
msg := c.CreateDefinedEmbed("Google", desc, "", m.Author)
_, err := s.ChannelMessageSendEmbed(m.ChannelID, msg)
if err != nil {
return err
}
err = s.ChannelMessageDelete(m.ChannelID, m.ID)
if err != nil {
return err
}
return nil
}