a fouakin comit, innit'

This commit is contained in:
Bence T. 2025-04-30 20:38:14 +02:00
commit 014828b85f
4 changed files with 311 additions and 0 deletions

182
.gitignore vendored Normal file
View file

@ -0,0 +1,182 @@
# TOKEN
TOKEN
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
share/
bin/
develop-eggs/
dist/
downloads/
pyvenv.cfg
eggs/
.eggs/
lib/
lib64/
lib64
include/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# UV
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
#uv.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
# Ruff stuff:
.ruff_cache/
# PyPI configuration file
.pypirc

26
LICENSE Normal file
View file

@ -0,0 +1,26 @@
GLWTS(Good Luck With That Shit) Public License
Copyright (c) Every-fucking-one, except the Author
Everyone is permitted to copy, distribute, modify, merge, sell, publish,
sublicense or whatever the fuck they want with this software but at their
OWN RISK.
Preamble
The author has absolutely no fucking clue what the code in this project
does. It might just fucking work or not, there is no third option.
GOOD LUCK WITH THAT SHIT PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION, AND MODIFICATION
0. You just DO WHATEVER THE FUCK YOU WANT TO as long as you NEVER LEAVE
A FUCKING TRACE TO TRACK THE AUTHOR of the original product to blame for
or hold responsible.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
Good luck and Godspeed.

2
README Normal file
View file

@ -0,0 +1,2 @@
geci szar discord bot
de majkát nem játszik le

101
main.py Normal file
View file

@ -0,0 +1,101 @@
import discord
from discord.ext import commands
from discord import FFmpegPCMAudio
import yt_dlp
# Set up intents and bot
intents = discord.Intents.default()
intents.message_content = True # Needed to read .play/.stop commands
bot = commands.Bot(command_prefix="..", intents=intents)
# Global variable to hold the current voice client
voice_client = None
@bot.event
async def on_ready():
# Construct the invite URL dynamically
application_info = await bot.application_info()
client_id = application_info.id
invite_url = f"https://discord.com/oauth2/authorize?client_id={client_id}&permissions=3145728&scope=bot"
print(f"itt vagyok gecik ( {bot.user} )")
print(f"Invite URL: {invite_url}")
@bot.command()
async def play(ctx, url: str):
global voice_client
if not ctx.author.voice:
await ctx.send("lépjél már be egy kurva csatornába te szerencsétlen fasz")
return
# Connect to the user's voice channel if not already connected
if not voice_client or not voice_client.is_connected():
voice_client = await ctx.author.voice.channel.connect()
# Stop any currently playing audio
if voice_client.is_playing():
voice_client.stop()
# Stream audio from YouTube
try:
# yt-dlp options
ydl_opts = {
"format": "bestaudio", # Prefer Opus with at least 160 kbps
"quiet": True,
"default_search": "ytsearch", # <--- This is the key fix
}
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
info = ydl.extract_info(url, download=False)
title = info["title"].lower()
blocked_keywords = [
"roma", "cigány", "mulatós", "azahriah", "azariah", "majka", "gypsy", "zgstudio", "curtis", "gipsy", "karpatia", "kárpátia",
"tóth gabi", "jolly", "dögös robi", "sandu ciorba", "maco mamuko", "ismerős arcok", "nicolae guta", "egészséges fejbőr", "puzsér"
]
if any(keyword in title for keyword in blocked_keywords):
await ctx.send(f"na ezt a fost nem jatszom le: `{info['title']}`")
return
audio_url = info["url"]
ffmpeg_options = {
"before_options": "-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5",
"options": "-vn"
}
voice_client.play(FFmpegPCMAudio(audio_url, **ffmpeg_options), after=lambda e: print(f"Finished playing: {e}"))
await ctx.send(f"most ez a fos szól: {info['title']}")
except Exception as e:
await ctx.send(f"most ezzel mi a kurva anyámat kezdjek?: {e}")
@bot.command()
async def stop(ctx):
global voice_client
if voice_client and voice_client.is_playing():
voice_client.stop()
await ctx.send("hát akkor ne hallgassad basszalak szájba")
else:
await ctx.send("nem is szól semmi te buzeráns fasz")
@bot.command()
async def leave(ctx):
global voice_client
if voice_client and voice_client.is_connected():
await voice_client.disconnect()
voice_client = None
await ctx.send("akkor csá gecik")
else:
await ctx.send("nem is vagyok voice channelben basszam ki a szádat")
# Run the bot
TOKEN = open("TOKEN").read().strip()
bot.run(TOKEN)