KickZero 1.1.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.
@@ -0,0 +1,232 @@
1
+ import asyncio
2
+ import aiohttp
3
+ import websockets
4
+ import json
5
+ import inspect
6
+ import colorama
7
+ from typing import Optional,Dict, Callable, Any
8
+ from colorama import Fore,Style
9
+
10
+ class Context:
11
+ def __init__(self,user,content,bot_class):
12
+ self.author = user
13
+ self.content = content
14
+ self.bot = bot_class
15
+ async def send_message(self,message):
16
+ return await self.bot.send_message(message)
17
+ async def reply(self,message):
18
+ return await self.bot.send_message(f"@{self.author} {message}")
19
+ class KickBot():
20
+ """
21
+ Args:
22
+ user_name (str) : Botun kullanıcı adı
23
+ app_key (str) : Kick'in Pusher servisi için kullandığı genel anahtar (Public Key).
24
+ cluster (str): Pusher servisinin çalıştığı bölge (Genelde 'us2').
25
+ chat_id (int): Mesajların okunacağı kanalın idsi.
26
+ bearer_token (str): Kick hesabınıza mesaj gönderme yetkisi veren özel erişim anahtarı
27
+ prefix (str): Botun komutlarını tetiklemek için kullanılan ön ek (Örn: '!', '.', '/').
28
+ Varsayılan değer: '!'
29
+ live_chat (Boolean) : Terminalde yazılan mesajları göstetir
30
+ Varsayılan değeri: True
31
+ """
32
+ user_name: str = None
33
+ app_key: str = None
34
+ cluster: Optional[str] = "us2"
35
+ chat_id: int = None
36
+ bearer_token: str = None
37
+ prefix: Optional[str] = "!"
38
+ live_chat: Optional[bool] = True
39
+ commands: Dict[str, Callable] = {}
40
+ on_message_func: Optional[Callable] = None
41
+ on_ready_func: Optional[Callable] = None
42
+
43
+ def __init__(self,user_name:str,app_key:str,cluster:str,chat_id:int,bearer_token:str,prefix:str,live_chat:bool):
44
+ KickBot.user_name = user_name.lower()
45
+ KickBot.app_key = app_key
46
+ KickBot.cluster = cluster
47
+ KickBot.chat_id = chat_id
48
+ KickBot.bearer_token = bearer_token if bearer_token.startswith("Bearer ") else f"Bearer {bearer_token}"
49
+ KickBot.prefix = prefix
50
+ KickBot.live_chat = live_chat
51
+ @classmethod
52
+ def message(cls,content:str,exact: bool = True,lower: bool = True):
53
+ """
54
+ Args:
55
+ content (str) : Gelen mesajın içeriği
56
+ exact (boolean) : Gelen mesajın kesinliği | Eğer true ise mesaj birebir eşitmi diye bakar, Eğer false ise mesaj o stringi içeriyormu diye bakar.
57
+ lower (boolean) : Mesajın harflerinin büyklüğüne bakmadan fonksiyonu tetikler | Eğer true ise : (sa Sa sA ve SA) aynı fonkisyonu çağırır ama false ilse hepsi ayrı fonksiyonlar tarafından çağrılabilir.
58
+ """
59
+ def decorator(fx: Callable[..., Any]) -> Callable[..., Any]:
60
+ if not hasattr(cls,'message_responses'):
61
+ cls.message_responses = {}
62
+ cls.message_responses[content] = {
63
+ "func":fx,
64
+ "exact":exact,
65
+ "lower":lower
66
+ }
67
+ return fx
68
+ return decorator
69
+ @classmethod
70
+ def command(cls, name=None):
71
+ """
72
+ Args:
73
+ name (str) : Komutun adı
74
+ """
75
+ def decorator(func):
76
+ cmd_name = name if name else func.__name__
77
+ cls.commands[cmd_name] = func
78
+ return func
79
+ return decorator
80
+ @classmethod
81
+ def on_message(cls):
82
+ def decorator(func):
83
+ cls.on_message_func = func
84
+ return func
85
+ return decorator
86
+ @classmethod
87
+ def on_ready(cls):
88
+ def decorator(func):
89
+ cls.on_ready_func = func
90
+ return func
91
+ return decorator
92
+ #### Luffffy Sempaiii
93
+ @classmethod
94
+ def timer_task(cls, hours: int = 0, minutes: int = 0, seconds: int = 0):
95
+ """
96
+ Belirli zaman aralıklarıyla bir fonksiyonu (görevi) çalıştırır.
97
+ """
98
+ def decorator(fx: Callable[..., Any]) -> Callable[..., Any]:
99
+ if not hasattr(cls, 'timer_tasks'):
100
+ cls.timer_tasks = []
101
+
102
+ total_time = (hours * 3600) + (minutes * 60) + seconds
103
+
104
+ if total_time <= 0:
105
+ print(f"{Fore.YELLOW}⚠️ Uyarı: {fx.__name__} süresi 0 olduğu için başlatılmadı.")
106
+ return fx
107
+
108
+ cls.timer_tasks.append({
109
+ "func": fx,
110
+ "interval": total_time
111
+ })
112
+ return fx
113
+ return decorator
114
+ @staticmethod
115
+ async def send_message(ctx:str):
116
+ url = f"https://kick.com/api/v2/messages/send/{KickBot.chat_id}"
117
+ headers = {
118
+ "Authorization": KickBot.bearer_token,
119
+ "Content-Type": "application/json; charset=utf-8", # UTF-8 olduğunu belirttik
120
+ "Accept": "application/json",
121
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36"
122
+ }
123
+ payload = {
124
+ "content": str(ctx),
125
+ "type": "message"
126
+ }
127
+ try:
128
+ async with aiohttp.ClientSession() as session:
129
+ async with session.post(url, json=payload, headers=headers, timeout=10) as response:
130
+ status_code = response.status
131
+ try:
132
+ response_json = await response.json()
133
+ response_text = response_json.get("message", "Bilinmeyen Hata")
134
+ except:
135
+ response_text = await response.text()
136
+ if status_code in [200, 201]:
137
+ return 0
138
+ else:
139
+ caller = inspect.stack()[1]
140
+ print(f'{Fore.RED}❌ Mesaj gönderilemedi!')
141
+ print(f'Satır: {caller.lineno} | Fonksiyon: {caller.function} ')
142
+ print(f'Hata kodu: {status_code} | Yanıt: {response_text} \n')
143
+ if "User is not authenticated" in str(response_text):
144
+ print('HATA: Bearer token geçersiz veya süresi dolmuş!')
145
+ return 1
146
+ except Exception as e:
147
+ print(f'API Hatası: {e}')
148
+ return 1
149
+ ## Task Manager
150
+ async def _run_timer_task(self, task):
151
+ while True:
152
+ await asyncio.sleep(task["interval"])
153
+
154
+ # Yapay bir Context oluşturuyoruz (Fonksiyonun mesaj atabilmesi için)
155
+ fake_ctx = Context(user="Sistem", content="Zamanlayıcı", bot_class=self)
156
+
157
+ sig = inspect.signature(task["func"])
158
+ if len(sig.parameters) == 1:
159
+ await task["func"](fake_ctx) # Fonksiyon ctx.send_message kullanabilir
160
+ else:
161
+ await task["func"]()
162
+ @staticmethod
163
+ async def start():
164
+ uri = f"wss://ws-{KickBot.cluster}.pusher.com/app/{KickBot.app_key}?protocol=7&client=js&version=7.6.0&flash=false"
165
+ colorama.init(autoreset=True)
166
+ print(f"{Fore.CYAN}{Style.BRIGHT}⚔️ KickZero Framework Başlatılıyor...")
167
+ print(f"{Fore.YELLOW}Prefix: {KickBot.prefix} | Canlı Sohbet: {KickBot.live_chat}")
168
+ while True:
169
+ try:
170
+ async with websockets.connect(uri,ping_interval=20,ping_timeout=20) as ws:
171
+ # Sup To CH
172
+ await ws.send(json.dumps({
173
+ "event": "pusher:subscribe",
174
+ "data": {"channel": f"chatrooms.{KickBot.chat_id}.v2"}
175
+ }))
176
+ if KickBot.on_ready_func:
177
+ asyncio.create_task(KickBot.on_ready_func())
178
+ else:
179
+ print(f"{Fore.GREEN}Bot {Fore.BLACK}{KickBot.user_name}{Fore.GREEN} adıyla giriş yaptı ve prefixi {KickBot.prefix}")
180
+ if hasattr(KickBot, 'timer_tasks'):
181
+ bot_instance = KickBot(KickBot.user_name, KickBot.app_key, KickBot.cluster,KickBot.chat_id, KickBot.bearer_token, KickBot.prefix, KickBot.live_chat)
182
+ for task in KickBot.timer_tasks:
183
+ asyncio.create_task(bot_instance._run_timer_task(task))
184
+ while True:
185
+ raw_data = await ws.recv()
186
+ msg = json.loads(raw_data)
187
+ if msg.get("event") == "App\\Events\\ChatMessageEvent":
188
+ inner_data = json.loads(msg["data"])
189
+ user = inner_data['sender']['username']
190
+ content = inner_data['content']
191
+ if user.lower() == KickBot.user_name:
192
+ print(f"Bot: {content}")
193
+ continue
194
+ ctx = Context(user, content, KickBot)
195
+ if KickBot.live_chat:
196
+ print(f'{Fore.CYAN}💬 [{ctx.author}] : {ctx.content}')
197
+ if KickBot.on_message_func:
198
+ await KickBot.on_message_func(ctx)
199
+ if hasattr(KickBot, 'message_responses'):
200
+ for trigger, data in KickBot.message_responses.items():
201
+ check_content = content.lower() if data.get("lower", True) else content
202
+ check_trigger = trigger.lower() if data.get("lower", True) else trigger
203
+ args = []
204
+ is_triggered = False
205
+ if data["exact"]:
206
+ if check_content == check_trigger:
207
+ is_triggered = True
208
+ else:
209
+ if check_trigger in check_content:
210
+ parts = check_content.split(check_trigger, 1)
211
+ args = parts[1].strip().split() if len(parts) > 1 else []
212
+ is_triggered = True
213
+ if is_triggered:
214
+ sig = inspect.signature(data["func"])
215
+ params_count = len(sig.parameters)
216
+ if params_count == 2:
217
+ await data["func"](ctx, args)
218
+ else:
219
+ await data["func"](ctx)
220
+ if data["exact"]: break # Tam eşleşmede döngüyü kır
221
+ if content.startswith(KickBot.prefix):
222
+ parts = content[len(KickBot.prefix):].split()
223
+ if parts:
224
+ cmd_name = parts[0].lower()
225
+ args = parts[1:]
226
+ if cmd_name in KickBot.commands:
227
+ await KickBot.commands[cmd_name](ctx,args)
228
+ elif msg.get("event") == "pusher:ping":
229
+ await ws.send(json.dumps({"event":"pusher:pong"}))
230
+ except Exception as e:
231
+ print(f"{Fore.RED}Hata {e} 5 saniye sonra tekrar denenicek")
232
+ await asyncio.sleep(5)
@@ -0,0 +1,70 @@
1
+ Metadata-Version: 2.4
2
+ Name: KickZero
3
+ Version: 1.1.0
4
+ Summary: Kick.com için gelişmiş ve kolay kullanımlı bot framework'ü
5
+ Home-page: https://github.com/SeymenSozen/KickZero
6
+ Author: Seymen Sözen
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.8
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: aiohttp
14
+ Requires-Dist: websockets
15
+ Requires-Dist: colorama
16
+ Dynamic: author
17
+ Dynamic: classifier
18
+ Dynamic: description
19
+ Dynamic: description-content-type
20
+ Dynamic: home-page
21
+ Dynamic: license-file
22
+ Dynamic: requires-dist
23
+ Dynamic: requires-python
24
+ Dynamic: summary
25
+
26
+ # ⚔️ KickZero Framework
27
+
28
+ Kick.com platformu için geliştirilmiş, yüksek performanslı, asenkron ve **Context** tabanlı modern bir bot framework'ü.
29
+
30
+ ## ✨ Öne Çıkan Özellikler
31
+
32
+ * 🚀 **Tamamen Asenkron:** `aiohttp` ve `websockets` tabanlı motoruyla takılmadan çalışır.
33
+ * 🧠 **Context Yapısı:** `ctx.reply()` ve `ctx.author` gibi kolaylıklarla kod yazımını hızlandırır.
34
+ * 🔍 **Gelişmiş Debug:** Mesaj gönderim hatalarını dosyadaki satır numarasına kadar raporlar.
35
+ * 🛡️ **Spam Koruması:** Botun kendi mesajlarına cevap vererek sonsuz döngüye girmesini engeller.
36
+
37
+ ## 🛠️ Kurulum
38
+
39
+ Projenizi bilgisayarınıza çekin:
40
+ ```bash
41
+ git clone [https://github.com/KULLANICI_ADIN/KickZero.git](https://github.com/KULLANICI_ADIN/KickZero.git)
42
+ cd KickZero
43
+ pip install -r requirements.txt
44
+
45
+ 📖 Örnek Kullanım
46
+ import asyncio
47
+ from KickZero import KickBot
48
+
49
+ # Botu başlat
50
+ bot = KickBot(
51
+ user_name="BotAdınız",
52
+ app_key="KICK_APP_KEY",
53
+ chat_id="CHAT_ID",
54
+ bearer_token="BEARER_TOKEN"
55
+ )
56
+
57
+ @bot.command(name="ping")
58
+ async def ping_komutu(ctx, args):
59
+ await ctx.reply("Pong! Zoro asenkron nöbette! ⚔️")
60
+
61
+ @bot.on_message()
62
+ async def mesaj_takibi(ctx):
63
+ # Gelen her mesajı konsola yazdırır
64
+ print(f"💬 [{ctx.author}]: {ctx.content}")
65
+
66
+ if __name__ == "__main__":
67
+ asyncio.run(bot.start())
68
+
69
+ ## 🤝 Katkıda Bulunma (Contributing)
70
+ Bu proje geliştirmeye açıktır ancak büyük değişiklikler veya yeni özellikler eklemek isterseniz lütfen önce bir **Issue** açın veya benimle iletişime geçin. İzin alınmadan yapılan büyük değişikliklerin ana projeye dahil edilmesi garanti edilmez.
@@ -0,0 +1,9 @@
1
+ LICENSE
2
+ README.md
3
+ setup.py
4
+ KickZero/__init__.py
5
+ KickZero.egg-info/PKG-INFO
6
+ KickZero.egg-info/SOURCES.txt
7
+ KickZero.egg-info/dependency_links.txt
8
+ KickZero.egg-info/requires.txt
9
+ KickZero.egg-info/top_level.txt
@@ -0,0 +1,3 @@
1
+ aiohttp
2
+ websockets
3
+ colorama
@@ -0,0 +1 @@
1
+ KickZero
kickzero-1.1.0/LICENSE ADDED
@@ -0,0 +1,12 @@
1
+ KICKZERO ÖZEL LİSANSI
2
+
3
+ Copyright (c) 2026 [Seymen Sözen]
4
+
5
+ Bu yazılımın kodları kişisel kullanım ve eğitim amaçlı olarak serbestçe incelenebilir ve kullanılabilir.
6
+
7
+ Ancak;
8
+ 1. Projenin ana kod yapısında yapılacak köklü değişiklikler ve geliştirmeler için geliştiriciden (telif hakkı sahibi) önceden yazılı izin alınmalıdır.
9
+ 2. Yazılımın ticari bir üründe kullanılması yasaktır.
10
+ 3. Bu lisans metni, yazılımın tüm kopyalarında korunmalıdır.
11
+
12
+ İletişim için GitHub üzerinden Issue açabilirsiniz.
@@ -0,0 +1,70 @@
1
+ Metadata-Version: 2.4
2
+ Name: KickZero
3
+ Version: 1.1.0
4
+ Summary: Kick.com için gelişmiş ve kolay kullanımlı bot framework'ü
5
+ Home-page: https://github.com/SeymenSozen/KickZero
6
+ Author: Seymen Sözen
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.8
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: aiohttp
14
+ Requires-Dist: websockets
15
+ Requires-Dist: colorama
16
+ Dynamic: author
17
+ Dynamic: classifier
18
+ Dynamic: description
19
+ Dynamic: description-content-type
20
+ Dynamic: home-page
21
+ Dynamic: license-file
22
+ Dynamic: requires-dist
23
+ Dynamic: requires-python
24
+ Dynamic: summary
25
+
26
+ # ⚔️ KickZero Framework
27
+
28
+ Kick.com platformu için geliştirilmiş, yüksek performanslı, asenkron ve **Context** tabanlı modern bir bot framework'ü.
29
+
30
+ ## ✨ Öne Çıkan Özellikler
31
+
32
+ * 🚀 **Tamamen Asenkron:** `aiohttp` ve `websockets` tabanlı motoruyla takılmadan çalışır.
33
+ * 🧠 **Context Yapısı:** `ctx.reply()` ve `ctx.author` gibi kolaylıklarla kod yazımını hızlandırır.
34
+ * 🔍 **Gelişmiş Debug:** Mesaj gönderim hatalarını dosyadaki satır numarasına kadar raporlar.
35
+ * 🛡️ **Spam Koruması:** Botun kendi mesajlarına cevap vererek sonsuz döngüye girmesini engeller.
36
+
37
+ ## 🛠️ Kurulum
38
+
39
+ Projenizi bilgisayarınıza çekin:
40
+ ```bash
41
+ git clone [https://github.com/KULLANICI_ADIN/KickZero.git](https://github.com/KULLANICI_ADIN/KickZero.git)
42
+ cd KickZero
43
+ pip install -r requirements.txt
44
+
45
+ 📖 Örnek Kullanım
46
+ import asyncio
47
+ from KickZero import KickBot
48
+
49
+ # Botu başlat
50
+ bot = KickBot(
51
+ user_name="BotAdınız",
52
+ app_key="KICK_APP_KEY",
53
+ chat_id="CHAT_ID",
54
+ bearer_token="BEARER_TOKEN"
55
+ )
56
+
57
+ @bot.command(name="ping")
58
+ async def ping_komutu(ctx, args):
59
+ await ctx.reply("Pong! Zoro asenkron nöbette! ⚔️")
60
+
61
+ @bot.on_message()
62
+ async def mesaj_takibi(ctx):
63
+ # Gelen her mesajı konsola yazdırır
64
+ print(f"💬 [{ctx.author}]: {ctx.content}")
65
+
66
+ if __name__ == "__main__":
67
+ asyncio.run(bot.start())
68
+
69
+ ## 🤝 Katkıda Bulunma (Contributing)
70
+ Bu proje geliştirmeye açıktır ancak büyük değişiklikler veya yeni özellikler eklemek isterseniz lütfen önce bir **Issue** açın veya benimle iletişime geçin. İzin alınmadan yapılan büyük değişikliklerin ana projeye dahil edilmesi garanti edilmez.
@@ -0,0 +1,45 @@
1
+ # ⚔️ KickZero Framework
2
+
3
+ Kick.com platformu için geliştirilmiş, yüksek performanslı, asenkron ve **Context** tabanlı modern bir bot framework'ü.
4
+
5
+ ## ✨ Öne Çıkan Özellikler
6
+
7
+ * 🚀 **Tamamen Asenkron:** `aiohttp` ve `websockets` tabanlı motoruyla takılmadan çalışır.
8
+ * 🧠 **Context Yapısı:** `ctx.reply()` ve `ctx.author` gibi kolaylıklarla kod yazımını hızlandırır.
9
+ * 🔍 **Gelişmiş Debug:** Mesaj gönderim hatalarını dosyadaki satır numarasına kadar raporlar.
10
+ * 🛡️ **Spam Koruması:** Botun kendi mesajlarına cevap vererek sonsuz döngüye girmesini engeller.
11
+
12
+ ## 🛠️ Kurulum
13
+
14
+ Projenizi bilgisayarınıza çekin:
15
+ ```bash
16
+ git clone [https://github.com/KULLANICI_ADIN/KickZero.git](https://github.com/KULLANICI_ADIN/KickZero.git)
17
+ cd KickZero
18
+ pip install -r requirements.txt
19
+
20
+ 📖 Örnek Kullanım
21
+ import asyncio
22
+ from KickZero import KickBot
23
+
24
+ # Botu başlat
25
+ bot = KickBot(
26
+ user_name="BotAdınız",
27
+ app_key="KICK_APP_KEY",
28
+ chat_id="CHAT_ID",
29
+ bearer_token="BEARER_TOKEN"
30
+ )
31
+
32
+ @bot.command(name="ping")
33
+ async def ping_komutu(ctx, args):
34
+ await ctx.reply("Pong! Zoro asenkron nöbette! ⚔️")
35
+
36
+ @bot.on_message()
37
+ async def mesaj_takibi(ctx):
38
+ # Gelen her mesajı konsola yazdırır
39
+ print(f"💬 [{ctx.author}]: {ctx.content}")
40
+
41
+ if __name__ == "__main__":
42
+ asyncio.run(bot.start())
43
+
44
+ ## 🤝 Katkıda Bulunma (Contributing)
45
+ Bu proje geliştirmeye açıktır ancak büyük değişiklikler veya yeni özellikler eklemek isterseniz lütfen önce bir **Issue** açın veya benimle iletişime geçin. İzin alınmadan yapılan büyük değişikliklerin ana projeye dahil edilmesi garanti edilmez.
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,23 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name="KickZero",
5
+ version="1.1.0",
6
+ author="Seymen Sözen",
7
+ description="Kick.com için gelişmiş ve kolay kullanımlı bot framework'ü",
8
+ long_description=open("README.md", encoding="utf-8").read(), # Buraya encoding="utf-8" ekledik
9
+ long_description_content_type="text/markdown",
10
+ url="https://github.com/SeymenSozen/KickZero",
11
+ packages=find_packages(),
12
+ install_requires=[
13
+ "aiohttp",
14
+ "websockets",
15
+ "colorama",
16
+ ],
17
+ classifiers=[
18
+ "Programming Language :: Python :: 3",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Operating System :: OS Independent",
21
+ ],
22
+ python_requires='>=3.8',
23
+ )