edc-ds 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- edc_ds-1.0.0/LICENSE +21 -0
- edc_ds-1.0.0/PKG-INFO +11 -0
- edc_ds-1.0.0/README.md +0 -0
- edc_ds-1.0.0/easydc/__init__.py +11 -0
- edc_ds-1.0.0/easydc/bad_words.py +13 -0
- edc_ds-1.0.0/easydc/client.py +90 -0
- edc_ds-1.0.0/easydc/context.py +33 -0
- edc_ds-1.0.0/easydc/database.py +29 -0
- edc_ds-1.0.0/easydc/errors.py +6 -0
- edc_ds-1.0.0/easydc/features.py +77 -0
- edc_ds-1.0.0/easydc/tools.py +15 -0
- edc_ds-1.0.0/easydc/ui.py +13 -0
- edc_ds-1.0.0/edc_ds.egg-info/PKG-INFO +11 -0
- edc_ds-1.0.0/edc_ds.egg-info/SOURCES.txt +17 -0
- edc_ds-1.0.0/edc_ds.egg-info/dependency_links.txt +1 -0
- edc_ds-1.0.0/edc_ds.egg-info/requires.txt +1 -0
- edc_ds-1.0.0/edc_ds.egg-info/top_level.txt +1 -0
- edc_ds-1.0.0/setup.cfg +4 -0
- edc_ds-1.0.0/setup.py +10 -0
edc_ds-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [2026] [EasyDC]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
edc_ds-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: edc-ds
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A simplified library for creating Discord bots. (Polish Creation)
|
|
5
|
+
Author: DetektywSeba
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Dist: discord.py
|
|
8
|
+
Dynamic: author
|
|
9
|
+
Dynamic: license-file
|
|
10
|
+
Dynamic: requires-dist
|
|
11
|
+
Dynamic: summary
|
edc_ds-1.0.0/README.md
ADDED
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from .client import EasyBot
|
|
2
|
+
|
|
3
|
+
__version__ = "1.0.0"
|
|
4
|
+
__author__ = "DetektywSeba"
|
|
5
|
+
|
|
6
|
+
def create_bot(token, prefix="!"):
|
|
7
|
+
bot = EasyBot(prefix=prefix)
|
|
8
|
+
# Auto run in background
|
|
9
|
+
import threading
|
|
10
|
+
threading.Thread(target=bot.run, args=(token,), daemon=True).start()
|
|
11
|
+
return bot
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
WORDS = [
|
|
2
|
+
"burdel", "burdelmama", "chuj", "chujnia", "ciota", "cipa", "cyc",
|
|
3
|
+
"debil", "dmuchać", "do kurwy nędzy", "dupa", "dupek", "duperele",
|
|
4
|
+
"dziwka", "fiut", "gówno", "gówno prawda", "huj", "huj ci w dupę",
|
|
5
|
+
"jajco", "jajko", "ja pierdolę", "jebać", "jebany", "kurwa",
|
|
6
|
+
"kurwy", "kutafon", "kutas", "lizać pałę", "obciągać chuja",
|
|
7
|
+
"obciągać fiuta", "obciągać loda", "pieprzyć", "pierdolec",
|
|
8
|
+
"pierdolić", "pierdolnąć", "pierdolnięty", "pierdoła", "pierdzieć",
|
|
9
|
+
"pizda", "pojeb", "pojebany", "popierdolony", "robic loda",
|
|
10
|
+
"robić loda", "ruchać", "rzygać", "skurwysyn", "sraczka",
|
|
11
|
+
"srać", "suka", "syf", "wkurwiać", "zajebisty", "popierdoli", "popierdoli mnie",
|
|
12
|
+
"pojebało", "pojebało cię" "pojebało cię?"
|
|
13
|
+
]
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import discord
|
|
2
|
+
import datetime
|
|
3
|
+
import asyncio
|
|
4
|
+
from discord.ext import commands
|
|
5
|
+
from .context import EasyContext
|
|
6
|
+
from .database import EasyDatabase
|
|
7
|
+
from .features import Features
|
|
8
|
+
|
|
9
|
+
LOGO = """
|
|
10
|
+
███████╗ █████╗ ███████╗██╗ ██╗██████╗ ██████╗
|
|
11
|
+
██╔════╝██╔══██╗██╔════╝╚██╗ ██╔╝██╔══██╗██╔════╝
|
|
12
|
+
█████╗ ███████║███████╗ ╚████╔╝ ██║ ██║██║
|
|
13
|
+
██╔══╝ ██╔══██║╚════██║ ╚██╔╝ ██║ ██║██║
|
|
14
|
+
███████╗██║ ██║███████║ ██║ ██████╔╝╚██████╗
|
|
15
|
+
╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝ ╚═════╝
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
class EasyBot:
|
|
19
|
+
def __init__(self, prefix="!", intents=None):
|
|
20
|
+
self.intents = intents or discord.Intents.all()
|
|
21
|
+
self.bot = commands.Bot(command_prefix=prefix, intents=self.intents, help_command=None)
|
|
22
|
+
self.bot.event(self._on_command)
|
|
23
|
+
self.db = EasyDatabase()
|
|
24
|
+
self.features = Features(self)
|
|
25
|
+
self.bot.tree.sync()
|
|
26
|
+
|
|
27
|
+
def set_status(self, game_name):
|
|
28
|
+
async def change():
|
|
29
|
+
await self.bot.change_presence(activity=discord.Game(name=game_name))
|
|
30
|
+
asyncio.run_coroutine_threadsafe(change(), self.bot.loop)
|
|
31
|
+
|
|
32
|
+
def command(self, name):
|
|
33
|
+
def decorator(func):
|
|
34
|
+
@self.bot.command(name=name)
|
|
35
|
+
async def wrapper(ctx, *args):
|
|
36
|
+
easy_ctx = EasyContext(ctx)
|
|
37
|
+
func(easy_ctx, *args)
|
|
38
|
+
return wrapper
|
|
39
|
+
return decorator
|
|
40
|
+
|
|
41
|
+
def _log(self, type, message):
|
|
42
|
+
timestamp = datetime.datetime.now().strftime("%H:%M:%S")
|
|
43
|
+
print(f"[{timestamp}] [{type}] {message}")
|
|
44
|
+
|
|
45
|
+
async def _on_command(self, ctx):
|
|
46
|
+
self._log("CMD", f"User {ctx.author} use command !{ctx.command}")
|
|
47
|
+
|
|
48
|
+
def enable_custom_help(self):
|
|
49
|
+
@self.bot.command(name="help")
|
|
50
|
+
async def custom_help(ctx):
|
|
51
|
+
easy_ctx = EasyContext(ctx)
|
|
52
|
+
|
|
53
|
+
msg = "✨ **EasyDC Help Panel** ✨\n\n"
|
|
54
|
+
msg += "Here is a list of available commands:\n"
|
|
55
|
+
|
|
56
|
+
for command in self.bot.commands:
|
|
57
|
+
if command.name != "help":
|
|
58
|
+
msg += f"• `!{command.name}`\n"
|
|
59
|
+
|
|
60
|
+
msg += "\n*Good luck creating the bot!*"
|
|
61
|
+
easy_ctx.send(msg)
|
|
62
|
+
|
|
63
|
+
def slash(self, name, description="Brak opisu"):
|
|
64
|
+
def decorator(func):
|
|
65
|
+
@self.bot.tree.command(name=name, description=description)
|
|
66
|
+
async def wrapper(interaction: discord.Interaction, *args, **kwargs):
|
|
67
|
+
easy_ctx = EasyContext(interaction)
|
|
68
|
+
return await func(easy_ctx, *args, **kwargs)
|
|
69
|
+
return wrapper
|
|
70
|
+
return decorator
|
|
71
|
+
|
|
72
|
+
def run(self, token):
|
|
73
|
+
logo = r"""
|
|
74
|
+
███████╗ █████╗ ███████╗██╗ ██╗██████╗ ██████╗
|
|
75
|
+
██╔════╝██╔══██╗██╔════╝╚██╗ ██╔╝██╔══██╗██╔════╝
|
|
76
|
+
█████╗ ███████║███████╗ ╚████╔╝ ██║ ██║██║
|
|
77
|
+
██╔══╝ ██╔══██║╚════██║ ╚██╔╝ ██║ ██║██║
|
|
78
|
+
███████╗██║ ██║███████║ ██║ ██████╔╝╚██████╗
|
|
79
|
+
╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝ ╚═════╝
|
|
80
|
+
|
|
81
|
+
--- Version 1.0.0 | Simplified Bots ---
|
|
82
|
+
"""
|
|
83
|
+
print(logo)
|
|
84
|
+
self._log("INFO", "EasyDC library initialization...")
|
|
85
|
+
self._log("INFO", f"Bot login using a token: {token[:6]}********")
|
|
86
|
+
|
|
87
|
+
try:
|
|
88
|
+
self.bot.run(token)
|
|
89
|
+
except Exception as e:
|
|
90
|
+
self._log("ERROR", f"Failed to start the bot: {e}")
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import discord
|
|
3
|
+
|
|
4
|
+
class EasyContext:
|
|
5
|
+
def __init__(self, originial_ctx, obj):
|
|
6
|
+
self.obj = obj
|
|
7
|
+
self.is_slash = isinstance(obj, discord.Interaction)
|
|
8
|
+
self._ctx = originial_ctx
|
|
9
|
+
self.author = originial_ctx.author
|
|
10
|
+
self.channel = originial_ctx.channel
|
|
11
|
+
self.guild = originial_ctx.guild
|
|
12
|
+
|
|
13
|
+
def send(self, content):
|
|
14
|
+
if self.is_slash:
|
|
15
|
+
asyncio.run_coroutine_threadsafe(self.obj.response.send_message(content), self.obj.client.loop)
|
|
16
|
+
else:
|
|
17
|
+
asyncio.run_coroutine_threadsafe(self.obj.send(content), self.obj.bot.loop)
|
|
18
|
+
|
|
19
|
+
def send_embed(self, title, description, color=0x3498db):
|
|
20
|
+
embed = discord.Embed(title=title, description=description, color=color)
|
|
21
|
+
if self.is_slash:
|
|
22
|
+
asyncio.run_coroutine_threadsafe(self.obj.response.send_message(embed=embed), self.obj.client.loop)
|
|
23
|
+
else:
|
|
24
|
+
asyncio.run_coroutine_threadsafe(self.obj.send(embed=embed), self.obj.bot.loop)
|
|
25
|
+
|
|
26
|
+
def ban(self, member: discord.Member, reason="Brak powodu"):
|
|
27
|
+
asyncio.run_coroutine_threadsafe(member.ban(reason=reason), self._ctx.bot.loop)
|
|
28
|
+
|
|
29
|
+
def kick(self, member: discord.Member, reason="Brak powodu"):
|
|
30
|
+
asyncio.run_coroutine_threadsafe(member.kick(reason=reason), self._ctx.bot.loop)
|
|
31
|
+
|
|
32
|
+
def log(self, message):
|
|
33
|
+
print(f"[EASYDC LOG]: {message}")
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import sqlite3
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
class EasyDatabase:
|
|
5
|
+
def __init__(self, db_name="bot_data.db"):
|
|
6
|
+
self.db_name = db_name
|
|
7
|
+
self._init_db()
|
|
8
|
+
|
|
9
|
+
def _init_db(self):
|
|
10
|
+
conn = sqlite3.connect(self.db_name)
|
|
11
|
+
cursor = conn.cursor()
|
|
12
|
+
cursor.execute("CREATE TABLE IF NOT EXISTS data (key TEXT PRIMARY KEY, value TEXT)")
|
|
13
|
+
conn.commit()
|
|
14
|
+
conn.close()
|
|
15
|
+
|
|
16
|
+
def update(self, key, value):
|
|
17
|
+
conn = sqlite3.connect(self.db_name)
|
|
18
|
+
cursor = conn.cursor()
|
|
19
|
+
cursor.execute("REPLACE INTO data VALUES (?, ?)", (str(key), str(value)))
|
|
20
|
+
conn.commit()
|
|
21
|
+
conn.close()
|
|
22
|
+
|
|
23
|
+
def get(self, key, default=None):
|
|
24
|
+
conn = sqlite3.connect(self.db_name)
|
|
25
|
+
cursor = conn.cursor()
|
|
26
|
+
cursor.execute("SELECT value FROM data WHERE key = ?", (str(key),))
|
|
27
|
+
row = cursor.fetchone()
|
|
28
|
+
conn.close()
|
|
29
|
+
return row[0] if row else default
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import discord
|
|
2
|
+
import time
|
|
3
|
+
from collections import defaultdict
|
|
4
|
+
from .bad_words import WORDS
|
|
5
|
+
|
|
6
|
+
class Features:
|
|
7
|
+
def __init__(self, bot):
|
|
8
|
+
self.bot = bot
|
|
9
|
+
self._discord_bot = getattr(self.bot, 'bot', self.bot)
|
|
10
|
+
self.db = bot.db
|
|
11
|
+
|
|
12
|
+
# Anti-spam setup
|
|
13
|
+
self.antispam_enabled = False
|
|
14
|
+
self.spam_threshold = 2.0
|
|
15
|
+
self.last_msg_time = defaultdict(float)
|
|
16
|
+
self._discord_bot.add_listener(self._on_message_antispam, 'on_message')
|
|
17
|
+
|
|
18
|
+
# Censor setup
|
|
19
|
+
self.censor_enabled = False
|
|
20
|
+
self._discord_bot.add_listener(self._on_message_censor, 'on_message')
|
|
21
|
+
|
|
22
|
+
# --- ANTI-SPAM SECTION ---
|
|
23
|
+
|
|
24
|
+
def enable_antispam(self, threshold: float = 2.0):
|
|
25
|
+
self.spam_threshold = float(threshold)
|
|
26
|
+
self.antispam_enabled = True
|
|
27
|
+
if hasattr(self.bot, '_log'):
|
|
28
|
+
self.bot._log("INFO", f"Anti-spam enabled (limit: {threshold}s).")
|
|
29
|
+
|
|
30
|
+
def disable_antispam(self):
|
|
31
|
+
self.antispam_enabled = False
|
|
32
|
+
|
|
33
|
+
async def _on_message_antispam(self, message):
|
|
34
|
+
if not self.antispam_enabled or message.author.bot or message.author == self._discord_bot.user:
|
|
35
|
+
return
|
|
36
|
+
|
|
37
|
+
now = time.time()
|
|
38
|
+
user_id = message.author.id
|
|
39
|
+
|
|
40
|
+
if now - self.last_msg_time[user_id] < self.spam_threshold:
|
|
41
|
+
try:
|
|
42
|
+
await message.delete()
|
|
43
|
+
await message.channel.send(f"⚠️ {message.author.mention}, don't spam!", delete_after=5)
|
|
44
|
+
except (discord.Forbidden, discord.HTTPException):
|
|
45
|
+
pass
|
|
46
|
+
return
|
|
47
|
+
|
|
48
|
+
self.last_msg_time[user_id] = now
|
|
49
|
+
|
|
50
|
+
# --- CENSOR SECTION ---
|
|
51
|
+
|
|
52
|
+
def enable_censor(self):
|
|
53
|
+
self.censor_enabled = True
|
|
54
|
+
if hasattr(self.bot, '_log'):
|
|
55
|
+
self.bot._log("INFO", "Censorship system enabled.")
|
|
56
|
+
|
|
57
|
+
async def _on_message_censor(self, message):
|
|
58
|
+
if not self.censor_enabled or message.author.bot or message.author == self._discord_bot.user:
|
|
59
|
+
return
|
|
60
|
+
|
|
61
|
+
content = message.content.lower()
|
|
62
|
+
if any(word in content for word in WORDS):
|
|
63
|
+
try:
|
|
64
|
+
await message.delete()
|
|
65
|
+
await message.channel.send(f"🚫 {message.author.mention}, don't use that language!", delete_after=5)
|
|
66
|
+
except (discord.Forbidden, discord.HTTPException):
|
|
67
|
+
pass
|
|
68
|
+
|
|
69
|
+
# --- ECONOMY SECTION ---
|
|
70
|
+
|
|
71
|
+
def get_balance(self, user_id: int) -> int:
|
|
72
|
+
return int(self.db.get(f"bal_{user_id}", 0))
|
|
73
|
+
|
|
74
|
+
def add_money(self, user_id: int, amount: int) -> int:
|
|
75
|
+
new_balance = self.get_balance(user_id) + amount
|
|
76
|
+
self.db.update(f"bal_{user_id}", new_balance)
|
|
77
|
+
return new_balance
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import random
|
|
2
|
+
import datetime
|
|
3
|
+
|
|
4
|
+
class Tools:
|
|
5
|
+
@staticmethod
|
|
6
|
+
def get_time():
|
|
7
|
+
return datetime.datetime.now().strftime("%H:%M:%S")
|
|
8
|
+
|
|
9
|
+
@staticmethod
|
|
10
|
+
def roll_dice():
|
|
11
|
+
return random.randint(1, 6)
|
|
12
|
+
|
|
13
|
+
@staticmethod
|
|
14
|
+
def get_version():
|
|
15
|
+
return "1.0.0"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import discord
|
|
2
|
+
from discord.ui import Button, View
|
|
3
|
+
|
|
4
|
+
class EasyView(View):
|
|
5
|
+
def __init__(self):
|
|
6
|
+
super().__init__()
|
|
7
|
+
|
|
8
|
+
def add_button(self, label, callback_func, style=discord.ButtonStyle.primary):
|
|
9
|
+
button = Button(label=label, style=style)
|
|
10
|
+
async def callback(interaction):
|
|
11
|
+
await callback_func(interaction)
|
|
12
|
+
button.callback = callback
|
|
13
|
+
self.add_item(button)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: edc-ds
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A simplified library for creating Discord bots. (Polish Creation)
|
|
5
|
+
Author: DetektywSeba
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Dist: discord.py
|
|
8
|
+
Dynamic: author
|
|
9
|
+
Dynamic: license-file
|
|
10
|
+
Dynamic: requires-dist
|
|
11
|
+
Dynamic: summary
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
easydc/__init__.py
|
|
5
|
+
easydc/bad_words.py
|
|
6
|
+
easydc/client.py
|
|
7
|
+
easydc/context.py
|
|
8
|
+
easydc/database.py
|
|
9
|
+
easydc/errors.py
|
|
10
|
+
easydc/features.py
|
|
11
|
+
easydc/tools.py
|
|
12
|
+
easydc/ui.py
|
|
13
|
+
edc_ds.egg-info/PKG-INFO
|
|
14
|
+
edc_ds.egg-info/SOURCES.txt
|
|
15
|
+
edc_ds.egg-info/dependency_links.txt
|
|
16
|
+
edc_ds.egg-info/requires.txt
|
|
17
|
+
edc_ds.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
discord.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
easydc
|
edc_ds-1.0.0/setup.cfg
ADDED
edc_ds-1.0.0/setup.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="edc-ds",
|
|
5
|
+
version="1.0.0",
|
|
6
|
+
packages=find_packages(),
|
|
7
|
+
install_requires=["discord.py"],
|
|
8
|
+
description="A simplified library for creating Discord bots. (Polish Creation)",
|
|
9
|
+
author="DetektywSeba"
|
|
10
|
+
)
|