-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.go
152 lines (131 loc) · 3.13 KB
/
util.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
package main
import (
"time"
_ "time/tzdata"
"github.com/jackc/pgtype"
_ "github.com/mattn/go-sqlite3"
)
type feature struct {
Username string `json:"username"`
Feat string `json:"features"`
}
type ytvod struct {
ID string `json:"id"`
Title string `json:"title"`
Start string `json:"starttime"`
End string `json:"endtime"`
Thumbnail string `json:"thumbnail"`
}
type rumblevod struct {
PublicID string `json:"public_id"`
EmbedID string `json:"embed_id"`
Title string `json:"title"`
Link string `json:"link"`
Thumbnail string `json:"thumbnail"`
Start string `json:"starttime"`
End string `json:"endtime"`
}
type embed struct {
Link string `json:"link"`
Platform string `json:"platform"`
Channel string `json:"channel"`
Title string `json:"title"`
Count int `json:"count"`
}
type lastembed struct {
Link string `json:"link"`
Platform string `json:"platform"`
Channel string `json:"channel"`
Title string `json:"title"`
Timestamp int `json:"timestamp"`
}
type phrase struct {
Time time.Time `json:"time"`
Username string `json:"username"`
Phrase string `json:"phrase"`
Duration string `json:"duration"`
Type string `json:"type"`
}
type lwodUrl struct {
ID string
}
type lwodTwitch struct {
Start string `json:"starttime"`
End string `json:"endtime"`
Game string `json:"game"`
Subject string `json:"subject"`
Topic string `json:"topic"`
}
type lwodYT struct {
Time int `json:"time"`
Game string `json:"game"`
Subject string `json:"subject"`
Topic string `json:"topic"`
}
type lwod struct {
Twitch *string `json:"twitch"`
YouTube *string `json:"youtube"`
Start string `json:"starttime"`
End string `json:"endtime"`
Game string `json:"game"`
Subject string `json:"subject"`
Topic string `json:"topic"`
}
type logLineString struct {
Time string `json:"time"`
Username string `json:"username"`
Features string `json:"features"`
Message string `json:"message"`
}
type logGroup struct {
Time int64
Lines pgtype.JSONArray
}
type logLine struct {
Time time.Time `json:"time"`
Username string `json:"username"`
Features string `json:"features"`
Message string `json:"message"`
}
type nuke struct {
Time time.Time `json:"time"`
Type string `json:"type"`
Duration string `json:"duration"`
Word string `json:"word"`
Victims string `json:"victims"`
}
type msgCount struct {
Count int `json:"count"`
}
func MinMax(array []time.Time) (time.Time, time.Time) {
var max time.Time = array[0]
var min time.Time = array[0]
for _, value := range array {
if int(max.Unix()) < int(value.Unix()) {
max = value
}
if int(min.Unix()) > int(value.Unix()) {
min = value
}
}
return min, max
}
func indexOf(element time.Time, data []time.Time) int {
for k, v := range data {
if element == v {
return k
}
}
return -1
}
func indexOfUnnuke(data []string, word string) int {
for k, v := range data {
if word == v {
return k
}
}
return -1
}
func removeNukeByIndex(data []nuke, s int) []nuke {
return append(data[:s], data[s+1:]...)
}