ŠLUDBA, zábrana erroru u kabelové verze

This commit is contained in:
2026-03-19 22:23:37 +01:00
parent 75325f3b3e
commit fd24acf82a
13 changed files with 75 additions and 4 deletions

Binary file not shown.

Binary file not shown.

BIN
hudba/Goon Goon.mp3 Normal file

Binary file not shown.

BIN
hudba/Pomsta Sudetská.mp3 Normal file

Binary file not shown.

BIN
hudba/Redditparoháč.mp3 Normal file

Binary file not shown.

BIN
hudba/Roman Posselt.mp3 Normal file

Binary file not shown.

BIN
hudba/Sudetskej Král.mp3 Normal file

Binary file not shown.

BIN
hudba/Zrada.mp3 Normal file

Binary file not shown.

Binary file not shown.

BIN
hudba/heckingemmy.mp3 Normal file

Binary file not shown.

BIN
hudba/Šárty Paroháč.mp3 Normal file

Binary file not shown.

View File

@@ -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):

30
main.py
View File

@@ -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):