Add an emote list
It's ugly, but it get's the job done. This list will need to be improved a lot (ie, make it searchable and maybe even clickable emotes?). This is for #99, but should not be considered fixed yet.
This commit is contained in:
parent
528b29e0ff
commit
8fc3f86135
@ -40,6 +40,14 @@ var commands = &CommandControl{
|
||||
Function: cmdHelp,
|
||||
},
|
||||
|
||||
common.CNEmotes.String(): Command{
|
||||
HelpText: "Display a list of available emotes.",
|
||||
Function: func(client *Client, args []string) (string, error) {
|
||||
client.SendChatData(common.NewChatCommand(common.CmdEmotes, []string{"/emotes"}))
|
||||
return "Opening emote list in new window.", nil
|
||||
},
|
||||
},
|
||||
|
||||
common.CNCount.String(): Command{
|
||||
HelpText: "Display number of users in chat.",
|
||||
Function: func(client *Client, args []string) (string, error) {
|
||||
|
@ -23,6 +23,7 @@ var (
|
||||
CNNick ChatCommandNames = []string{"nick", "name"}
|
||||
CNStats ChatCommandNames = []string{"stats"}
|
||||
CNPin ChatCommandNames = []string{"pin", "password"}
|
||||
CNEmotes ChatCommandNames = []string{"emotes"}
|
||||
// Mod Commands
|
||||
CNSv ChatCommandNames = []string{"sv"}
|
||||
CNPlaying ChatCommandNames = []string{"playing"}
|
||||
@ -53,6 +54,7 @@ var ChatCommands = []ChatCommandNames{
|
||||
CNNick,
|
||||
CNStats,
|
||||
CNPin,
|
||||
CNEmotes,
|
||||
|
||||
// Mod
|
||||
CNSv,
|
||||
|
@ -34,6 +34,7 @@ const (
|
||||
CmdRefreshPlayer
|
||||
CmdPurgeChat
|
||||
CmdHelp
|
||||
CmdEmotes
|
||||
)
|
||||
|
||||
type CommandLevel int
|
||||
|
@ -21,6 +21,7 @@ var serverTemplateDefs map[string][]string = map[string][]string{
|
||||
"pin": []string{"./static/base.html", "./static/thedoor.html"},
|
||||
"main": []string{"./static/base.html", "./static/main.html"},
|
||||
"help": []string{"./static/base.html", "./static/help.html"},
|
||||
"emotes": []string{"./static/base.html", "./static/emotes.html"},
|
||||
}
|
||||
|
||||
var chatTemplateDefs map[string]string = map[string]string{
|
||||
|
17
handlers.go
17
handlers.go
@ -271,6 +271,23 @@ func handleHelpTemplate(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
func handleEmoteTemplate(w http.ResponseWriter, r *http.Request) {
|
||||
type Data struct {
|
||||
Title string
|
||||
Emotes map[string]string
|
||||
}
|
||||
|
||||
data := Data{
|
||||
Title: "Available Emotes",
|
||||
Emotes: common.Emotes,
|
||||
}
|
||||
|
||||
err := common.ExecuteServerTemplate(w, "emotes", data)
|
||||
if err != nil {
|
||||
common.LogErrorf("Error executing file, %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func handlePin(w http.ResponseWriter, r *http.Request) {
|
||||
session, err := sstore.Get(r, "moviesession")
|
||||
if err != nil {
|
||||
|
1
main.go
1
main.go
@ -130,6 +130,7 @@ func startServer() {
|
||||
http.HandleFunc("/video", handleIndexTemplate)
|
||||
http.HandleFunc("/help", handleHelpTemplate)
|
||||
http.HandleFunc("/pin", handlePin)
|
||||
http.HandleFunc("/emotes", handleEmoteTemplate)
|
||||
|
||||
http.HandleFunc("/", handleDefault)
|
||||
|
||||
|
@ -109,6 +109,19 @@ input[type=text] {
|
||||
color: white;
|
||||
}
|
||||
|
||||
#emotesbody {
|
||||
color: var(--var-message-color);
|
||||
}
|
||||
|
||||
.emotedef {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.emotedef div {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.notice {
|
||||
color: #595959;
|
||||
font-size: 75%;
|
||||
|
14
static/emotes.html
Normal file
14
static/emotes.html
Normal file
@ -0,0 +1,14 @@
|
||||
{{define "header"}}
|
||||
{{end}}
|
||||
|
||||
{{define "body"}}
|
||||
<div id="emotesbody">
|
||||
<h2>Available Emotes</h2>
|
||||
{{range $k, $v := .Emotes}}
|
||||
<div class="emotedef">
|
||||
<div><img src="{{$v}}" /></div>
|
||||
<div>{{$k}}</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
@ -148,6 +148,10 @@ func recieve(v []js.Value) {
|
||||
}
|
||||
appendMessage(d.HTML())
|
||||
global.Get("window").Call("open", url, "_blank", "menubar=0,status=0,toolbar=0,width=300,height=600")
|
||||
case common.CmdEmotes:
|
||||
url := "/emotes"
|
||||
appendMessage(d.HTML())
|
||||
global.Get("window").Call("open", url, "_blank", "menubar=0,status=0,toolbar=0,width=300,height=600")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user