mirror of https://github.com/hak5/scuzzy.git
commit
a41bb07c4b
|
@ -50,6 +50,7 @@ func (c *Commands) RegisterHandlers() {
|
||||||
c.RegisterCommand("fetome", "Convert Feet to Meters", false, c.handleFeetToMeters)
|
c.RegisterCommand("fetome", "Convert Feet to Meters", false, c.handleFeetToMeters)
|
||||||
c.RegisterCommand("cmtoin", "Convert Centimeters to Inches", false, c.handleCentimeterToInch)
|
c.RegisterCommand("cmtoin", "Convert Centimeters to Inches", false, c.handleCentimeterToInch)
|
||||||
c.RegisterCommand("intocm", "Convert Inches to Centimeters", false, c.handleInchToCentimeter)
|
c.RegisterCommand("intocm", "Convert Inches to Centimeters", false, c.handleInchToCentimeter)
|
||||||
|
c.RegisterCommand("google4u", "Displays a letmegooglethat link", false, c.handleGoogle4U)
|
||||||
|
|
||||||
// Admin Commands
|
// Admin Commands
|
||||||
c.RegisterCommand("ping", "Ping Scuzzy", true, c.handlePing)
|
c.RegisterCommand("ping", "Ping Scuzzy", true, c.handlePing)
|
||||||
|
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"sort"
|
"sort"
|
||||||
|
@ -692,3 +693,25 @@ func (c *Commands) handleServerInfo(s *discordgo.Session, m *discordgo.MessageCr
|
||||||
|
|
||||||
return nil
|
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
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue