6 Commits

Author SHA1 Message Date
509dab5395 Merge pull request 'automate management of loading emote' (#49) from automatic-loading-emote into master
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 40s
Build and Push Docker Image / deploy-on-green (push) Successful in 6s
Reviewed-on: #49
2026-03-10 01:00:31 +00:00
6b9934a221 automate management of loading emote
All checks were successful
Build only (for PRs) / build-only (pull_request) Successful in 4m52s
2026-03-09 14:25:56 -04:00
adefe2f177 Merge pull request 'optimize codebase' (#48) from code-cleanup into master
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 14s
Build and Push Docker Image / deploy-on-green (push) Successful in 6s
Reviewed-on: #48
2026-03-09 16:14:21 +00:00
51e1cc5e85 Merge pull request 'chore(deps): update module github.com/lrstanley/go-ytdlp to v1.3.3' (#47) from renovate/github.com-lrstanley-go-ytdlp-1.x into master
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 5m31s
Build and Push Docker Image / deploy-on-green (push) Successful in 8s
Reviewed-on: #47
2026-03-08 15:55:17 +00:00
d3e6ddebcd remove my fork after my changes were merged upstream
All checks were successful
Build only (for PRs) / build-only (pull_request) Successful in 4m27s
2026-03-08 11:50:09 -04:00
558f95ad9d chore(deps): update module github.com/lrstanley/go-ytdlp to v1.3.3
All checks were successful
Build only (for PRs) / build-only (pull_request) Successful in 6m37s
2026-03-08 07:01:17 +00:00
3 changed files with 40 additions and 2 deletions

BIN
app/assets/loading.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -371,6 +371,10 @@ func main() {
}
})
log.Println("Initialize loading emoji")
initLoadingEmoji(s)
log.Println("Adding commands")
registeredCommands := make([]*discordgo.ApplicationCommand, len(commands))
for i, v := range commands {

View File

@@ -2,11 +2,45 @@ package main
import (
"fmt"
"os"
"log"
"regexp"
_ "embed"
"encoding/base64"
"github.com/bwmarrin/discordgo"
)
var loading_emoji = os.Getenv("LOADING_EMOJI")
var loading_emoji string
//go:embed assets/loading.webp
var rawLoadingEmoji []byte
var loadingEmojiBase64 = func() string {
s := "data:image/webp;base64," + base64.StdEncoding.EncodeToString(rawLoadingEmoji)
rawLoadingEmoji = nil
return s
}()
func initLoadingEmoji(s *discordgo.Session) {
emojis, err := s.ApplicationEmojis(s.State.User.ID)
if err != nil {
log.Panic("Cannot get emojis")
}
for _, e := range emojis {
if e.Name == "loading" {
loading_emoji = fmt.Sprintf("<a:%s:%s>", e.Name, e.ID)
return
}
}
e, err := s.ApplicationEmojiCreate(s.State.User.ID, &discordgo.EmojiParams{
Name: "loading",
Image: loadingEmojiBase64,
})
if err != nil {
log.Panicf("Cannot create loading emoji: %s", err)
}
loading_emoji = fmt.Sprintf("<a:%s:%s>", e.Name, e.ID)
}
var urlPattern = regexp.MustCompile(`https?://\S+`)