Navigation for Web UI finally available
This commit is contained in:
@@ -10,13 +10,14 @@ Visit [https://airhorn.solutions/](https://airhorn.solutions/).
|
|||||||
Since there is not yet any command to request a list of available sound files, just take a look in `audio/`.
|
Since there is not yet any command to request a list of available sound files, just take a look in `audio/`.
|
||||||
They are named after the scheme `command_soundname.dca` and would result in a channel command like `!command soundname` like in `!airhorn default`.
|
They are named after the scheme `command_soundname.dca` and would result in a channel command like `!command soundname` like in `!airhorn default`.
|
||||||
Typing only the `!command` without an argument results in a random sound of this command's collection.
|
Typing only the `!command` without an argument results in a random sound of this command's collection.
|
||||||
|
- Comfortable web interface to trigger sounds
|
||||||
|
- Automatically detect all `.dca` files in `audio/`
|
||||||
|
- Optional sound descriptions via `.txt` files in `audio/` with the same name as the soundfile
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
Coming soon.
|
Coming soon.
|
||||||
## To do
|
## To do
|
||||||
- ~~Remove hardcoded sound collections and let the bot build them himself by scanning the `audio/` folder for files.~~
|
- more web interface enhancements
|
||||||
- ~~Build-in web interface to trigger sounds. ~~
|
|
||||||
~~The idea is to be able to have a detailed listing of available sound files in a responsive interface and a simple button to trigger the sound playback in a channel.~~
|
|
||||||
|
|
||||||
## Known issues
|
## Known issues
|
||||||
- none at the moment
|
- none at the moment
|
||||||
|
|||||||
@@ -54,8 +54,9 @@
|
|||||||
<div id="navbar" class="collapse navbar-collapse">
|
<div id="navbar" class="collapse navbar-collapse">
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
<li><a href="#">Home</a></li>
|
<li><a href="#">Home</a></li>
|
||||||
<li><a href="#about">About</a></li>
|
{{ range . }}
|
||||||
<li><a href="#contact">Contact</a></li>
|
<li><a href="#{{ . }}">{{ . }}</a></li>
|
||||||
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<!--/.nav-collapse -->
|
<!--/.nav-collapse -->
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
<div class="col-sm-3 text-center"><div class="sounditem"><div data-toggle="tooltip" data-placement="top" title="{{ .Itemtext }}">{{ .Itemcommand }} {{ .Itemsoundname }}<br/>{{ .Itemshorttext }}<br/><a class="btn btn-primary" href="javascript:playSound('{{ .Itemcommand }}', '{{ .Itemsoundname }}')" role="button">Play!</a><br/></div></div></div>
|
<div class="col-sm-3 text-center"><div class="sounditem"><div data-toggle="tooltip" data-placement="top" title="{{ .Itemtext }}">{{ .Itemcommand }} {{ .Itemsoundname }}<br/>{{ .Itemshorttext }}<br/><button class="btn btn-primary" onclick="javascript:playSound('{{ .Itemcommand }}', '{{ .Itemsoundname }}')" role="button" id="sounditem">Play!</button><br/></div></div></div>
|
||||||
|
|||||||
+16
-10
@@ -89,22 +89,22 @@ func handlePlaySound(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if user != nil && guild != nil && sound != nil && soundCollection != nil {
|
if user != nil && guild != nil && sound != nil && soundCollection != nil {
|
||||||
go enqueuePlay(user, guild, soundCollection, sound)
|
if sound != nil {
|
||||||
}
|
go enqueuePlay(user, guild, soundCollection, sound)
|
||||||
if user != nil && guild != nil && sound == nil && soundCollection != nil {
|
} else {
|
||||||
go enqueuePlay(user, guild, soundCollection, soundCollection.Random())
|
go enqueuePlay(user, guild, soundCollection, soundCollection.Random())
|
||||||
|
}
|
||||||
|
http.Error(w, http.StatusText(200), 200)
|
||||||
|
} else {
|
||||||
|
http.Error(w, http.StatusText(500), 500)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleMain(w http.ResponseWriter, r *http.Request) {
|
func handleMain(w http.ResponseWriter, r *http.Request) {
|
||||||
session, _ := store.Get(r, "gidbig-session")
|
session, _ := store.Get(r, "gidbig-session")
|
||||||
if session.Values["discordUsername"] != nil {
|
if session.Values["discordUsername"] != nil {
|
||||||
err := tmpls["internal.html"].ExecuteTemplate(w, "header", map[string]interface{}{})
|
var prefixes []string
|
||||||
if err != nil {
|
|
||||||
fmt.Println(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var si []SoundItem
|
var si []SoundItem
|
||||||
for _, sc := range COLLECTIONS {
|
for _, sc := range COLLECTIONS {
|
||||||
var newSoundItemRandom SoundItem
|
var newSoundItemRandom SoundItem
|
||||||
@@ -115,6 +115,7 @@ func handleMain(w http.ResponseWriter, r *http.Request) {
|
|||||||
Itemtext: "random",
|
Itemtext: "random",
|
||||||
Itemshorttext: "random",
|
Itemshorttext: "random",
|
||||||
}
|
}
|
||||||
|
prefixes = append(prefixes, sc.Prefix)
|
||||||
si = append(si, newSoundItemRandom)
|
si = append(si, newSoundItemRandom)
|
||||||
for _, snd := range sc.Sounds {
|
for _, snd := range sc.Sounds {
|
||||||
var newSoundItem SoundItem
|
var newSoundItem SoundItem
|
||||||
@@ -140,6 +141,11 @@ func handleMain(w http.ResponseWriter, r *http.Request) {
|
|||||||
si = append(si, newSoundItem)
|
si = append(si, newSoundItem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
err := tmpls["internal.html"].ExecuteTemplate(w, "header", prefixes)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var currentPrefix string = ""
|
var currentPrefix string = ""
|
||||||
var i int = 0
|
var i int = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user