-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathretrieve-data.go
54 lines (40 loc) · 966 Bytes
/
retrieve-data.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
package main
import (
"strconv"
"github.com/bwmarrin/discordgo"
)
func retrieveChannels(session *discordgo.Session, i *discordgo.InteractionCreate) []string {
channels, _ := session.GuildChannels(i.GuildID)
channelsNames := []string{}
for _, channel := range channels {
channelsNames = append(channelsNames, channel.Name)
}
return channelsNames
}
type Categories struct {
MediumCategories []string `json:"mc"`
}
func retrieveMediumCategories() Categories {
var categories Categories
deserializeData("medium-categories.json", &categories)
return categories
}
func retrieveDayHours() []string {
var dayHours []string
for hour := 0; hour < 24; hour++ {
hourDisplay := hour
if hour == 0 {
// Midnight
hourDisplay = 12
} else if hour > 12 {
// Afternoon
hourDisplay = hour - 12
}
suffix := "am"
if hour >= 12 {
suffix = "pm"
}
dayHours = append(dayHours, strconv.Itoa(hourDisplay)+suffix)
}
return dayHours
}