ŠLUDBA, zábrana erroru u kabelové verze
This commit is contained in:
BIN
hudba/Banánky v čokoládě.mp3
Normal file
BIN
hudba/Banánky v čokoládě.mp3
Normal file
Binary file not shown.
BIN
hudba/Davidův ingliš rap.mp3
Normal file
BIN
hudba/Davidův ingliš rap.mp3
Normal file
Binary file not shown.
BIN
hudba/Goon Goon.mp3
Normal file
BIN
hudba/Goon Goon.mp3
Normal file
Binary file not shown.
BIN
hudba/Pomsta Sudetská.mp3
Normal file
BIN
hudba/Pomsta Sudetská.mp3
Normal file
Binary file not shown.
BIN
hudba/Redditparoháč.mp3
Normal file
BIN
hudba/Redditparoháč.mp3
Normal file
Binary file not shown.
BIN
hudba/Roman Posselt.mp3
Normal file
BIN
hudba/Roman Posselt.mp3
Normal file
Binary file not shown.
BIN
hudba/Sudetskej Král.mp3
Normal file
BIN
hudba/Sudetskej Král.mp3
Normal file
Binary file not shown.
BIN
hudba/Zrada.mp3
Normal file
BIN
hudba/Zrada.mp3
Normal file
Binary file not shown.
BIN
hudba/heckingemmy (pravdivá verze).mp3
Normal file
BIN
hudba/heckingemmy (pravdivá verze).mp3
Normal file
Binary file not shown.
BIN
hudba/heckingemmy.mp3
Normal file
BIN
hudba/heckingemmy.mp3
Normal file
Binary file not shown.
BIN
hudba/Šárty Paroháč.mp3
Normal file
BIN
hudba/Šárty Paroháč.mp3
Normal file
Binary file not shown.
49
main-kord.py
49
main-kord.py
@@ -13,6 +13,8 @@ CZCHAN_LLM_KEY = os.getenv("CZCHAN_LLM_KEY")
|
|||||||
|
|
||||||
CHANCE = 1.0
|
CHANCE = 1.0
|
||||||
IMAGE_FOLDER = "obruzky"
|
IMAGE_FOLDER = "obruzky"
|
||||||
|
MUSIC_FOLDER = "hudba"
|
||||||
|
MAX_SIZE = int(9.9 * 1024 * 1024) # 9,9mb myslím
|
||||||
|
|
||||||
intents = discord.Intents.default()
|
intents = discord.Intents.default()
|
||||||
intents.message_content = True
|
intents.message_content = True
|
||||||
@@ -20,11 +22,30 @@ intents.message_content = True
|
|||||||
bot = commands.Bot(command_prefix="!", intents=intents)
|
bot = commands.Bot(command_prefix="!", intents=intents)
|
||||||
|
|
||||||
VIDEO_EXT = (
|
VIDEO_EXT = (
|
||||||
".mp4", ".mov", ".avi", ".mkv",
|
".mp4",
|
||||||
".webm", ".3gp", ".3gpp", ".3g2"
|
".mov",
|
||||||
|
".avi",
|
||||||
|
".mkv",
|
||||||
|
".webm",
|
||||||
|
".3gp",
|
||||||
|
".3gpp",
|
||||||
|
".3g2",
|
||||||
|
)
|
||||||
|
|
||||||
|
AUDIO_EXT = (
|
||||||
|
".mp3",
|
||||||
|
".wav",
|
||||||
|
".ogg",
|
||||||
|
".flac",
|
||||||
|
".m4a",
|
||||||
|
".opus",
|
||||||
|
".3gp",
|
||||||
|
".3gpp",
|
||||||
|
".3g2",
|
||||||
)
|
)
|
||||||
|
|
||||||
files = os.listdir(IMAGE_FOLDER)
|
files = os.listdir(IMAGE_FOLDER)
|
||||||
|
files2 = os.listdir(MUSIC_FOLDER)
|
||||||
|
|
||||||
PHRASES_ALL = [
|
PHRASES_ALL = [
|
||||||
"Tak uědlej JINEEJ SKUPINA VOLE TY NUDLE ČÍNSKÁ POSRANA",
|
"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
|
"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()
|
@bot.command()
|
||||||
async def zlincerald(ctx):
|
async def zlincerald(ctx):
|
||||||
chosen = random.choice(files)
|
valid_files = []
|
||||||
path = os.path.join(IMAGE_FOLDER, chosen)
|
|
||||||
|
|
||||||
|
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))
|
await ctx.send(file=discord.File(path))
|
||||||
|
|
||||||
def llm_api_call(messages):
|
def llm_api_call(messages):
|
||||||
|
|||||||
30
main.py
30
main.py
@@ -12,6 +12,7 @@ CZCHAN_LLM_KEY = os.getenv("CZCHAN_LLM_KEY")
|
|||||||
|
|
||||||
CHANCE = 1.0
|
CHANCE = 1.0
|
||||||
IMAGE_FOLDER = "obruzky"
|
IMAGE_FOLDER = "obruzky"
|
||||||
|
MUSIC_FOLDER = "hudba"
|
||||||
|
|
||||||
bot = telebot.TeleBot(API_KEY)
|
bot = telebot.TeleBot(API_KEY)
|
||||||
|
|
||||||
@@ -82,8 +83,20 @@ VIDEO_EXT = (
|
|||||||
".3gpp",
|
".3gpp",
|
||||||
".3g2",
|
".3g2",
|
||||||
) # 3GP JE ŽRÍJSKÉ A SUDETKEŠNÍ, ZRÁDCI POUŽÍVAJÍ MPEG
|
) # 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)
|
files = os.listdir(IMAGE_FOLDER)
|
||||||
|
files2 = os.listdir(MUSIC_FOLDER)
|
||||||
|
|
||||||
|
|
||||||
# Tenhle diddy blud skenuje složku vždecke když posílá žlincerald lebkalebkalebka
|
# Tenhle diddy blud skenuje složku vždecke když posílá žlincerald lebkalebkalebka
|
||||||
@@ -100,6 +113,23 @@ def send_random_image(message):
|
|||||||
else:
|
else:
|
||||||
bot.send_photo(message.chat.id, media)
|
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
|
# https://github.com/oobabooga/text-generation-webui/wiki/12-%E2%80%90-OpenAI-API#chat-completions-with-characters
|
||||||
def llm_api_call(messages):
|
def llm_api_call(messages):
|
||||||
|
|||||||
Reference in New Issue
Block a user