diff --git a/emoji/README.md b/emoji/README.md index cc0fce59..a28fb1f4 100644 --- a/emoji/README.md +++ b/emoji/README.md @@ -3,11 +3,3 @@ This directory contains all the emoji used by the Boost Bot application. The emoji are used to represent the various types of activities that can be performed in the application. The emoji are in PNG or animated GIF format. - -## Backup pull utility - -This directory contains a utility that can be used to pull the emoji from the Boost Bot application and store them in this directory. This utility is useful for backing up the emoji in case they are lost or need to be restored. - -The full list of emoji can be found in the botemoji.txt file. This file contains the emoji name and the URL of the emoji image. - -The utility getemoji.sh will read the botemoji.txt file and download the emoji images to this directory. diff --git a/emoji/botemoji.txt b/emoji/botemoji.txt deleted file mode 100644 index f122be42..00000000 --- a/emoji/botemoji.txt +++ /dev/null @@ -1,86 +0,0 @@ -# Emoji Name, URL to download from discord cdn. -token,http://cdn.discordapp.com/emojis/1279216759131476123.png -icon_chicken_run,http://cdn.discordapp.com/emojis/1280378140694286427.png -ultra,http://cdn.discordapp.com/emojis/1286890849719812147.png -ELR,http://cdn.discordapp.com/emojis/1288152690001580072.png -signup,http://cdn.discordapp.com/emojis/1288391860431360093.png -random,http://cdn.discordapp.com/emojis/1288394382516424725.png -reverse,http://cdn.discordapp.com/emojis/1288577133995753635.png -fair,http://cdn.discordapp.com/emojis/1288579727598026857.png -sharing,http://cdn.discordapp.com/emojis/1288580958794158090.png -unknown,http://cdn.discordapp.com/emojis/1288638345970454570.png -runready,http://cdn.discordapp.com/emojis/1288641283010728037.png -egg_lithium,http://cdn.discordapp.com/emojis/1305429887749853185.png -egg_ai,http://cdn.discordapp.com/emojis/1280382185257566278.png -egg_antimatter,http://cdn.discordapp.com/emojis/1280382205084041287.png -egg_chocolate,http://cdn.discordapp.com/emojis/1280382217822146560.png -egg_darkmatter,http://cdn.discordapp.com/emojis/1280382231361093706.png -egg_dilithium,http://cdn.discordapp.com/emojis/1280382245189713984.png -egg_easter,http://cdn.discordapp.com/emojis/1280382259630964767.png -egg_edible,http://cdn.discordapp.com/emojis/1280382273165725707.png -egg_enlightenment,http://cdn.discordapp.com/emojis/1280382287980269618.png -egg_firework,http://cdn.discordapp.com/emojis/1280382299141050399.png -egg_fusion,http://cdn.discordapp.com/emojis/1280382311166382113.png -egg_graviton,http://cdn.discordapp.com/emojis/1280382323652821124.png -egg_immortality,http://cdn.discordapp.com/emojis/1280382335577227355.png -egg_medical,http://cdn.discordapp.com/emojis/1280382360554180661.png -egg_prophecy,http://cdn.discordapp.com/emojis/1280382926470643754.png -egg_prodigy,http://cdn.discordapp.com/emojis/1280382940383285290.png -egg_pumpkin,http://cdn.discordapp.com/emojis/1280382955239247965.png -egg_quantum,http://cdn.discordapp.com/emojis/1280382968069886045.png -egg_rocketfuel,http://cdn.discordapp.com/emojis/1280382980753457162.png -egg_soul,http://cdn.discordapp.com/emojis/1280382995282526208.png -egg_superfood,http://cdn.discordapp.com/emojis/1280383008901173400.png -egg_supermaterial,http://cdn.discordapp.com/emojis/1280383030858350624.png -egg_tachyon,http://cdn.discordapp.com/emojis/1280383045710381066.png -egg_terraform,http://cdn.discordapp.com/emojis/1280383061007269910.png -egg_universe,http://cdn.discordapp.com/emojis/1280383077415125086.png -egg_unknown,http://cdn.discordapp.com/emojis/1280383094448328717.png -egg_vision,http://cdn.discordapp.com/emojis/1280383107236626482.png -egg_waterballoon,http://cdn.discordapp.com/emojis/1280383119618473984.png -egg_crispr,http://cdn.discordapp.com/emojis/1280385130363490324.png -egg_carbonfiber,http://cdn.discordapp.com/emojis/1280385218213187640.png -atreggies,http://cdn.discordapp.com/emojis/1280389911509340240.png -henerprise,http://cdn.discordapp.com/emojis/1280390026487664704.png -voyegger,http://cdn.discordapp.com/emojis/1280390114094354472.png -defihent,http://cdn.discordapp.com/emojis/1280390249943666739.png -galeggtica,http://cdn.discordapp.com/emojis/1280390347825872916.png -corellihencorvette,http://cdn.discordapp.com/emojis/1280390458983452742.png -milleniumchicken,http://cdn.discordapp.com/emojis/1280390575178383386.png -bcr,http://cdn.discordapp.com/emojis/1280390686461661275.png -chickenheavy,http://cdn.discordapp.com/emojis/1280390782783590473.png -chicken9,http://cdn.discordapp.com/emojis/1280390884575154226.png -chicken1,http://cdn.discordapp.com/emojis/1280390988824576061.png -afx_ornate_gusset_4,https://cdn.discordapp.com/emojis/1279206200541450364.png -afx_ornate_gusset_3,https://cdn.discordapp.com/emojis/1279206172355727514.png -afx_ornate_gusset_2,https://cdn.discordapp.com/emojis/1279206141674393651.png -afx_ornate_gusset_1,https://cdn.discordapp.com/emojis/1279206112897269830.png -afx_quantum_metronome_4,https://cdn.discordapp.com/emojis/1279205882097565788.png -afx_quantum_metronome_3,https://cdn.discordapp.com/emojis/1279205835893117032.png -afx_quantum_metronome_2,https://cdn.discordapp.com/emojis/1279205797292802140.png -afx_quantum_metronome_1,https://cdn.discordapp.com/emojis/1279205769509732415.png -afx_interstellar_compass_4,https://cdn.discordapp.com/emojis/1279205584645652491.png -afx_interstellar_compass_3,https://cdn.discordapp.com/emojis/1279205540731551854.png -afx_interstellar_compass_2,https://cdn.discordapp.com/emojis/1279205497609912320.png -afx_interstellar_compass_1,https://cdn.discordapp.com/emojis/1279205462746599516.png -afx_tachyon_deflector_4,https://cdn.discordapp.com/emojis/1279201926893797416.png -afx_tachyon_deflector_3,https://cdn.discordapp.com/emojis/1279201840755642479.png -afx_tachyon_deflector_2,https://cdn.discordapp.com/emojis/1279201803971330048.png -afx_tachyon_deflector_1,https://cdn.discordapp.com/emojis/1279201731775037552.png -GT3Ra,https://cdn.discordapp.com/emojis/1279532512007295008.gif -GT4Ea,https://cdn.discordapp.com/emojis/1279532417627197502.gif -GT4La,https://cdn.discordapp.com/emojis/1279532396802474014.gif -CT3Ra,https://cdn.discordapp.com/emojis/1279532322802237614.gif -CT4Ra,https://cdn.discordapp.com/emojis/1279532221455269949.gif -CT4Ea,https://cdn.discordapp.com/emojis/1279531101672702022.gif -CT4La,https://cdn.discordapp.com/emojis/1279531047251607605.gif -MT3Ra,https://cdn.discordapp.com/emojis/1279530956377554955.gif -MT3Ea,https://cdn.discordapp.com/emojis/1279530849339052072.gif -MT4Ra,https://cdn.discordapp.com/emojis/1279530692392390656.gif -MT4Ea,https://cdn.discordapp.com/emojis/1279530656614977649.gif -MT4La,https://cdn.discordapp.com/emojis/1279530626470383618.gif -DT3Ra,https://cdn.discordapp.com/emojis/1279530534539890748.gif -DT4Ra,https://cdn.discordapp.com/emojis/1279530356965380177.gif -DT4Ea,https://cdn.discordapp.com/emojis/1279530331820523551.gif -DT4La,https://cdn.discordapp.com/emojis/1279530304612204574.gif -GT2Ea,https://cdn.discordapp.com/emojis/1279532584904298588.gif diff --git a/emoji/getemoji.sh b/emoji/getemoji.sh deleted file mode 100755 index 06bc2333..00000000 --- a/emoji/getemoji.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# Name of the input file -input_file="botemoji.txt" - -# Read the file line by line -while IFS=, read -r name url; do - # Ignore comment lines starting with # - if [[ $name == \#* ]]; then - continue - fi - - # Extract the file name and extension, ignoring the parameters - file_ext=$(echo "$url" | grep -oE '\.[a-z]+(\?|$)' | grep -oE '[a-z]+') - - # Handle both png and gif files and their parameters - if [ ! -f "${name}.${file_ext}" ]; then - # Download the image and rename it - wget --quiet -O "${name}.${file_ext}" "${url}" - else - echo "File ${name}.${file_ext} already exists, skipping download." - fi -done < "$input_file" diff --git a/emoji/st_Li1.png b/emoji/st_Li1.png new file mode 100644 index 00000000..83d92397 Binary files /dev/null and b/emoji/st_Li1.png differ diff --git a/emoji/st_Li2.png b/emoji/st_Li2.png new file mode 100644 index 00000000..cee56f4a Binary files /dev/null and b/emoji/st_Li2.png differ diff --git a/emoji/st_Li3.png b/emoji/st_Li3.png new file mode 100644 index 00000000..90077b86 Binary files /dev/null and b/emoji/st_Li3.png differ diff --git a/emoji/st_Li4.png b/emoji/st_Li4.png new file mode 100644 index 00000000..a43ac3eb Binary files /dev/null and b/emoji/st_Li4.png differ diff --git a/emoji/st_L1.png b/emoji/st_Lu1.png similarity index 100% rename from emoji/st_L1.png rename to emoji/st_Lu1.png diff --git a/emoji/st_L2.png b/emoji/st_Lu2.png similarity index 100% rename from emoji/st_L2.png rename to emoji/st_Lu2.png diff --git a/emoji/st_L3.png b/emoji/st_Lu3.png similarity index 100% rename from emoji/st_L3.png rename to emoji/st_Lu3.png diff --git a/emoji/st_L4.png b/emoji/st_Lu4.png similarity index 100% rename from emoji/st_L4.png rename to emoji/st_Lu4.png diff --git a/src/bottools/app_emoji.go b/src/bottools/app_emoji.go index 2dbe2792..f90d08e2 100644 --- a/src/bottools/app_emoji.go +++ b/src/bottools/app_emoji.go @@ -106,17 +106,13 @@ func EnsureEmojiFromLocalRepo(s *discordgo.Session, name string) (ei.Emotes, boo } } - // If still missing after Discord fetch, look up image in local emoji/ directory - emojiPath, ok := findLocalEmojiPath(emojiName) - if !ok { - // Download missing emoji file directly from GitHub repository into emoji/ folder - downloadedPath, downloaded := downloadMissingEmojiFromGit(emojiName) - if downloaded { - emojiPath = downloadedPath - ok = true - } + // If running on dev bot, do not read or import missing emojis from local emoji/ directory + if config.IsDevBot() { + return ei.Emotes{}, false } + // If still missing after Discord fetch, look up image in local emoji/ directory + emojiPath, ok := findLocalEmojiPath(emojiName) if !ok { return ei.Emotes{}, false } @@ -142,43 +138,6 @@ func EnsureEmojiFromLocalRepo(s *discordgo.Session, name string) (ei.Emotes, boo return createdEmoji, true } - - -func downloadMissingEmojiFromGit(emojiName string) (string, bool) { - baseURL := "https://raw.githubusercontent.com/mkmccarty/TokenTimeBoostBot/refs/heads/main/emoji/" - extensions := []string{".png", ".gif"} - - for _, ext := range extensions { - fileURL := fmt.Sprintf("%s%s%s", baseURL, emojiName, ext) - resp, err := http.Get(fileURL) - if err != nil || resp.StatusCode != http.StatusOK { - if resp != nil && resp.Body != nil { - _ = resp.Body.Close() - } - continue - } - - _ = os.MkdirAll("emoji", 0755) - localPath := filepath.Join("emoji", fmt.Sprintf("%s%s", emojiName, ext)) - outFile, err := os.Create(localPath) - if err != nil { - _ = resp.Body.Close() - continue - } - - _, err = io.Copy(outFile, resp.Body) - _ = outFile.Close() - _ = resp.Body.Close() - - if err == nil { - log.Printf("Successfully pulled missing emoji %s%s from GitHub repo", emojiName, ext) - return localPath, true - } - } - - return "", false -} - func findLocalEmojiPath(emojiName string) (string, bool) { files, err := os.ReadDir("emoji") if err != nil { @@ -364,6 +323,10 @@ func isEmojiFile(fileName string) bool { // ImportNewEmojis will import new emojis from the emoji directory into the discord app func ImportNewEmojis(s *discordgo.Session) { + if config.IsDevBot() { + return + } + // Get a list of all files in the emoji directory files, err := os.ReadDir("emoji") if err != nil {