diff --git a/hudba/Banánky v čokoládě.mp3 b/hudba/Banánky v čokoládě.mp3 new file mode 100644 index 0000000..bd0e245 Binary files /dev/null and b/hudba/Banánky v čokoládě.mp3 differ diff --git a/hudba/Davidův ingliš rap.mp3 b/hudba/Davidův ingliš rap.mp3 new file mode 100644 index 0000000..5af651b Binary files /dev/null and b/hudba/Davidův ingliš rap.mp3 differ diff --git a/hudba/Goon Goon.mp3 b/hudba/Goon Goon.mp3 new file mode 100644 index 0000000..3bc0e23 Binary files /dev/null and b/hudba/Goon Goon.mp3 differ diff --git a/hudba/Pomsta Sudetská.mp3 b/hudba/Pomsta Sudetská.mp3 new file mode 100644 index 0000000..a28661a Binary files /dev/null and b/hudba/Pomsta Sudetská.mp3 differ diff --git a/hudba/Redditparoháč.mp3 b/hudba/Redditparoháč.mp3 new file mode 100644 index 0000000..1b22810 Binary files /dev/null and b/hudba/Redditparoháč.mp3 differ diff --git a/hudba/Roman Posselt.mp3 b/hudba/Roman Posselt.mp3 new file mode 100644 index 0000000..294cbd2 Binary files /dev/null and b/hudba/Roman Posselt.mp3 differ diff --git a/hudba/Sudetskej Král.mp3 b/hudba/Sudetskej Král.mp3 new file mode 100644 index 0000000..bcd6020 Binary files /dev/null and b/hudba/Sudetskej Král.mp3 differ diff --git a/hudba/Zrada.mp3 b/hudba/Zrada.mp3 new file mode 100644 index 0000000..d659047 Binary files /dev/null and b/hudba/Zrada.mp3 differ diff --git a/hudba/heckingemmy (pravdivá verze).mp3 b/hudba/heckingemmy (pravdivá verze).mp3 new file mode 100644 index 0000000..706a877 Binary files /dev/null and b/hudba/heckingemmy (pravdivá verze).mp3 differ diff --git a/hudba/heckingemmy.mp3 b/hudba/heckingemmy.mp3 new file mode 100644 index 0000000..b7c890f Binary files /dev/null and b/hudba/heckingemmy.mp3 differ diff --git a/hudba/Šárty Paroháč.mp3 b/hudba/Šárty Paroháč.mp3 new file mode 100644 index 0000000..f581705 Binary files /dev/null and b/hudba/Šárty Paroháč.mp3 differ diff --git a/main-kord.py b/main-kord.py index 91f724e..244a1fa 100644 --- a/main-kord.py +++ b/main-kord.py @@ -13,6 +13,8 @@ CZCHAN_LLM_KEY = os.getenv("CZCHAN_LLM_KEY") CHANCE = 1.0 IMAGE_FOLDER = "obruzky" +MUSIC_FOLDER = "hudba" +MAX_SIZE = int(9.9 * 1024 * 1024) # 9,9mb myslím intents = discord.Intents.default() intents.message_content = True @@ -20,11 +22,30 @@ intents.message_content = True bot = commands.Bot(command_prefix="!", intents=intents) VIDEO_EXT = ( - ".mp4", ".mov", ".avi", ".mkv", - ".webm", ".3gp", ".3gpp", ".3g2" + ".mp4", + ".mov", + ".avi", + ".mkv", + ".webm", + ".3gp", + ".3gpp", + ".3g2", +) + +AUDIO_EXT = ( + ".mp3", + ".wav", + ".ogg", + ".flac", + ".m4a", + ".opus", + ".3gp", + ".3gpp", + ".3g2", ) files = os.listdir(IMAGE_FOLDER) +files2 = os.listdir(MUSIC_FOLDER) PHRASES_ALL = [ "Tak uědlej JINEEJ SKUPINA VOLE TY NUDLE ČÍNSKÁ POSRANA", @@ -75,11 +96,31 @@ PHRASES_BRIMMY = [ "Jeden měsíc mám troon arc a tohle jse stane", # taky dodělži ] +# kabel zlincerald command musí mít kontrolku pro velikost souboru protože nějaké soubory mají přes 10mb což kabel nepovoluje @bot.command() async def zlincerald(ctx): - chosen = random.choice(files) - path = os.path.join(IMAGE_FOLDER, chosen) + valid_files = [] + for f in files: + path = os.path.join(IMAGE_FOLDER, f) + if os.path.getsize(path) <= MAX_SIZE: + valid_files.append(f) + + chosen = random.choice(valid_files) + path = os.path.join(IMAGE_FOLDER, chosen) + await ctx.send(file=discord.File(path)) + +@bot.command() +async def hudba(ctx): + valid_files = [] + + for f in files2: + path = os.path.join(MUSIC_FOLDER, f) + if os.path.getsize(path) <= MAX_SIZE: + valid_files.append(f) + + chosen = random.choice(valid_files) + path = os.path.join(MUSIC_FOLDER, chosen) await ctx.send(file=discord.File(path)) def llm_api_call(messages): diff --git a/main.py b/main.py index 84b3447..15c9c2d 100644 --- a/main.py +++ b/main.py @@ -12,6 +12,7 @@ CZCHAN_LLM_KEY = os.getenv("CZCHAN_LLM_KEY") CHANCE = 1.0 IMAGE_FOLDER = "obruzky" +MUSIC_FOLDER = "hudba" bot = telebot.TeleBot(API_KEY) @@ -82,8 +83,20 @@ VIDEO_EXT = ( ".3gpp", ".3g2", ) # 3GP JE ŽRÍJSKÉ A SUDETKEŠNÍ, ZRÁDCI POUŽÍVAJÍ MPEG +AUDIO_EXT = ( + ".mp3", + ".wav", + ".ogg", + ".flac", + ".m4a", + ".opus", + ".3gp", + ".3gpp", + ".3g2", +) files = os.listdir(IMAGE_FOLDER) +files2 = os.listdir(MUSIC_FOLDER) # Tenhle diddy blud skenuje složku vždecke když posílá žlincerald lebkalebkalebka @@ -100,6 +113,23 @@ def send_random_image(message): else: bot.send_photo(message.chat.id, media) +#šludba +@bot.message_handler(commands=["hudba"]) +def send_random_song(message): + chosen = random.choice(files2) + path = os.path.join(MUSIC_FOLDER, chosen) + + with open(path, "rb") as media: + name = chosen.lower() + + if name.endswith(AUDIO_EXT): + bot.send_audio(message.chat.id, media) + + elif name.endswith(VIDEO_EXT): + bot.send_video(message.chat.id, media) + + else: + bot.send_document(message.chat.id, media) # https://github.com/oobabooga/text-generation-webui/wiki/12-%E2%80%90-OpenAI-API#chat-completions-with-characters def llm_api_call(messages):