Š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

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