Spaces:
Paused
Paused
sss
#1
by Gabeczkag - opened
- .env.example +0 -1
- .gitattributes +35 -35
- .gitignore +0 -1
- Dockerfile +16 -16
- PCconnector.py +0 -47
- README.md +12 -12
- __pycache__/bot.cpython-311.pyc +0 -0
- app.py +0 -17
- au.version +0 -2
- bot.py +0 -833
- botdc.service +0 -14
- deploy.bat +0 -3
- mainrun.py +0 -116
- oracle_setup.sh +0 -26
- requirements.txt +0 -4
- start_bot.bat +0 -5
- termux_autoupdate.sh +0 -43
- termux_host.sh +0 -18
- termux_setup.sh +0 -18
- termux_ssh.sh +0 -17
- termux_start.sh +0 -6
- termux_watch.sh +0 -15
.env.example
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
DISCORD_TOKEN=twój_token_bota
|
|
|
|
|
|
.gitattributes
CHANGED
|
@@ -1,35 +1,35 @@
|
|
| 1 |
-
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
-
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
-
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
-
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
-
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
-
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
-
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
-
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
-
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
.gitignore
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
.env
|
|
|
|
|
|
Dockerfile
CHANGED
|
@@ -1,16 +1,16 @@
|
|
| 1 |
-
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
| 2 |
-
# you will also find guides on how best to write your Dockerfile
|
| 3 |
-
|
| 4 |
-
FROM python:3.9
|
| 5 |
-
|
| 6 |
-
RUN useradd -m -u 1000 user
|
| 7 |
-
USER user
|
| 8 |
-
ENV PATH="/home/user/.local/bin:$PATH"
|
| 9 |
-
|
| 10 |
-
WORKDIR /app
|
| 11 |
-
|
| 12 |
-
COPY --chown=user ./requirements.txt requirements.txt
|
| 13 |
-
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 14 |
-
|
| 15 |
-
COPY --chown=user . /app
|
| 16 |
-
CMD ["
|
|
|
|
| 1 |
+
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
| 2 |
+
# you will also find guides on how best to write your Dockerfile
|
| 3 |
+
|
| 4 |
+
FROM python:3.9
|
| 5 |
+
|
| 6 |
+
RUN useradd -m -u 1000 user
|
| 7 |
+
USER user
|
| 8 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 9 |
+
|
| 10 |
+
WORKDIR /app
|
| 11 |
+
|
| 12 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
| 13 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 14 |
+
|
| 15 |
+
COPY --chown=user . /app
|
| 16 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
PCconnector.py
DELETED
|
@@ -1,47 +0,0 @@
|
|
| 1 |
-
import subprocess
|
| 2 |
-
import os
|
| 3 |
-
import sys
|
| 4 |
-
import json
|
| 5 |
-
|
| 6 |
-
CONFIG_FILE = "pc_config.json"
|
| 7 |
-
DEFAULT_IP = "192.168.100.35"
|
| 8 |
-
PORT = 8022
|
| 9 |
-
USER = "u0_a410"
|
| 10 |
-
|
| 11 |
-
config = {}
|
| 12 |
-
if os.path.exists(CONFIG_FILE):
|
| 13 |
-
with open(CONFIG_FILE) as f:
|
| 14 |
-
config = json.load(f)
|
| 15 |
-
|
| 16 |
-
IP = config.get("ip", DEFAULT_IP)
|
| 17 |
-
|
| 18 |
-
if len(sys.argv) > 1:
|
| 19 |
-
IP = sys.argv[1]
|
| 20 |
-
|
| 21 |
-
ssh_paths = [
|
| 22 |
-
r"C:\Windows\System32\OpenSSH\ssh.exe",
|
| 23 |
-
r"C:\Program Files\Git\usr\bin\ssh.exe",
|
| 24 |
-
"ssh",
|
| 25 |
-
]
|
| 26 |
-
|
| 27 |
-
ssh = None
|
| 28 |
-
for p in ssh_paths:
|
| 29 |
-
try:
|
| 30 |
-
subprocess.run([p, "-V"], capture_output=True)
|
| 31 |
-
ssh = p
|
| 32 |
-
break
|
| 33 |
-
except:
|
| 34 |
-
continue
|
| 35 |
-
|
| 36 |
-
if not ssh:
|
| 37 |
-
print("Nie znaleziono SSH. Zainstaluj OpenSSH lub Git.")
|
| 38 |
-
print("Jako Admin: Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0")
|
| 39 |
-
sys.exit(1)
|
| 40 |
-
|
| 41 |
-
print(f"Lacze z {USER}@{IP}:{PORT}...")
|
| 42 |
-
code = os.system(f'""{ssh}" {USER}@{IP} -p {PORT}"')
|
| 43 |
-
|
| 44 |
-
if code != 0:
|
| 45 |
-
print(f"\nBlad polaczenia. Sprawdz IP telefonu.")
|
| 46 |
-
print(f"Na telefonie uruchom: bash termux_host.sh")
|
| 47 |
-
print(f"Lub podaj IP: python PCconnector.py <nowe_ip>")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: BotDC
|
| 3 |
-
emoji: 🚀
|
| 4 |
-
colorFrom: red
|
| 5 |
-
colorTo: pink
|
| 6 |
-
sdk: docker
|
| 7 |
-
pinned: false
|
| 8 |
-
license: apache-2.0
|
| 9 |
-
short_description: MyBotInf
|
| 10 |
-
---
|
| 11 |
-
|
| 12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: BotDC
|
| 3 |
+
emoji: 🚀
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: pink
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: false
|
| 8 |
+
license: apache-2.0
|
| 9 |
+
short_description: MyBotInf
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
__pycache__/bot.cpython-311.pyc
DELETED
|
Binary file (75.1 kB)
|
|
|
app.py
DELETED
|
@@ -1,17 +0,0 @@
|
|
| 1 |
-
from fastapi import FastAPI
|
| 2 |
-
import asyncio
|
| 3 |
-
import uvicorn
|
| 4 |
-
from bot import start_bot
|
| 5 |
-
|
| 6 |
-
app = FastAPI()
|
| 7 |
-
|
| 8 |
-
@app.on_event("startup")
|
| 9 |
-
async def startup():
|
| 10 |
-
asyncio.create_task(start_bot())
|
| 11 |
-
|
| 12 |
-
@app.get("/")
|
| 13 |
-
async def root():
|
| 14 |
-
return {"status": "ok"}
|
| 15 |
-
|
| 16 |
-
if __name__ == "__main__":
|
| 17 |
-
uvicorn.run(app, host="0.0.0.0", port=7860)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
au.version
DELETED
|
@@ -1,2 +0,0 @@
|
|
| 1 |
-
29
|
| 2 |
-
install-packages=true
|
|
|
|
|
|
|
|
|
bot.py
DELETED
|
@@ -1,833 +0,0 @@
|
|
| 1 |
-
import asyncio
|
| 2 |
-
import discord
|
| 3 |
-
from discord import app_commands
|
| 4 |
-
import os
|
| 5 |
-
import json
|
| 6 |
-
import random
|
| 7 |
-
import re
|
| 8 |
-
from datetime import timedelta
|
| 9 |
-
from dotenv import load_dotenv
|
| 10 |
-
|
| 11 |
-
if os.path.exists(".donotasktoken"):
|
| 12 |
-
load_dotenv()
|
| 13 |
-
TOKEN = os.getenv("DISCORD_TOKEN")
|
| 14 |
-
else:
|
| 15 |
-
TOKEN = input("Podaj token Discorda: ").strip()
|
| 16 |
-
with open(".env", "w") as f:
|
| 17 |
-
f.write(f"DISCORD_TOKEN={TOKEN}\n")
|
| 18 |
-
open(".donotasktoken", "w").close()
|
| 19 |
-
print("Token zapisany. Nastepnym razem bedzie uzyty automatycznie.")
|
| 20 |
-
|
| 21 |
-
intents = discord.Intents.default()
|
| 22 |
-
intents.message_content = True
|
| 23 |
-
intents.members = True
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
class BotDC(discord.Client):
|
| 27 |
-
def __init__(self):
|
| 28 |
-
super().__init__(intents=intents)
|
| 29 |
-
self.tree = app_commands.CommandTree(self)
|
| 30 |
-
|
| 31 |
-
async def setup_hook(self):
|
| 32 |
-
await self.tree.sync()
|
| 33 |
-
|
| 34 |
-
async def on_ready(self):
|
| 35 |
-
print(f"Zalogowano jako {self.user}")
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
bot = BotDC()
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
@bot.tree.command(name="ping", description="Sprawdza czy bot odpowiada")
|
| 42 |
-
async def ping(interaction: discord.Interaction):
|
| 43 |
-
await interaction.response.send_message("Pong!")
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
@bot.tree.command(name="hello", description="Wita użytkownika")
|
| 47 |
-
async def hello(interaction: discord.Interaction):
|
| 48 |
-
await interaction.response.send_message(f"Cześć {interaction.user.mention}!")
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
@bot.tree.command(name="kick", description="Wyrzuca użytkownika")
|
| 52 |
-
@app_commands.describe(member="Użytkownik do wyrzucenia", reason="Powód")
|
| 53 |
-
@app_commands.default_permissions(kick_members=True)
|
| 54 |
-
async def kick(interaction: discord.Interaction, member: discord.Member, reason: str = "Nie podano powodu"):
|
| 55 |
-
await member.kick(reason=reason)
|
| 56 |
-
await interaction.response.send_message(f"👍 Wyrzucono {member.mention}. Powód: {reason}")
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
@bot.tree.command(name="ban", description="Banuje użytkownika")
|
| 60 |
-
@app_commands.describe(member="Użytkownik do zbanowania", reason="Powód")
|
| 61 |
-
@app_commands.default_permissions(ban_members=True)
|
| 62 |
-
async def ban(interaction: discord.Interaction, member: discord.Member, reason: str = "Nie podano powodu"):
|
| 63 |
-
await member.ban(reason=reason)
|
| 64 |
-
await interaction.response.send_message(f"👍 Zbanowano {member.mention}. Powód: {reason}")
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
@bot.tree.command(name="unban", description="Odbanowuje użytkownika")
|
| 68 |
-
@app_commands.describe(user="Nazwa użytkownika (np. user#1234)")
|
| 69 |
-
@app_commands.default_permissions(ban_members=True)
|
| 70 |
-
async def unban(interaction: discord.Interaction, user: str):
|
| 71 |
-
banned = [u async for u in interaction.guild.bans()]
|
| 72 |
-
name, discrim = user.split("#")
|
| 73 |
-
entry = next((u for u in banned if u.user.name == name and u.user.discriminator == discrim), None)
|
| 74 |
-
if entry:
|
| 75 |
-
await interaction.guild.unban(entry.user)
|
| 76 |
-
await interaction.response.send_message(f"👍 Odbanowano {entry.user}")
|
| 77 |
-
else:
|
| 78 |
-
await interaction.response.send_message("❌ Nie znaleziono użytkownika")
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
@bot.tree.command(name="timeout", description="Wycisza użytkownika na X minut")
|
| 82 |
-
@app_commands.describe(member="Użytkownik", minutes="Liczba minut", reason="Powód")
|
| 83 |
-
@app_commands.default_permissions(moderate_members=True)
|
| 84 |
-
async def timeout(interaction: discord.Interaction, member: discord.Member, minutes: int, reason: str = "Nie podano powodu"):
|
| 85 |
-
await member.timeout(discord.utils.utcnow() + timedelta(minutes=minutes), reason=reason)
|
| 86 |
-
await interaction.response.send_message(f"👍 Wyciszono {member.mention} na {minutes} min. Powód: {reason}")
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
@bot.tree.command(name="untimeout", description="Cofa wyciszenie")
|
| 90 |
-
@app_commands.describe(member="Użytkownik")
|
| 91 |
-
@app_commands.default_permissions(moderate_members=True)
|
| 92 |
-
async def untimeout(interaction: discord.Interaction, member: discord.Member):
|
| 93 |
-
await member.timeout(None)
|
| 94 |
-
await interaction.response.send_message(f"👍 Cofnięto wyciszenie {member.mention}")
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
@bot.tree.command(name="clear", description="Usuwa wiadomości")
|
| 98 |
-
@app_commands.describe(amount="Liczba wiadomości do usunięcia")
|
| 99 |
-
@app_commands.default_permissions(manage_messages=True)
|
| 100 |
-
async def clear(interaction: discord.Interaction, amount: int):
|
| 101 |
-
await interaction.channel.purge(limit=amount)
|
| 102 |
-
await interaction.response.send_message(f"👍 Usunięto {amount} wiadomości", delete_after=5)
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
@bot.tree.command(name="lock", description="Blokuje kanał")
|
| 106 |
-
@app_commands.describe(channel="Kanał do zablokowania (opcjonalnie)")
|
| 107 |
-
@app_commands.default_permissions(manage_channels=True)
|
| 108 |
-
async def lock(interaction: discord.Interaction, channel: discord.TextChannel = None):
|
| 109 |
-
channel = channel or interaction.channel
|
| 110 |
-
await channel.set_permissions(interaction.guild.default_role, send_messages=False)
|
| 111 |
-
await interaction.response.send_message(f"🔒 Zablokowano {channel.mention}")
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
@bot.tree.command(name="unlock", description="Odblokowuje kanał")
|
| 115 |
-
@app_commands.describe(channel="Kanał do odblokowania (opcjonalnie)")
|
| 116 |
-
@app_commands.default_permissions(manage_channels=True)
|
| 117 |
-
async def unlock(interaction: discord.Interaction, channel: discord.TextChannel = None):
|
| 118 |
-
channel = channel or interaction.channel
|
| 119 |
-
await channel.set_permissions(interaction.guild.default_role, send_messages=True)
|
| 120 |
-
await interaction.response.send_message(f"🔓 Odblokowano {channel.mention}")
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
@bot.tree.command(name="userinfo", description="Pokazuje informacje o użytkowniku")
|
| 124 |
-
@app_commands.describe(member="Użytkownik (opcjonalnie)")
|
| 125 |
-
async def userinfo(interaction: discord.Interaction, member: discord.Member = None):
|
| 126 |
-
member = member or interaction.user
|
| 127 |
-
embed = discord.Embed(title=f"{member}", color=member.color)
|
| 128 |
-
embed.set_thumbnail(url=member.display_avatar.url)
|
| 129 |
-
embed.add_field(name="ID", value=member.id, inline=True)
|
| 130 |
-
embed.add_field(name="Dołączył", value=member.joined_at.strftime("%Y-%m-%d"), inline=True)
|
| 131 |
-
embed.add_field(name="Konto utworzone", value=member.created_at.strftime("%Y-%m-%d"), inline=True)
|
| 132 |
-
embed.add_field(name="Role", value=" ".join(r.mention for r in member.roles[1:]) or "Brak", inline=False)
|
| 133 |
-
await interaction.response.send_message(embed=embed)
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
@bot.tree.command(name="serverinfo", description="Pokazuje informacje o serwerze")
|
| 137 |
-
async def serverinfo(interaction: discord.Interaction):
|
| 138 |
-
guild = interaction.guild
|
| 139 |
-
embed = discord.Embed(title=guild.name, color=discord.Color.blue())
|
| 140 |
-
if guild.icon:
|
| 141 |
-
embed.set_thumbnail(url=guild.icon.url)
|
| 142 |
-
embed.add_field(name="Właściciel", value=guild.owner.mention, inline=True)
|
| 143 |
-
embed.add_field(name="Członkowie", value=guild.member_count, inline=True)
|
| 144 |
-
embed.add_field(name="Kanały", value=len(guild.channels), inline=True)
|
| 145 |
-
embed.add_field(name="Role", value=len(guild.roles), inline=True)
|
| 146 |
-
embed.add_field(name="Utworzony", value=guild.created_at.strftime("%Y-%m-%d"), inline=True)
|
| 147 |
-
embed.add_field(name="ID", value=guild.id, inline=True)
|
| 148 |
-
await interaction.response.send_message(embed=embed)
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
@bot.tree.command(name="avatar", description="Pokazuje avatar użytkownika")
|
| 152 |
-
@app_commands.describe(member="Użytkownik (opcjonalnie)")
|
| 153 |
-
async def avatar(interaction: discord.Interaction, member: discord.Member = None):
|
| 154 |
-
member = member or interaction.user
|
| 155 |
-
embed = discord.Embed(title=f"Avatar {member.display_name}", color=member.color)
|
| 156 |
-
embed.set_image(url=member.display_avatar.url)
|
| 157 |
-
await interaction.response.send_message(embed=embed)
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
@bot.tree.command(name="roll", description="Rzuca kostką np. /roll 2d6")
|
| 161 |
-
@app_commands.describe(dice="np. 2d6, d20, 3d8+2")
|
| 162 |
-
async def roll(interaction: discord.Interaction, dice: str = "1d6"):
|
| 163 |
-
match = re.match(r"(\d*)d(\d+)(?:\+(\d+))?", dice.lower().replace(" ", ""))
|
| 164 |
-
if not match:
|
| 165 |
-
await interaction.response.send_message("❌ Zły format. Użyj np. `2d6` lub `d20`")
|
| 166 |
-
return
|
| 167 |
-
count = int(match.group(1)) if match.group(1) else 1
|
| 168 |
-
sides = int(match.group(2))
|
| 169 |
-
bonus = int(match.group(3)) if match.group(3) else 0
|
| 170 |
-
if count > 100 or sides > 1000:
|
| 171 |
-
await interaction.response.send_message("❌ Za dużo kostek lub ścianek (max 100 kostek, 1000 ścianek)")
|
| 172 |
-
return
|
| 173 |
-
rolls = [random.randint(1, sides) for _ in range(count)]
|
| 174 |
-
total = sum(rolls) + bonus
|
| 175 |
-
result = f"**{total}**" + (f" ({'+'.join(map(str, rolls))}" + (f" + {bonus})" if bonus else ")") if count > 1 else "")
|
| 176 |
-
await interaction.response.send_message(f"🎲 {interaction.user.mention} rzucił {dice}: {result}")
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
@bot.tree.command(name="coinflip", description="Rzuca monetą")
|
| 180 |
-
async def coinflip(interaction: discord.Interaction):
|
| 181 |
-
result = random.choice(["Orzeł", "Reszka"])
|
| 182 |
-
await interaction.response.send_message(f"🪙 {interaction.user.mention} dostał: **{result}**")
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
def banner(text, emoji=" "):
|
| 186 |
-
line = "▰" * 36
|
| 187 |
-
return f"```\n{line}\n{emoji} {text}\n{line}\n```"
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
@bot.tree.command(name="servergenerator", description="Formatuje cały serwer od nowa")
|
| 191 |
-
@app_commands.default_permissions(administrator=True)
|
| 192 |
-
async def servergenerator(interaction: discord.Interaction):
|
| 193 |
-
await interaction.response.defer(ephemeral=True)
|
| 194 |
-
guild = interaction.guild
|
| 195 |
-
|
| 196 |
-
await interaction.followup.send("⚠️ **Czy na pewno?** Za 10 sekund usunę WSZYSTKIE kanały, kategorie i role i stworzę nowy serwer od zera. Napisz `/cancel` w dowolnym kanale aby anulować.")
|
| 197 |
-
await asyncio.sleep(10)
|
| 198 |
-
|
| 199 |
-
await interaction.followup.send("🧹 **Czyszczę serwer...**")
|
| 200 |
-
for channel in guild.channels:
|
| 201 |
-
try:
|
| 202 |
-
await channel.delete()
|
| 203 |
-
await asyncio.sleep(random.uniform(1, 2.5))
|
| 204 |
-
except:
|
| 205 |
-
pass
|
| 206 |
-
|
| 207 |
-
bot_roles_to_keep = set()
|
| 208 |
-
if interaction.guild.me:
|
| 209 |
-
for r in interaction.guild.me.roles:
|
| 210 |
-
bot_roles_to_keep.add(r.id)
|
| 211 |
-
|
| 212 |
-
for role in guild.roles:
|
| 213 |
-
if role.name != "@everyone" and not role.managed and role.id not in bot_roles_to_keep:
|
| 214 |
-
try:
|
| 215 |
-
await role.delete()
|
| 216 |
-
await asyncio.sleep(random.uniform(1, 2.5))
|
| 217 |
-
except:
|
| 218 |
-
pass
|
| 219 |
-
|
| 220 |
-
await interaction.followup.send("✨ **Tworzę role...**")
|
| 221 |
-
|
| 222 |
-
roles_data = [
|
| 223 |
-
(0xE74C3C, "𝐖ł𝐚ś𝐜𝐢𝐜𝐢𝐞𝐥"),
|
| 224 |
-
(0xE67E22, "𝐙𝐚𝐫𝐳ą𝐝𝐜𝐚"),
|
| 225 |
-
(0x992D22, "𝐀𝐝𝐦𝐢𝐧𝐢𝐬𝐁𝐫𝐚𝐁𝐨𝐫"),
|
| 226 |
-
(0x3498DB, "𝐌𝐨𝐝𝐞𝐫𝐚𝐁𝐨𝐫"),
|
| 227 |
-
(0x2ECC71, "𝐏𝐨𝐦𝐨𝐜𝐧𝐢𝐤"),
|
| 228 |
-
(0x1F618D, "𝐏𝐲𝐭𝐡𝐨𝐧 𝐃𝐞𝐯"),
|
| 229 |
-
(0xF1C40F, "𝐉𝐒 𝐃𝐞𝐯"),
|
| 230 |
-
(0x2980B9, "𝐓𝐲𝐩𝐞𝐒𝐜𝐫𝐢𝐩𝐭 𝐃𝐞𝐯"),
|
| 231 |
-
(0xE67E22, "𝐉𝐚𝐯𝐚 𝐃𝐞𝐯"),
|
| 232 |
-
(0x8E44AD, "𝐂++ 𝐃𝐞𝐯"),
|
| 233 |
-
(0x9B59B6, "𝐂# 𝐃𝐞𝐯"),
|
| 234 |
-
(0xE74C3C, "𝐑𝐮𝐬𝐭 𝐃𝐞𝐯"),
|
| 235 |
-
(0x17A589, "𝐆𝐨 𝐃𝐞𝐯"),
|
| 236 |
-
(0x6C3483, "𝐏𝐇𝐏 𝐃𝐞𝐯"),
|
| 237 |
-
(0xCB4335, "𝐑𝐮𝐛𝐲 𝐃𝐞𝐯"),
|
| 238 |
-
(0xEB984E, "𝐊𝐨𝐭𝐥𝐢𝐧 𝐃𝐞𝐯"),
|
| 239 |
-
(0xE67E22, "𝐒𝐰𝐢𝐟𝐭 𝐃𝐞𝐯"),
|
| 240 |
-
(0x2ECC71, "𝐑𝐞𝐚𝐜𝐭 𝐃𝐞𝐯"),
|
| 241 |
-
(0x27AE60, "𝐕𝐮𝐞 𝐃𝐞𝐯"),
|
| 242 |
-
(0xE74C3C, "𝐀𝐧𝐠𝐮𝐥𝐚𝐫 𝐃𝐞𝐯"),
|
| 243 |
-
(0x1ABC9C, "𝐍𝐞𝐱𝐭 𝐃𝐞𝐯"),
|
| 244 |
-
(0x68D391, "𝐍𝐨𝐝𝐞 𝐃𝐞𝐯"),
|
| 245 |
-
(0xF39C12, "𝐅𝐮𝐥𝐥𝐒𝐭𝐚𝐜𝐤"),
|
| 246 |
-
(0x1E8449, "𝐃𝐣𝐚𝐧𝐠𝐨 𝐃𝐞𝐯"),
|
| 247 |
-
(0x2ECC71, "𝐅𝐥𝐚𝐬𝐤 𝐃𝐞𝐯"),
|
| 248 |
-
(0xE67E22, "𝐇𝐓𝐌𝐋/𝐂𝐒𝐒 𝐌𝐚𝐬𝐭𝐞𝐫"),
|
| 249 |
-
(0xF1C40F, "𝐏𝐲𝐁𝐞𝐠𝐢𝐧𝐧𝐞𝐫"),
|
| 250 |
-
(0xF7DC6F, "𝐏𝐲𝐈𝐧𝐭𝐞𝐫𝐦𝐞𝐝𝐢𝐚𝐭𝐞"),
|
| 251 |
-
(0xF9E79F, "𝐏𝐲𝐀𝐝𝐯𝐚𝐧𝐜𝐞𝐝"),
|
| 252 |
-
(0x82E0AA, "𝐖𝐞𝐁 𝐁𝐞𝐠𝐢𝐧𝐧𝐞𝐫"),
|
| 253 |
-
(0x58D68D, "𝐖𝐞𝐁 𝐈𝐧𝐭𝐞𝐫"),
|
| 254 |
-
(0x2ECC71, "𝐖𝐞𝐁 𝐀𝐝𝐯𝐚𝐧𝐜𝐞𝐝"),
|
| 255 |
-
(0x85C1E9, "𝐃𝐞𝐯 𝐁𝐞𝐠𝐢𝐧𝐧𝐞𝐫"),
|
| 256 |
-
(0x5DADE2, "𝐃𝐞𝐯 𝐈𝐧𝐭𝐞𝐫"),
|
| 257 |
-
(0x2E86C1, "𝐃𝐞𝐯 𝐄𝐱𝐩𝐞𝐫𝐭"),
|
| 258 |
-
(0x6C3483, "𝐃𝐞𝐯𝐎𝐩𝐬"),
|
| 259 |
-
(0x8E44AD, "𝐃𝐚𝐭𝐚𝐒𝐜𝐢𝐞𝐧𝐜𝐞"),
|
| 260 |
-
(0x9B59B6, "𝐔𝐈/𝐔𝐗 𝐃𝐞𝐬𝐢𝐠𝐧"),
|
| 261 |
-
(0x7D3C98, "𝐆𝐚𝐦𝐞 𝐃𝐞𝐯"),
|
| 262 |
-
(0xA569BD, "𝐌𝐨𝐛𝐢𝐥𝐞 𝐃𝐞𝐯"),
|
| 263 |
-
(0x4A235A, "𝐂𝐲𝐛𝐞𝐫𝐒𝐞𝐜"),
|
| 264 |
-
(0x1A5276, "𝐃𝐁𝐀"),
|
| 265 |
-
(0x2471A3, "𝐂𝐥𝐨𝐮𝐝 𝐄𝐧𝐠"),
|
| 266 |
-
(0x5B2C6F, "𝐀𝐈/𝐌𝐋 𝐒𝐩𝐞𝐜"),
|
| 267 |
-
(0x1ABC9C, "𝐃𝐞𝐬𝐢𝐠𝐧𝐞𝐫"),
|
| 268 |
-
(0x17A589, "𝐂𝐫𝐞𝐚𝐭𝐨𝐫"),
|
| 269 |
-
(0x148F77, "𝐁𝐞𝐭𝐚 𝐓𝐞𝐬𝐭"),
|
| 270 |
-
(0xE67E22, "𝐌𝐞𝐧𝐭𝐨𝐫"),
|
| 271 |
-
(0xF39C12, "𝐂𝐨𝐧𝐭𝐫𝐢𝐛𝐮𝐭𝐨𝐫"),
|
| 272 |
-
(0xE74C3C, "𝐕𝐈𝐏"),
|
| 273 |
-
(0xEB984E, "𝐀𝐫𝐭𝐢𝐬𝐭"),
|
| 274 |
-
(0x85C1E9, "𝐌𝐮𝐳𝐲𝐤"),
|
| 275 |
-
(0xF7DC6F, "𝐆𝐚𝐦𝐞𝐫"),
|
| 276 |
-
]
|
| 277 |
-
|
| 278 |
-
all_roles = []
|
| 279 |
-
for color, rn in roles_data:
|
| 280 |
-
try:
|
| 281 |
-
role = await guild.create_role(name=rn, color=discord.Color(color), mentionable=True, hoist=True)
|
| 282 |
-
all_roles.append(role)
|
| 283 |
-
await asyncio.sleep(random.uniform(1.5, 3))
|
| 284 |
-
except:
|
| 285 |
-
pass
|
| 286 |
-
|
| 287 |
-
await interaction.followup.send(f"✅ {len(all_roles)} ról gotowych! 🏗️ **Tworzę kanały...**")
|
| 288 |
-
|
| 289 |
-
admin_role = discord.utils.get(guild.roles, name="𝐀𝐝𝐦𝐢𝐧𝐢𝐬𝐭𝐫𝐚𝐭𝐨𝐫")
|
| 290 |
-
mod_role = discord.utils.get(guild.roles, name="𝐌𝐨𝐝𝐞𝐫𝐚𝐭𝐨𝐫")
|
| 291 |
-
|
| 292 |
-
priv = {guild.default_role: discord.PermissionOverwrite(read_messages=False)}
|
| 293 |
-
if admin_role:
|
| 294 |
-
priv[admin_role] = discord.PermissionOverwrite(read_messages=True, manage_messages=True, manage_channels=True)
|
| 295 |
-
if mod_role:
|
| 296 |
-
priv[mod_role] = discord.PermissionOverwrite(read_messages=True, manage_messages=True)
|
| 297 |
-
|
| 298 |
-
structure = [
|
| 299 |
-
("📌 INFORMACJE", [
|
| 300 |
-
("📜 regulamin", banner("REGULAMIN SERWERA", "📜") + "\n📌 Przestrzegaj • Szanuj • Nie spamuj"),
|
| 301 |
-
("📢 ogloszenia", banner("OGLOSZENIA", "📢") + "\n📌 Ważne informacje i aktualizacje"),
|
| 302 |
-
("✅ role", banner("ZDOBYWAJ ROLE", "✅") + "\n📌 Kliknij reakcje aby wybrać role"),
|
| 303 |
-
("📁 pliki", banner("BAZA PROJEKTOW I PLIKOW", "📁") + "\n📌 Projekty • Skrypty • Materiały od adminów"),
|
| 304 |
-
("📖 poradniki", banner("PORADNIKI I TUTORIALE", "📖") + "\n📌 Ucz się nowych technologii • Dziel się wiedzą"),
|
| 305 |
-
]),
|
| 306 |
-
("👑 ADMINISTRACJA", [
|
| 307 |
-
("👑 panel", banner("PANEL ADMINISTRACYJNY", "👑") + "\n📌 Zarządzanie serwerem • Tylko admini"),
|
| 308 |
-
("📋 logi", banner("LOGI SERWERA", "📋") + "\n📌 Aktywność i zdarzenia"),
|
| 309 |
-
("💬 admin-chat", banner("DYSKUSJA ADMINOW", "💬") + "\n📌 Tylko dla administracji"),
|
| 310 |
-
("📁 admin-projekty", banner("PROJEKTY ADMINISTRACJI", "📁") + "\n📌 Tutaj Admini dawają swoje Projekty!"),
|
| 311 |
-
("🤖 test-bot", banner("TESTOWANIE BOTA", "🤖") + "\n📌 Testuj nowe komendy i funkcje"),
|
| 312 |
-
], priv),
|
| 313 |
-
("💬 OGYLNE", [
|
| 314 |
-
("💬 ogolna", banner("OGOLNA ROZMOWA", "💬") + "\n📌 Rozmowy na każdy temat • Poznaj społeczność"),
|
| 315 |
-
("📸 media", banner("MEDIA I ZDJECIA", "📸") + "\n📌 Memy • Screeny • Grafiki • Filmy"),
|
| 316 |
-
("🤖 bot-cmds", banner("KOMENDY DLA BOTOW", "🤖") + "\n📌 Używaj komend • Zabawa • Narzędzia"),
|
| 317 |
-
("🗳️ ankiety", banner("ANKIETY I GLOSOWANIA", "🗳️") + "\n📌 Głosowania • Opinie • Decyzje"),
|
| 318 |
-
("💡 sugestie", banner("TWOJE POMYSLY", "💡") + "\n📌 Masz pomysł na serwer? Napisz!"),
|
| 319 |
-
]),
|
| 320 |
-
("💻 PROGRAMOWANIE", [
|
| 321 |
-
("🔰 pomoc", banner("POMOC DLA POCZATKUJACYCH", "🔰") + "\n📌 Nie bój się pytać • Każdy kiedyś zaczynał"),
|
| 322 |
-
("🆘 code-help", banner("POMOC Z KODEM", "🆘") + "\n📌 Opisz problem • Pokaż błąd • Otrzymasz pomoc"),
|
| 323 |
-
("📝 code-review", banner("CODE REVIEW", "📝") + "\n📌 Wrzuć kod • Otrzymaj feedback • Rozwijaj się"),
|
| 324 |
-
("📂 projekty", banner("PROJEKTY SPOLECZNOSCI", "📂") + "\n📌 Pokaż swój projekt • Szukaj współpracy"),
|
| 325 |
-
("💡 algorytmy", banner("ALGORYTMY I STRUKTURY", "💡") + "\n📌 Dyskusja • Optymalizacja • Rozwiązania"),
|
| 326 |
-
]),
|
| 327 |
-
("🐍 PYTHON", [
|
| 328 |
-
("🐍 python-help", banner("PYTHON HELP", "🐍") + "\n📌 Biblioteki • Błędy • Zadania • Pomoc"),
|
| 329 |
-
("📦 biblioteki", banner("BIBLIOTEKI PYTHONA", "📦") + "\n📌 Polecaj • Porównuj • Dyskutuj"),
|
| 330 |
-
("🔧 python-projekty", banner("PROJEKTY W PYTHONIE", "🔧") + "\n📌 Automatyzacja • Skrypty • Aplikacje"),
|
| 331 |
-
("📊 data-science", banner("DATA SCIENCE", "📊") + "\n📌 Pandas • NumPy • ML • Analiza"),
|
| 332 |
-
]),
|
| 333 |
-
("🌐 WEB DEV", [
|
| 334 |
-
("🌐 html-css", banner("HTML & CSS", "🌐") + "\n📌 Responsywność • Frameworki • Tailwind • Bootstrap"),
|
| 335 |
-
("⚡ javascript", banner("JAVASCRIPT / TYPESCRIPT", "⚡") + "\n📌 JS • TS • Node • Frameworki"),
|
| 336 |
-
("⚛️ react-vue", banner("REACT / VUE / SVELTE", "⚛️") + "\n📌 Komponenty • Next • Nuxt • Stan"),
|
| 337 |
-
("🖥️ backend", banner("BACKEND / API", "🖥️") + "\n📌 API • Bazy • Serwery • REST • GraphQL"),
|
| 338 |
-
]),
|
| 339 |
-
("🛠 DEV TOOLS", [
|
| 340 |
-
("🐙 git-github", banner("GIT & GITHUB", "🐙") + "\n📌 CI/CD • Workflow • Pull Requesty"),
|
| 341 |
-
("🐳 docker", banner("DOCKER & DEVOPS", "🐳") + "\n📌 Kontenery • K8s • Kompozycja"),
|
| 342 |
-
("🔒 security", banner("BEZPIECZENSTWO", "🔒") + "\n📌 OWASP • Audyt • Testy • Hacking"),
|
| 343 |
-
("☁️ cloud", banner("CLOUD COMPUTING", "☁️") + "\n📌 AWS • Azure • GCP • Hosting"),
|
| 344 |
-
]),
|
| 345 |
-
("🎮 FUN", [
|
| 346 |
-
("🎵 muzyka", banner("MUZYKA", "🎵") + "\n📌 Polecaj • Playlisty • Gatunki"),
|
| 347 |
-
("🎮 gry", banner("GRY", "🎮") + "\n📌 Dyskusja • Co grasz? • Polecajki"),
|
| 348 |
-
("🤖 ai-chat", banner("AI I CHATBOTY", "🤖") + "\n📌 ChatGPT • AI Art • Prompt Engineering"),
|
| 349 |
-
("🎨 sztuka", banner("SZTUKA I DESIGN", "🎨") + "\n📌 Grafika • Pixel Art • AI Art"),
|
| 350 |
-
]),
|
| 351 |
-
("🔊 VOICE", [
|
| 352 |
-
("🔊 Ogolny", "Rozmowy na każdy temat"),
|
| 353 |
-
("🔊 Kodowanie", "Koduj razem z innymi"),
|
| 354 |
-
("🔊 Nauka", "Nauka i pomoc"),
|
| 355 |
-
("🔊 Muzyka", "Słuchaj muzyki"),
|
| 356 |
-
("🔊 Spotkania", "Meetupy i spotkania"),
|
| 357 |
-
], {"voice": True}),
|
| 358 |
-
]
|
| 359 |
-
|
| 360 |
-
created = 0
|
| 361 |
-
for item in structure:
|
| 362 |
-
if len(item) == 3:
|
| 363 |
-
cat_name, channels, opts = item
|
| 364 |
-
if isinstance(opts, dict) and opts.get("voice"):
|
| 365 |
-
is_vc = True
|
| 366 |
-
perms = None
|
| 367 |
-
elif isinstance(opts, dict):
|
| 368 |
-
is_vc = False
|
| 369 |
-
perms = opts
|
| 370 |
-
else:
|
| 371 |
-
is_vc = False
|
| 372 |
-
perms = opts
|
| 373 |
-
else:
|
| 374 |
-
cat_name, channels = item
|
| 375 |
-
is_vc = False
|
| 376 |
-
perms = None
|
| 377 |
-
|
| 378 |
-
try:
|
| 379 |
-
category = await guild.create_category(cat_name, overwrites=perms)
|
| 380 |
-
except:
|
| 381 |
-
category = await guild.create_category(cat_name)
|
| 382 |
-
await asyncio.sleep(random.uniform(1.5, 3))
|
| 383 |
-
|
| 384 |
-
for ch_name, ch_topic in channels:
|
| 385 |
-
try:
|
| 386 |
-
if is_vc:
|
| 387 |
-
await guild.create_voice_channel(ch_name, category=category)
|
| 388 |
-
else:
|
| 389 |
-
await guild.create_text_channel(ch_name, category=category, topic=ch_topic[:1024] if ch_topic else None, slowmode_delay=2 if "pomoc" in ch_name or "help" in ch_name else 0)
|
| 390 |
-
created += 1
|
| 391 |
-
await asyncio.sleep(random.uniform(1, 2.5))
|
| 392 |
-
except:
|
| 393 |
-
pass
|
| 394 |
-
|
| 395 |
-
info_ch = discord.utils.get(guild.text_channels, name="pliki")
|
| 396 |
-
if info_ch:
|
| 397 |
-
emb = discord.Embed(title="📂 Projekty i Pliki", description="Witaj w bazie projektów!\nAdmini udostępniają tutaj swoje skrypty, konfiguracje i materiały.", color=discord.Color.blue())
|
| 398 |
-
emb.add_field(name="📁 Projekty", value="Aplikacje i strony", inline=True)
|
| 399 |
-
emb.add_field(name="📜 Skrypty", value="Automatyzacje", inline=True)
|
| 400 |
-
emb.add_field(name="📖 Materiały", value="Poradniki i notatki", inline=True)
|
| 401 |
-
await info_ch.send(embed=emb)
|
| 402 |
-
|
| 403 |
-
admin_ch = discord.utils.get(guild.text_channels, name="admin-projekty")
|
| 404 |
-
if admin_ch:
|
| 405 |
-
emb = discord.Embed(title="👑 Projekty Administracji", description="Tutaj Admini dawają swoje Projekty!\nBackupy, konfiguracje, autorskie narzędzia.", color=discord.Color.gold())
|
| 406 |
-
await admin_ch.send(embed=emb)
|
| 407 |
-
|
| 408 |
-
embed = discord.Embed(
|
| 409 |
-
title="✅ Serwer sformatowany!",
|
| 410 |
-
description=f"✦ **{len(all_roles)}** ról\n✦ **{created}** kanałów\n✦ **{len(structure)}** kategorii",
|
| 411 |
-
color=discord.Color.green()
|
| 412 |
-
)
|
| 413 |
-
embed.set_footer(text="Ustaw role i gotowe!")
|
| 414 |
-
await interaction.followup.send(embed=embed)
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
WARNS_FILE = "warns.json"
|
| 418 |
-
|
| 419 |
-
def load_warns():
|
| 420 |
-
if os.path.exists(WARNS_FILE):
|
| 421 |
-
with open(WARNS_FILE) as f:
|
| 422 |
-
return json.load(f)
|
| 423 |
-
return {}
|
| 424 |
-
|
| 425 |
-
def save_warns(data):
|
| 426 |
-
with open(WARNS_FILE, "w") as f:
|
| 427 |
-
json.dump(data, f, indent=2)
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
@bot.tree.command(name="warn", description="Ostrzega użytkownika")
|
| 431 |
-
@app_commands.describe(member="Użytkownik", reason="Powód ostrzeżenia")
|
| 432 |
-
@app_commands.default_permissions(moderate_members=True)
|
| 433 |
-
async def warn(interaction: discord.Interaction, member: discord.Member, reason: str = "Nie podano powodu"):
|
| 434 |
-
warns = load_warns()
|
| 435 |
-
uid = str(member.id)
|
| 436 |
-
if uid not in warns:
|
| 437 |
-
warns[uid] = []
|
| 438 |
-
warns[uid].append({"reason": reason, "by": interaction.user.id, "date": str(discord.utils.utcnow())})
|
| 439 |
-
save_warns(warns)
|
| 440 |
-
embed = discord.Embed(title=f"⚠️ Ostrzeżenie dla {member.display_name}", color=discord.Color.orange())
|
| 441 |
-
embed.add_field(name="Powód", value=reason, inline=False)
|
| 442 |
-
embed.add_field(name="Ostrzeżeń łącznie", value=len(warns[uid]), inline=True)
|
| 443 |
-
await interaction.response.send_message(embed=embed)
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
@bot.tree.command(name="warnings", description="Pokazuje ostrzeżenia użytkownika")
|
| 447 |
-
@app_commands.describe(member="Użytkownik")
|
| 448 |
-
@app_commands.default_permissions(moderate_members=True)
|
| 449 |
-
async def warnings(interaction: discord.Interaction, member: discord.Member):
|
| 450 |
-
warns = load_warns().get(str(member.id), [])
|
| 451 |
-
if not warns:
|
| 452 |
-
await interaction.response.send_message(f"✅ {member.mention} nie ma ostrzeżeń")
|
| 453 |
-
return
|
| 454 |
-
embed = discord.Embed(title=f"⚠️ Ostrzeżenia {member.display_name}", color=discord.Color.orange())
|
| 455 |
-
for i, w in enumerate(warns, 1):
|
| 456 |
-
embed.add_field(name=f"#{i}", value=f"Powód: {w['reason']}\nData: {w['date']}", inline=False)
|
| 457 |
-
await interaction.response.send_message(embed=embed)
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
@bot.tree.command(name="delwarn", description="Usuwa ostrzeżenie użytkownika")
|
| 461 |
-
@app_commands.describe(member="Użytkownik", number="Numer ostrzeżenia do usunięcia")
|
| 462 |
-
@app_commands.default_permissions(moderate_members=True)
|
| 463 |
-
async def delwarn(interaction: discord.Interaction, member: discord.Member, number: int):
|
| 464 |
-
warns = load_warns()
|
| 465 |
-
uid = str(member.id)
|
| 466 |
-
if uid not in warns or number < 1 or number > len(warns[uid]):
|
| 467 |
-
await interaction.response.send_message("❌ Nieprawidłowy numer ostrzeżenia")
|
| 468 |
-
return
|
| 469 |
-
warns[uid].pop(number - 1)
|
| 470 |
-
if not warns[uid]:
|
| 471 |
-
del warns[uid]
|
| 472 |
-
save_warns(warns)
|
| 473 |
-
await interaction.response.send_message(f"✅ Usunięto ostrzeżenie #{number} u {member.mention}")
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
@bot.tree.command(name="poll", description="Tworzy ankietę")
|
| 477 |
-
@app_commands.describe(question="Pytanie", option1="Opcja 1", option2="Opcja 2", option3="Opcja 3 (opcjonalnie)", option4="Opcja 4 (opcjonalnie)")
|
| 478 |
-
async def poll(interaction: discord.Interaction, question: str, option1: str, option2: str, option3: str = None, option4: str = None):
|
| 479 |
-
options = [o for o in [option1, option2, option3, option4] if o]
|
| 480 |
-
emojis = ["1️⃣", "2️⃣", "3️⃣", "4️⃣"]
|
| 481 |
-
desc = "\n".join(f"{emojis[i]} {opt}" for i, opt in enumerate(options))
|
| 482 |
-
embed = discord.Embed(title=f"📊 {question}", description=desc, color=discord.Color.blue())
|
| 483 |
-
embed.set_footer(text=f"Ankieta od {interaction.user.display_name}")
|
| 484 |
-
await interaction.response.send_message(embed=embed)
|
| 485 |
-
msg = await interaction.original_response()
|
| 486 |
-
for i in range(len(options)):
|
| 487 |
-
await msg.add_reaction(emojis[i])
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
@bot.tree.command(name="embed", description="Wysyła wiadomość embed")
|
| 491 |
-
@app_commands.describe(title="Tytuł", description="Opis", color="Kolor (hex np. #FF0000)")
|
| 492 |
-
@app_commands.default_permissions(manage_messages=True)
|
| 493 |
-
async def embed(interaction: discord.Interaction, title: str, description: str, color: str = "#3498DB"):
|
| 494 |
-
try:
|
| 495 |
-
c = discord.Color(int(color.replace("#", ""), 16))
|
| 496 |
-
except:
|
| 497 |
-
c = discord.Color.blue()
|
| 498 |
-
emb = discord.Embed(title=title, description=description, color=c)
|
| 499 |
-
await interaction.response.send_message(embed=emb)
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
@bot.tree.command(name="slowmode", description="Ustawia slowmode na kanale (sekundy)")
|
| 503 |
-
@app_commands.describe(seconds="Sekundy (0 = wyłącz)")
|
| 504 |
-
@app_commands.default_permissions(manage_channels=True)
|
| 505 |
-
async def slowmode(interaction: discord.Interaction, seconds: int):
|
| 506 |
-
await interaction.channel.edit(slowmode_delay=seconds)
|
| 507 |
-
if seconds > 0:
|
| 508 |
-
await interaction.response.send_message(f"🐌 Ustawiono slowmode na {seconds}s")
|
| 509 |
-
else:
|
| 510 |
-
await interaction.response.send_message("✅ Wyłączono slowmode")
|
| 511 |
-
|
| 512 |
-
|
| 513 |
-
@bot.tree.command(name="nick", description="Zmienia nick użytkownika")
|
| 514 |
-
@app_commands.describe(member="Użytkownik", nickname="Nowy nick (wpisz 'reset' aby przywrócić)")
|
| 515 |
-
@app_commands.default_permissions(manage_nicknames=True)
|
| 516 |
-
async def nick(interaction: discord.Interaction, member: discord.Member, nickname: str = None):
|
| 517 |
-
if nickname and nickname.lower() == "reset":
|
| 518 |
-
nickname = None
|
| 519 |
-
await member.edit(nick=nickname)
|
| 520 |
-
await interaction.response.send_message(f"✅ Zmieniono nick {member.mention}" + (f" na **{nickname}**" if nickname else " (przywrócono)"))
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
@bot.tree.command(name="role", description="Daje lub zabiera rolę")
|
| 524 |
-
@app_commands.describe(action="give lub remove", member="Użytkownik", role="Rola")
|
| 525 |
-
@app_commands.default_permissions(manage_roles=True)
|
| 526 |
-
@app_commands.choices(action=[app_commands.Choice(name="give", value="give"), app_commands.Choice(name="remove", value="remove")])
|
| 527 |
-
async def role(interaction: discord.Interaction, action: str, member: discord.Member, role: discord.Role):
|
| 528 |
-
if role >= interaction.user.top_role:
|
| 529 |
-
await interaction.response.send_message("❌ Nie możesz zarządzać tą rolą")
|
| 530 |
-
return
|
| 531 |
-
if action == "give":
|
| 532 |
-
await member.add_roles(role)
|
| 533 |
-
await interaction.response.send_message(f"✅ Nadano {role.mention} dla {member.mention}")
|
| 534 |
-
else:
|
| 535 |
-
await member.remove_roles(role)
|
| 536 |
-
await interaction.response.send_message(f"✅ Zabrano {role.mention} z {member.mention}")
|
| 537 |
-
|
| 538 |
-
|
| 539 |
-
@bot.tree.command(name="botinfo", description="Informacje o bocie")
|
| 540 |
-
async def botinfo(interaction: discord.Interaction):
|
| 541 |
-
embed = discord.Embed(title="🤖 BotDC", color=discord.Color.blue())
|
| 542 |
-
embed.add_field(name="Wersja", value="21", inline=True)
|
| 543 |
-
embed.add_field(name="Biblioteka", value="discord.py", inline=True)
|
| 544 |
-
embed.add_field(name="Prefix", value="/ (slash commands)", inline=True)
|
| 545 |
-
embed.add_field(name="Serwery", value=len(bot.guilds), inline=True)
|
| 546 |
-
embed.add_field(name="Użytkownicy", value=sum(g.member_count for g in bot.guilds), inline=True)
|
| 547 |
-
embed.add_field(name="Autor", value="Gabeczkag", inline=True)
|
| 548 |
-
await interaction.response.send_message(embed=embed)
|
| 549 |
-
|
| 550 |
-
|
| 551 |
-
@bot.tree.command(name="membercount", description="Liczba członków na serwerze")
|
| 552 |
-
async def membercount(interaction: discord.Interaction):
|
| 553 |
-
guild = interaction.guild
|
| 554 |
-
total = guild.member_count
|
| 555 |
-
humans = len([m for m in guild.members if not m.bot])
|
| 556 |
-
bots = total - humans
|
| 557 |
-
embed = discord.Embed(title=f"👥 Członkowie {guild.name}", color=discord.Color.blue())
|
| 558 |
-
embed.add_field(name="Wszyscy", value=total, inline=True)
|
| 559 |
-
embed.add_field(name="Ludzie", value=humans, inline=True)
|
| 560 |
-
embed.add_field(name="Boty", value=bots, inline=True)
|
| 561 |
-
await interaction.response.send_message(embed=embed)
|
| 562 |
-
|
| 563 |
-
|
| 564 |
-
@bot.tree.command(name="announce", description="Wysyła ogłoszenie")
|
| 565 |
-
@app_commands.describe(title="Tytuł", message="Treść", channel="Kanał (opcjonalnie)")
|
| 566 |
-
@app_commands.default_permissions(administrator=True)
|
| 567 |
-
async def announce(interaction: discord.Interaction, title: str, message: str, channel: discord.TextChannel = None):
|
| 568 |
-
channel = channel or interaction.channel
|
| 569 |
-
embed = discord.Embed(title=f"📢 {title}", description=message, color=discord.Color.gold())
|
| 570 |
-
embed.set_footer(text=f"Ogłoszenie od {interaction.user.display_name}")
|
| 571 |
-
await channel.send(embed=embed)
|
| 572 |
-
await interaction.response.send_message(f"✅ Ogłoszenie wysłane do {channel.mention}", ephemeral=True)
|
| 573 |
-
|
| 574 |
-
|
| 575 |
-
@bot.tree.command(name="8ball", description="Magiczna kula 8")
|
| 576 |
-
@app_commands.describe(question="Pytanie do kuli")
|
| 577 |
-
async def eightball(interaction: discord.Interaction, question: str):
|
| 578 |
-
answers = [
|
| 579 |
-
"Tak", "Nie", "Na pewno", "W życiu", "Zdecydowanie tak",
|
| 580 |
-
"Nie licz na to", "Zapytaj później", "Nie mogę powiedzieć",
|
| 581 |
-
"Tak, ale się zastanów", "Absolutnie nie", "Oczywiście!",
|
| 582 |
-
"To możliwe", "Wątpię", "Moim zdaniem tak", "Nie teraz",
|
| 583 |
-
]
|
| 584 |
-
embed = discord.Embed(title="🎱 Magiczna Kula 8", color=discord.Color.purple())
|
| 585 |
-
embed.add_field(name="Pytanie", value=question, inline=False)
|
| 586 |
-
embed.add_field(name="Odpowiedź", value=random.choice(answers), inline=False)
|
| 587 |
-
await interaction.response.send_message(embed=embed)
|
| 588 |
-
|
| 589 |
-
|
| 590 |
-
@bot.tree.command(name="rps", description="Kamień, papier, nożyce")
|
| 591 |
-
@app_commands.describe(choice="Twój wybór")
|
| 592 |
-
@app_commands.choices(choice=[
|
| 593 |
-
app_commands.Choice(name="Kamień 🪨", value="kamień"),
|
| 594 |
-
app_commands.Choice(name="Papier 📄", value="papier"),
|
| 595 |
-
app_commands.Choice(name="Nożyce ✂️", value="nożyce"),
|
| 596 |
-
])
|
| 597 |
-
async def rps(interaction: discord.Interaction, choice: str):
|
| 598 |
-
bot_choice = random.choice(["kamień", "papier", "nożyce"])
|
| 599 |
-
beats = {"kamień": "nożyce", "papier": "kamień", "nożyce": "papier"}
|
| 600 |
-
if choice == bot_choice:
|
| 601 |
-
result = "Remis!"
|
| 602 |
-
elif beats[choice] == bot_choice:
|
| 603 |
-
result = "Wygrałeś!"
|
| 604 |
-
else:
|
| 605 |
-
result = "Przegrałeś!"
|
| 606 |
-
await interaction.response.send_message(f"🪨📄✂️ **{result}**\nTy: {choice} | Bot: {bot_choice}")
|
| 607 |
-
|
| 608 |
-
|
| 609 |
-
JOKES = [
|
| 610 |
-
"Dlaczego programiści mylą Halloween z Bożym Narodzeniem? Bo Oct 31 = Dec 25!",
|
| 611 |
-
"Spotykają się dwa bity. Jeden mówi: 'Źle się czuję.' Drugi odpowiada: 'To idź do doktora, a nie do porte'a.'",
|
| 612 |
-
"Jak nazywa się bardzo szybki programista? Ruski haker.",
|
| 613 |
-
"Dlaczego Java nie lubi deszczu? Bo ma wyjątki.",
|
| 614 |
-
"Ilu programistów potrzeba do wymiany żarówki? Żadnego, to problem hardware'owy.",
|
| 615 |
-
"HTML to nie język programowania, to styl życia.",
|
| 616 |
-
"NULL to mój ulubiony błąd. Znaczy, że przynajmniej coś zwróciłem.",
|
| 617 |
-
"CSS to jedyny język, w którym możesz być 100% pewien, że coś jest wyśrodkowane... albo nie.",
|
| 618 |
-
]
|
| 619 |
-
|
| 620 |
-
@bot.tree.command(name="joke", description="Losowy żart")
|
| 621 |
-
async def joke(interaction: discord.Interaction):
|
| 622 |
-
await interaction.response.send_message(f"😂 {random.choice(JOKES)}")
|
| 623 |
-
|
| 624 |
-
|
| 625 |
-
@bot.tree.command(name="say", description="Bot powtarza twój tekst")
|
| 626 |
-
@app_commands.describe(text="Tekst do powtórzenia")
|
| 627 |
-
async def say(interaction: discord.Interaction, text: str):
|
| 628 |
-
await interaction.response.send_message(text)
|
| 629 |
-
|
| 630 |
-
|
| 631 |
-
@bot.tree.command(name="dm", description="Wysyła prywatną wiadomość użytkownikowi")
|
| 632 |
-
@app_commands.describe(member="Użytkownik", message="Treść wiadomości")
|
| 633 |
-
@app_commands.default_permissions(administrator=True)
|
| 634 |
-
async def dm(interaction: discord.Interaction, member: discord.Member, message: str):
|
| 635 |
-
try:
|
| 636 |
-
await member.send(message)
|
| 637 |
-
await interaction.response.send_message(f"✅ Wysłano DM do {member.mention}", ephemeral=True)
|
| 638 |
-
except:
|
| 639 |
-
await interaction.response.send_message("❌ Nie udało się wysłać DM (użytkownik ma zablokowane DM)", ephemeral=True)
|
| 640 |
-
|
| 641 |
-
|
| 642 |
-
@bot.tree.command(name="random", description="Losowa liczba z zakresu")
|
| 643 |
-
@app_commands.describe(min="Minimum (domyślnie 1)", max="Maksimum (domyślnie 100)")
|
| 644 |
-
async def random_number(interaction: discord.Interaction, min: int = 1, max: int = 100):
|
| 645 |
-
if min > max:
|
| 646 |
-
await interaction.response.send_message("❌ Minimum nie może być większe niż maksimum")
|
| 647 |
-
return
|
| 648 |
-
num = random.randint(min, max)
|
| 649 |
-
await interaction.response.send_message(f"🎲 Losowa liczba ({min}-{max}): **{num}**")
|
| 650 |
-
|
| 651 |
-
|
| 652 |
-
@bot.tree.command(name="choose", description="Wybierz z podanych opcji")
|
| 653 |
-
@app_commands.describe(options="Opcje rozdzielone przecinkami (np. pizza, sushi, kebab)")
|
| 654 |
-
async def choose(interaction: discord.Interaction, options: str):
|
| 655 |
-
items = [o.strip() for o in options.split(",") if o.strip()]
|
| 656 |
-
if len(items) < 2:
|
| 657 |
-
await interaction.response.send_message("❌ Podaj co najmniej 2 opcje rozdzielone przecinkami")
|
| 658 |
-
return
|
| 659 |
-
choice = random.choice(items)
|
| 660 |
-
await interaction.response.send_message(f"🤔 Wybieram... **{choice}**")
|
| 661 |
-
|
| 662 |
-
|
| 663 |
-
@bot.tree.command(name="reverse", description="Odwraca tekst")
|
| 664 |
-
@app_commands.describe(text="Tekst do odwrócenia")
|
| 665 |
-
async def reverse(interaction: discord.Interaction, text: str):
|
| 666 |
-
await interaction.response.send_message(text[::-1])
|
| 667 |
-
|
| 668 |
-
|
| 669 |
-
@bot.tree.command(name="emojify", description="Zamienia tekst na emoji (alfabet flagowy)")
|
| 670 |
-
@app_commands.describe(text="Tekst do zamiany")
|
| 671 |
-
async def emojify(interaction: discord.Interaction, text: str):
|
| 672 |
-
result = ""
|
| 673 |
-
for c in text.lower():
|
| 674 |
-
if "a" <= c <= "z":
|
| 675 |
-
result += chr(ord(c) - ord("a") + 0x1F1E6) + " "
|
| 676 |
-
elif "0" <= c <= "9":
|
| 677 |
-
result += c + "\uFE0F\u20E3 "
|
| 678 |
-
elif c == " ":
|
| 679 |
-
result += " "
|
| 680 |
-
else:
|
| 681 |
-
result += c + " "
|
| 682 |
-
await interaction.response.send_message(result.strip()[:2000])
|
| 683 |
-
|
| 684 |
-
|
| 685 |
-
@bot.tree.command(name="clap", description="Dodaje 👏 między wyrazy")
|
| 686 |
-
@app_commands.describe(text="Tekst")
|
| 687 |
-
async def clap(interaction: discord.Interaction, text: str):
|
| 688 |
-
await interaction.response.send_message(f"👏 {text.replace(' ', ' 👏 ')} 👏")
|
| 689 |
-
|
| 690 |
-
|
| 691 |
-
@bot.tree.command(name="mock", description="Zaśmiewaj czyjś tekst")
|
| 692 |
-
@app_commands.describe(text="Tekst do wyśmiania")
|
| 693 |
-
async def mock(interaction: discord.Interaction, text: str):
|
| 694 |
-
result = "".join(c.upper() if i % 2 == 0 else c.lower() for i, c in enumerate(text))
|
| 695 |
-
await interaction.response.send_message(result[:2000])
|
| 696 |
-
|
| 697 |
-
|
| 698 |
-
@bot.tree.command(name="vaporwave", description="Zamienia tekst na szeroki (vaporwave)")
|
| 699 |
-
@app_commands.describe(text="Tekst do zamiany")
|
| 700 |
-
async def vaporwave(interaction: discord.Interaction, text: str):
|
| 701 |
-
result = ""
|
| 702 |
-
for c in text:
|
| 703 |
-
code = ord(c)
|
| 704 |
-
if 0x21 <= code <= 0x7E:
|
| 705 |
-
result += chr(code + 0xFEE0)
|
| 706 |
-
else:
|
| 707 |
-
result += c
|
| 708 |
-
await interaction.response.send_message(result[:2000])
|
| 709 |
-
|
| 710 |
-
|
| 711 |
-
@bot.tree.command(name="spoiler", description="Każda litera jako spoiler")
|
| 712 |
-
@app_commands.describe(text="Tekst")
|
| 713 |
-
async def spoiler(interaction: discord.Interaction, text: str):
|
| 714 |
-
result = " ".join(f"||{c}||" for c in text)
|
| 715 |
-
await interaction.response.send_message(result[:2000])
|
| 716 |
-
|
| 717 |
-
|
| 718 |
-
@bot.tree.command(name="shrug", description="Wzrusza ramionami")
|
| 719 |
-
async def shrug(interaction: discord.Interaction):
|
| 720 |
-
await interaction.response.send_message(r"¯\_(ツ)_/¯")
|
| 721 |
-
|
| 722 |
-
|
| 723 |
-
@bot.tree.command(name="tableflip", description="Przewraca stół")
|
| 724 |
-
async def tableflip(interaction: discord.Interaction):
|
| 725 |
-
await interaction.response.send_message("(╯°□°)╯︵ ┻━┻")
|
| 726 |
-
|
| 727 |
-
|
| 728 |
-
@bot.tree.command(name="unflip", description="Naprawia stół")
|
| 729 |
-
async def unflip(interaction: discord.Interaction):
|
| 730 |
-
await interaction.response.send_message("┬─┬ ノ( ゜-゜ノ)")
|
| 731 |
-
|
| 732 |
-
|
| 733 |
-
@bot.tree.command(name="hug", description="Przytula użytkownika")
|
| 734 |
-
@app_commands.describe(member="Użytkownik do przytulenia")
|
| 735 |
-
async def hug(interaction: discord.Interaction, member: discord.Member):
|
| 736 |
-
gifs = [
|
| 737 |
-
"https://media.tenor.com/G0I5Fw3dF0QAAAAC/hug-cuddle.gif",
|
| 738 |
-
"https://media.tenor.com/4T9VPdN4xRkAAAAd/anime-hug.gif",
|
| 739 |
-
"https://media.tenor.com/6e8YgllC7sIAAAAd/hug.gif",
|
| 740 |
-
]
|
| 741 |
-
embed = discord.Embed(description=f"**{interaction.user.display_name}** przytula **{member.display_name}** 🤗", color=discord.Color.pink())
|
| 742 |
-
embed.set_image(url=random.choice(gifs))
|
| 743 |
-
await interaction.response.send_message(embed=embed)
|
| 744 |
-
|
| 745 |
-
|
| 746 |
-
@bot.tree.command(name="slap", description="Daje klapsa użytkownikowi")
|
| 747 |
-
@app_commands.describe(member="Użytkownik")
|
| 748 |
-
async def slap(interaction: discord.Interaction, member: discord.Member):
|
| 749 |
-
gifs = [
|
| 750 |
-
"https://media.tenor.com/j1J2LQwUs-sAAAAd/slap.gif",
|
| 751 |
-
"https://media.tenor.com/Cg1M9vFhu1AAAAAd/anime-slap.gif",
|
| 752 |
-
]
|
| 753 |
-
embed = discord.Embed(description=f"**{interaction.user.display_name}** daje klapsa **{member.display_name}** 👋", color=discord.Color.red())
|
| 754 |
-
embed.set_image(url=random.choice(gifs))
|
| 755 |
-
await interaction.response.send_message(embed=embed)
|
| 756 |
-
|
| 757 |
-
|
| 758 |
-
@bot.tree.command(name="nuke", description="Klonuje i usuwa kanał (czyści)")
|
| 759 |
-
@app_commands.default_permissions(manage_channels=True)
|
| 760 |
-
async def nuke(interaction: discord.Interaction):
|
| 761 |
-
channel = interaction.channel
|
| 762 |
-
new = await channel.clone()
|
| 763 |
-
await channel.delete()
|
| 764 |
-
await new.send(f"💣 Kanał wyczyszczony przez {interaction.user.mention}", delete_after=5)
|
| 765 |
-
|
| 766 |
-
|
| 767 |
-
@bot.tree.command(name="hide", description="Ukrywa kanał przed wszystkimi")
|
| 768 |
-
@app_commands.describe(channel="Kanał (opcjonalnie)")
|
| 769 |
-
@app_commands.default_permissions(manage_channels=True)
|
| 770 |
-
async def hide(interaction: discord.Interaction, channel: discord.TextChannel = None):
|
| 771 |
-
channel = channel or interaction.channel
|
| 772 |
-
await channel.set_permissions(interaction.guild.default_role, read_messages=False)
|
| 773 |
-
await interaction.response.send_message(f"🙈 Ukryto {channel.mention}")
|
| 774 |
-
|
| 775 |
-
|
| 776 |
-
@bot.tree.command(name="show", description="Pokazuje kanał wszystkim")
|
| 777 |
-
@app_commands.describe(channel="Kanał (opcjonalnie)")
|
| 778 |
-
@app_commands.default_permissions(manage_channels=True)
|
| 779 |
-
async def show(interaction: discord.Interaction, channel: discord.TextChannel = None):
|
| 780 |
-
channel = channel or interaction.channel
|
| 781 |
-
await channel.set_permissions(interaction.guild.default_role, read_messages=True)
|
| 782 |
-
await interaction.response.send_message(f"👀 Odkryto {channel.mention}")
|
| 783 |
-
|
| 784 |
-
|
| 785 |
-
@bot.tree.command(name="rename", description="Zmienia nazwę kanału")
|
| 786 |
-
@app_commands.describe(name="Nowa nazwa")
|
| 787 |
-
@app_commands.default_permissions(manage_channels=True)
|
| 788 |
-
async def rename(interaction: discord.Interaction, name: str):
|
| 789 |
-
await interaction.channel.edit(name=name)
|
| 790 |
-
await interaction.response.send_message(f"✅ Nazwa kanału zmieniona na **{name}**")
|
| 791 |
-
|
| 792 |
-
|
| 793 |
-
@bot.tree.command(name="roleinfo", description="Pokazuje informacje o roli")
|
| 794 |
-
@app_commands.describe(role="Rola")
|
| 795 |
-
async def roleinfo(interaction: discord.Interaction, role: discord.Role):
|
| 796 |
-
embed = discord.Embed(title=f"📋 Informacje o roli", color=role.color)
|
| 797 |
-
embed.add_field(name="Nazwa", value=role.name, inline=True)
|
| 798 |
-
embed.add_field(name="ID", value=role.id, inline=True)
|
| 799 |
-
embed.add_field(name="Kolor", value=str(role.color), inline=True)
|
| 800 |
-
embed.add_field(name="Członkowie", value=len(role.members), inline=True)
|
| 801 |
-
embed.add_field(name="Widoczna osobno", value="Tak" if role.hoist else "Nie", inline=True)
|
| 802 |
-
embed.add_field(name="Wzmiankowalna", value="Tak" if role.mentionable else "Nie", inline=True)
|
| 803 |
-
embed.add_field(name="Pozycja", value=role.position, inline=True)
|
| 804 |
-
embed.add_field(name="Utworzona", value=role.created_at.strftime("%Y-%m-%d"), inline=True)
|
| 805 |
-
await interaction.response.send_message(embed=embed)
|
| 806 |
-
|
| 807 |
-
|
| 808 |
-
@bot.tree.command(name="channelinfo", description="Pokazuje informacje o kanale")
|
| 809 |
-
@app_commands.describe(channel="Kanał (opcjonalnie)")
|
| 810 |
-
async def channelinfo(interaction: discord.Interaction, channel: discord.TextChannel = None):
|
| 811 |
-
channel = channel or interaction.channel
|
| 812 |
-
embed = discord.Embed(title=f"ℹ️ {channel.name}", color=discord.Color.blue())
|
| 813 |
-
embed.add_field(name="ID", value=channel.id, inline=True)
|
| 814 |
-
embed.add_field(name="Typ", value=str(channel.type).capitalize(), inline=True)
|
| 815 |
-
embed.add_field(name="Kategoria", value=channel.category.name if channel.category else "Brak", inline=True)
|
| 816 |
-
embed.add_field(name="Temat", value=channel.topic or "Brak", inline=False)
|
| 817 |
-
embed.add_field(name="Slowmode", value=f"{channel.slowmode_delay}s" if channel.slowmode_delay else "Wyłączony", inline=True)
|
| 818 |
-
embed.add_field(name="Utworzony", value=channel.created_at.strftime("%Y-%m-%d"), inline=True)
|
| 819 |
-
await interaction.response.send_message(embed=embed)
|
| 820 |
-
|
| 821 |
-
|
| 822 |
-
@bot.tree.command(name="servericon", description="Wyświetla ikonę serwera")
|
| 823 |
-
async def servericon(interaction: discord.Interaction):
|
| 824 |
-
guild = interaction.guild
|
| 825 |
-
if not guild.icon:
|
| 826 |
-
await interaction.response.send_message("❌ Serwer nie ma ikony")
|
| 827 |
-
return
|
| 828 |
-
embed = discord.Embed(title=f"Ikona {guild.name}", color=discord.Color.blue())
|
|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+0,0 @@
|
|
| 1 |
-
[Unit]
|
| 2 |
-
Description=BotDC Discord Bot
|
| 3 |
-
After=network.target
|
| 4 |
-
|
| 5 |
-
[Service]
|
| 6 |
-
Type=simple
|
| 7 |
-
User=ubuntu
|
| 8 |
-
WorkingDirectory=/opt/botdc
|
| 9 |
-
ExecStart=/opt/botdc/venv/bin/python /opt/botdc/bot.py
|
| 10 |
-
Restart=always
|
| 11 |
-
RestartSec=5
|
| 12 |
-
|
| 13 |
-
[Install]
|
| 14 |
-
WantedBy=multi-user.target
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deploy.bat
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
git add .
|
| 2 |
-
git commit -m "Update bot"
|
| 3 |
-
git push origin main
|
|
|
|
|
|
|
|
|
|
|
|
mainrun.py
DELETED
|
@@ -1,116 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import signal
|
| 3 |
-
import subprocess
|
| 4 |
-
import sys
|
| 5 |
-
import time
|
| 6 |
-
from datetime import datetime
|
| 7 |
-
|
| 8 |
-
BOT_DIR = os.path.expanduser("~/BotDC")
|
| 9 |
-
GIT_TIMEOUT = 30
|
| 10 |
-
BOT_TIMEOUT = 10
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
def log(msg):
|
| 14 |
-
print(f"[{datetime.now().strftime('%H:%M:%S')}] {msg}", flush=True)
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
def run(cmd, timeout=GIT_TIMEOUT, **kwargs):
|
| 18 |
-
try:
|
| 19 |
-
return subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=timeout, **kwargs)
|
| 20 |
-
except subprocess.TimeoutExpired:
|
| 21 |
-
log(f"Timeout: {cmd}")
|
| 22 |
-
return None
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
def read_local_version():
|
| 26 |
-
try:
|
| 27 |
-
with open("au.version", "r") as f:
|
| 28 |
-
return f.readline().strip()
|
| 29 |
-
except FileNotFoundError:
|
| 30 |
-
return "0"
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
def read_remote_version():
|
| 34 |
-
result = run("git show origin/main:au.version")
|
| 35 |
-
if result and result.returncode == 0:
|
| 36 |
-
lines = result.stdout.strip().splitlines()
|
| 37 |
-
return lines[0] if lines else "0"
|
| 38 |
-
return "0"
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
def ensure_bot():
|
| 42 |
-
result = run("screen -ls")
|
| 43 |
-
if result is None or result.returncode != 0 or "bot" not in result.stdout:
|
| 44 |
-
log("Bot nie dziala, uruchamiam...")
|
| 45 |
-
return subprocess.Popen(["python", "bot.py"], cwd=BOT_DIR)
|
| 46 |
-
return None
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
def main():
|
| 50 |
-
os.chdir(BOT_DIR)
|
| 51 |
-
|
| 52 |
-
bot_proc = None
|
| 53 |
-
|
| 54 |
-
def cleanup(sig=None, frame=None):
|
| 55 |
-
log("Zatrzymywanie...")
|
| 56 |
-
if bot_proc and bot_proc.poll() is None:
|
| 57 |
-
bot_proc.terminate()
|
| 58 |
-
try:
|
| 59 |
-
bot_proc.wait(timeout=BOT_TIMEOUT)
|
| 60 |
-
except subprocess.TimeoutExpired:
|
| 61 |
-
bot_proc.kill()
|
| 62 |
-
sys.exit(0)
|
| 63 |
-
|
| 64 |
-
signal.signal(signal.SIGINT, cleanup)
|
| 65 |
-
signal.signal(signal.SIGTERM, cleanup)
|
| 66 |
-
|
| 67 |
-
local_ver = read_local_version()
|
| 68 |
-
log(f"Start updatera, aktualna wersja: {local_ver}")
|
| 69 |
-
|
| 70 |
-
log("Bot uruchomiony")
|
| 71 |
-
bot_proc = subprocess.Popen(["python", "bot.py"], cwd=BOT_DIR)
|
| 72 |
-
|
| 73 |
-
while True:
|
| 74 |
-
time.sleep(30)
|
| 75 |
-
|
| 76 |
-
result = run("git fetch origin main")
|
| 77 |
-
if result is None:
|
| 78 |
-
continue
|
| 79 |
-
|
| 80 |
-
remote_ver = read_remote_version()
|
| 81 |
-
|
| 82 |
-
if remote_ver != local_ver:
|
| 83 |
-
log(f"Nowa wersja: {local_ver} -> {remote_ver}")
|
| 84 |
-
run("git pull origin main")
|
| 85 |
-
|
| 86 |
-
au_content = ""
|
| 87 |
-
try:
|
| 88 |
-
with open("au.version", "r") as f:
|
| 89 |
-
au_content = f.read()
|
| 90 |
-
except FileNotFoundError:
|
| 91 |
-
pass
|
| 92 |
-
|
| 93 |
-
if "install-packages=true" in au_content:
|
| 94 |
-
log("Instaluje pakiety...")
|
| 95 |
-
run("pip install -r requirements.txt", timeout=120)
|
| 96 |
-
|
| 97 |
-
local_ver = read_local_version()
|
| 98 |
-
log("Restartuje bota po aktualizacji...")
|
| 99 |
-
|
| 100 |
-
if bot_proc and bot_proc.poll() is None:
|
| 101 |
-
bot_proc.kill()
|
| 102 |
-
try:
|
| 103 |
-
bot_proc.wait(timeout=5)
|
| 104 |
-
except:
|
| 105 |
-
pass
|
| 106 |
-
|
| 107 |
-
bot_proc = subprocess.Popen(["python", "bot.py"], cwd=BOT_DIR)
|
| 108 |
-
|
| 109 |
-
if bot_proc.poll() is not None:
|
| 110 |
-
new_proc = ensure_bot()
|
| 111 |
-
if new_proc:
|
| 112 |
-
bot_proc = new_proc
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
if __name__ == "__main__":
|
| 116 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
oracle_setup.sh
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
#!/bin/bash
|
| 2 |
-
set -e
|
| 3 |
-
|
| 4 |
-
echo "=== Instalacja bota Discord na Oracle Cloud ==="
|
| 5 |
-
|
| 6 |
-
sudo apt update && sudo apt upgrade -y
|
| 7 |
-
sudo apt install -y python3 python3-pip python3-venv git
|
| 8 |
-
|
| 9 |
-
sudo mkdir -p /opt/botdc
|
| 10 |
-
sudo chown ubuntu:ubuntu /opt/botdc
|
| 11 |
-
|
| 12 |
-
python3 -m venv /opt/botdc/venv
|
| 13 |
-
source /opt/botdc/venv/bin/activate
|
| 14 |
-
pip install --upgrade pip
|
| 15 |
-
pip install discord.py python-dotenv
|
| 16 |
-
|
| 17 |
-
cd /opt/botdc
|
| 18 |
-
git clone https://huggingface.co/spaces/Gabeczkag/BotDC .
|
| 19 |
-
|
| 20 |
-
echo "=== Wpisz token Discorda ==="
|
| 21 |
-
read -s -p "DISCORD_TOKEN: " token
|
| 22 |
-
echo "DISCORD_TOKEN=$token" > .env
|
| 23 |
-
echo -e "\n=== Token zapisany ==="
|
| 24 |
-
|
| 25 |
-
echo -e "\n=== Testowanie bota... ==="
|
| 26 |
-
python bot.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
DELETED
|
@@ -1,4 +0,0 @@
|
|
| 1 |
-
discord.py
|
| 2 |
-
python-dotenv
|
| 3 |
-
fastapi
|
| 4 |
-
uvicorn
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
start_bot.bat
DELETED
|
@@ -1,5 +0,0 @@
|
|
| 1 |
-
@echo off
|
| 2 |
-
cd /d "%~dp0"
|
| 3 |
-
pip install -r requirements.txt >nul 2>&1
|
| 4 |
-
python bot.py
|
| 5 |
-
pause
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
termux_autoupdate.sh
DELETED
|
@@ -1,43 +0,0 @@
|
|
| 1 |
-
#!/data/data/com.termux/files/usr/bin/bash
|
| 2 |
-
cd ~/BotDC || exit 1
|
| 3 |
-
|
| 4 |
-
log() {
|
| 5 |
-
echo "[$(date '+%H:%M:%S')] $1"
|
| 6 |
-
}
|
| 7 |
-
|
| 8 |
-
LOCAL_VER=$(head -1 au.version 2>/dev/null || echo "0")
|
| 9 |
-
log "Start updatera, aktualna wersja: $LOCAL_VER"
|
| 10 |
-
|
| 11 |
-
ensure_bot() {
|
| 12 |
-
if ! screen -ls 2>/dev/null | grep -q "bot"; then
|
| 13 |
-
log "Bot nie dziala, uruchamiam..."
|
| 14 |
-
cd ~/BotDC && screen -dmS bot python bot.py
|
| 15 |
-
fi
|
| 16 |
-
}
|
| 17 |
-
log "Bot uruchomiony"
|
| 18 |
-
cd ~/BotDC && python bot.py
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
while true; do
|
| 22 |
-
sleep 30
|
| 23 |
-
|
| 24 |
-
git fetch origin main 2>/dev/null
|
| 25 |
-
REMOTE_VER=$(git show origin/main:au.version 2>/dev/null | head -1 || echo "0")
|
| 26 |
-
|
| 27 |
-
if [ "$REMOTE_VER" != "$LOCAL_VER" ]; then
|
| 28 |
-
log "Nowa wersja: $LOCAL_VER -> $REMOTE_VER"
|
| 29 |
-
git pull origin main 2>/dev/null
|
| 30 |
-
|
| 31 |
-
if grep -q "install-packages=true" au.version 2>/dev/null; then
|
| 32 |
-
log "Instaluje pakiety..."
|
| 33 |
-
pip install -r requirements.txt > /dev/null 2>&1
|
| 34 |
-
fi
|
| 35 |
-
|
| 36 |
-
LOCAL_VER=$(head -1 au.version)
|
| 37 |
-
log "Restartuje bota po aktualizacji..."
|
| 38 |
-
cd ~/BotDC && python bot.py
|
| 39 |
-
sleep 1
|
| 40 |
-
fi
|
| 41 |
-
|
| 42 |
-
ensure_bot
|
| 43 |
-
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
termux_host.sh
DELETED
|
@@ -1,18 +0,0 @@
|
|
| 1 |
-
#!/data/data/com.termux/files/usr/bin/bash
|
| 2 |
-
echo "=== Uruchamianie SSH na telefonie ==="
|
| 3 |
-
|
| 4 |
-
pkill sshd 2>/dev/null
|
| 5 |
-
sshd -p 8022
|
| 6 |
-
|
| 7 |
-
echo "Adres IP telefonu:"
|
| 8 |
-
echo "Sprawdz w: Ustawienia > Wi-Fi > Twoja siec"
|
| 9 |
-
echo ""
|
| 10 |
-
echo "Lub uzyj: hostname -I"
|
| 11 |
-
hostname -I 2>/dev/null || true
|
| 12 |
-
echo ""
|
| 13 |
-
echo "Z lapka: ssh u0_a410@<IP> -p 8022"
|
| 14 |
-
echo ""
|
| 15 |
-
echo "SSH dziala na porcie 8022"
|
| 16 |
-
echo "Ctrl+C aby zatrzymac"
|
| 17 |
-
|
| 18 |
-
while true; do sleep 10; done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
termux_setup.sh
DELETED
|
@@ -1,18 +0,0 @@
|
|
| 1 |
-
#!/bin/bash
|
| 2 |
-
echo "=== Instalacja bota na Termux ==="
|
| 3 |
-
|
| 4 |
-
pkg update -y && pkg upgrade -y
|
| 5 |
-
pkg install python git screen -y
|
| 6 |
-
|
| 7 |
-
cd ~
|
| 8 |
-
git clone https://huggingface.co/spaces/Gabeczkag/BotDC
|
| 9 |
-
cd BotDC
|
| 10 |
-
|
| 11 |
-
pip install discord.py python-dotenv
|
| 12 |
-
|
| 13 |
-
read -p "Podaj token Discorda: " token
|
| 14 |
-
echo "DISCORD_TOKEN=$token" > .env
|
| 15 |
-
|
| 16 |
-
echo "=== Gotowe! Uruchamianie bota... ==="
|
| 17 |
-
screen -dmS bot python bot.py
|
| 18 |
-
echo "Bot działa w tle. screen -r bot by wrocic"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
termux_ssh.sh
DELETED
|
@@ -1,17 +0,0 @@
|
|
| 1 |
-
#!/bin/bash
|
| 2 |
-
echo "=== Instalacja SSH na Termux ==="
|
| 3 |
-
|
| 4 |
-
pkg update -y
|
| 5 |
-
pkg install openssh -y
|
| 6 |
-
|
| 7 |
-
echo "Ustaw hasło dla Termux:"
|
| 8 |
-
passwd
|
| 9 |
-
|
| 10 |
-
# Pobierz IP
|
| 11 |
-
IP=$(ip -4 addr show wlan0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}' 2>/dev/null || echo "sprawdz recznie")
|
| 12 |
-
echo "=== SSH gotowe ==="
|
| 13 |
-
echo "IP: $IP"
|
| 14 |
-
echo "Port: 8022"
|
| 15 |
-
echo "User: $(whoami)"
|
| 16 |
-
echo ""
|
| 17 |
-
echo "Z lapka: ssh $(whoami)@$IP -p 8022"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
termux_start.sh
DELETED
|
@@ -1,6 +0,0 @@
|
|
| 1 |
-
#!/data/data/com.termux/files/usr/bin/bash
|
| 2 |
-
cd ~/BotDC
|
| 3 |
-
while true; do
|
| 4 |
-
python bot.py
|
| 5 |
-
sleep 5
|
| 6 |
-
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
termux_watch.sh
DELETED
|
@@ -1,15 +0,0 @@
|
|
| 1 |
-
#!/data/data/com.termux/files/usr/bin/bash
|
| 2 |
-
cd ~/BotDC || exit 1
|
| 3 |
-
|
| 4 |
-
LAST_MTIME=$(stat -c %Y bot.py 2>/dev/null)
|
| 5 |
-
|
| 6 |
-
while true; do
|
| 7 |
-
sleep 3
|
| 8 |
-
CURR_MTIME=$(stat -c %Y bot.py 2>/dev/null)
|
| 9 |
-
if [ "$CURR_MTIME" != "$LAST_MTIME" ]; then
|
| 10 |
-
echo "Wykryto zmiane w bot.py. Restartuje..."
|
| 11 |
-
pkill -f "python bot.py" 2>/dev/null
|
| 12 |
-
screen -dmS bot python bot.py
|
| 13 |
-
LAST_MTIME=$CURR_MTIME
|
| 14 |
-
fi
|
| 15 |
-
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|