-
Notifications
You must be signed in to change notification settings - Fork 0
/
discord.go
43 lines (36 loc) · 915 Bytes
/
discord.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"encoding/json"
"fmt"
"strings"
"github.com/bwmarrin/discordgo"
)
func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
if m.Author.ID == s.State.User.ID {
return
}
if m.ChannelID == "651000959446548480" && m.Content != "!clearMOTD" {
messageOfTheDay = m.Content
}
if m.Content == "!clearMOTD" {
messageOfTheDay = ""
}
if m.ChannelID == "652778441833447424" && m.Content != "!clearSchoolBot" {
schoolbot = m.Content
}
if m.ChannelID == "682341285977260052" && m.Content != "!clearJson" {
jsonData = separation(m.Content)
}
if m.Content == "!clearSchoolBot" {
schoolbot = ""
}
if m.Content == "ping" {
s.ChannelMessageSend(m.ChannelID, "Pong!")
fmt.Println("Print channel id: ", m.ChannelID)
}
}
func separation(ctx string) string {
complete := strings.Split(ctx, "@@@")
jsonout, _ := json.Marshal(complete)
return string(jsonout)
}