-
Notifications
You must be signed in to change notification settings - Fork 1
/
slack-emoji-manager.go
53 lines (48 loc) · 1002 Bytes
/
slack-emoji-manager.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
package main
import (
"fmt"
"log"
"os"
"slack-emoji-manager/emoji"
)
func main() {
if len(os.Args) <= 2 {
log.Fatalf("Invalid arguments")
}
op := os.Args[1]
token := os.Args[2]
switch op {
case "get":
fmt.Println("Fetching emoji list")
err := emoji.GetEmojis(token, false)
if err != nil {
panic(err)
}
case "download":
fmt.Println("Downloading all emojis")
err := emoji.GetEmojis(token, true)
if err != nil {
panic(err)
}
case "upload":
filename := os.Args[2]
token = os.Args[3]
fmt.Println("Uploading emoji")
name, err := emoji.UploadEmoji(filename, token)
if err != nil {
panic(err)
}
fmt.Println("*New :slack: emoji*")
fmt.Println(emoji.EmojiToSlack([]string{name}))
case "upload-all":
folder := os.Args[2]
token = os.Args[3]
fmt.Println("Uploading emoji")
emojis, err := emoji.UploadAllEmojis(folder, token)
if err != nil {
panic(err)
}
fmt.Println("*New :slack: emojis*")
fmt.Println(emoji.EmojiToSlack(emojis))
}
}