greeting function
This commit is contained in:
parent
1f3c48fca2
commit
48ad301517
|
@ -5,12 +5,11 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
"math/rand"
|
||||
"time"
|
||||
"net"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"time"
|
||||
|
||||
irc "gopkg.in/irc.v3"
|
||||
)
|
||||
|
@ -21,7 +20,6 @@ var r = rand.New(s)
|
|||
var channel string
|
||||
var victim string
|
||||
|
||||
|
||||
func HandleRequest(ctx context.Context) (string, error) {
|
||||
// So i was too lazy to get rid of the boilerplate
|
||||
// Set up IRC connection
|
||||
|
@ -46,7 +44,7 @@ func HandleRequest(ctx context.Context) (string, error) {
|
|||
config := irc.ClientConfig{
|
||||
Nick: insults[r.Intn(len(insults))],
|
||||
User: hostname,
|
||||
Name: victim + "'s thunder buddy",
|
||||
Name: "dabbing on " + victim,
|
||||
Handler: irc.HandlerFunc(handleIRCCon), // See below for callback
|
||||
}
|
||||
client := irc.NewClient(conn, config)
|
||||
|
@ -81,7 +79,15 @@ func handleIRCCon(c *irc.Client, m *irc.Message) {
|
|||
c.Write("NICK " + nick)
|
||||
} else if text[len(text)-1] == "invite" {
|
||||
c.Write("INVITE " + victim + " " + channel)
|
||||
|
||||
sent++
|
||||
} else if strings.Contains(m.Trailing(), "greetings") {
|
||||
c.WriteMessage(&irc.Message{
|
||||
Command: "PRIVMSG",
|
||||
Params: []string{
|
||||
m.Params[0],
|
||||
victim + ": hi",
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue