Skip to content

Commit

Permalink
feat: Github Songs are now lowercase
Browse files Browse the repository at this point in the history
  • Loading branch information
awsdcrafting committed Jan 24, 2024
1 parent 53c09c8 commit 88c1cda
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions discord_bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
class SaveSongModal(ui.Modal, title="Save Song"):

song_title = ui.TextInput(label="Song title")
file_name = ui.TextInput(label="Song name")
file_name = ui.TextInput(label="Command name")
author = ui.TextInput(label="Song author")
#notation = ui.Select(options=[SelectOption(label="Modern (bongo+)", value="bongo+"), SelectOption(label="legacy", value="bongo+")])
notation = ui.TextInput(label="Song notation")
Expand Down Expand Up @@ -65,7 +65,7 @@ async def on_submit(self, interaction: Interaction) -> None:
print(self.extras)
print(interaction.message)
file_name = self.file_name.value.strip().replace(".json", "").replace(".", "")
file_name = re.sub(r"\s+", "_", file_name).replace("/", "").replace("\\", "")
file_name = re.sub(r"\s+", "_", file_name).replace("/", "").replace("\\", "").lower()
file_name += ".json"
notation = self.notation.value
if notation == "modern" or notation == "default" or notation == "bongo":
Expand Down Expand Up @@ -122,7 +122,7 @@ def parse_song(message: discord.Message):
notation = "bongo+"

pass
return Song(title, title.replace(" ", "_"), message.author.name, notation, notes)
return Song(title, title.replace(" ", "_").lower(), message.author.name, notation, notes)



Expand Down Expand Up @@ -236,7 +236,7 @@ def read_state():
global state
global state_file_path
if not os.path.isfile(state_file_path):
state = {"last_time": None, "msgs": []}
state = {"last_time": None, "msgs": set()}
return
with open(state_file_path, "r") as state_file:
state_data = json.load(state_file)
Expand Down
2 changes: 1 addition & 1 deletion src/bongocat.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ async function playFromGithub(song, user)
let dedications = song.match(userRegex)?.map(s => s.replace("@", ""));
song = song.replaceAll(userRegex, ""); //remove usernames from string
song = song.trim().replaceAll(/\s+/g, "_").replace(/\.json$/, "").replaceAll(".", ""); //remove whitespaces, remove dots

song = song.toLowerCase();
song += ".json";

console.log("Playing", song, "from github for", user);
Expand Down

0 comments on commit 88c1cda

Please sign in to comment.