Skip to content

Commit

Permalink
Merge pull request #24 from JvPeek/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
awsdcrafting authored Jan 24, 2024
2 parents 83554c8 + 88c1cda commit a4ce296
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions discord_bot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys
import json
import re
from typing import Optional
from typing import Optional, List
from dataclasses import dataclass

import discord
Expand All @@ -20,7 +20,7 @@
tree = app_commands.CommandTree(client)
github: Github
repo: Repository
allowed_roles:list[int]|None = None
allowed_roles: List[int]|None = None

state_file_path = "./state.json"
state = {}
Expand All @@ -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 a4ce296

Please sign in to comment.