jubbio 0.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.
Files changed (64) hide show
  1. jubbio-0.1.0/LICENSE +21 -0
  2. jubbio-0.1.0/PKG-INFO +92 -0
  3. jubbio-0.1.0/README.md +76 -0
  4. jubbio-0.1.0/jubbio/__init__.py +133 -0
  5. jubbio-0.1.0/jubbio/__init__.pyi +109 -0
  6. jubbio-0.1.0/jubbio/builders/__init__.py +21 -0
  7. jubbio-0.1.0/jubbio/builders/command.py +175 -0
  8. jubbio-0.1.0/jubbio/builders/components.py +279 -0
  9. jubbio-0.1.0/jubbio/builders/embed.py +282 -0
  10. jubbio-0.1.0/jubbio/builders/modal.py +116 -0
  11. jubbio-0.1.0/jubbio/core/__init__.py +77 -0
  12. jubbio-0.1.0/jubbio/core/bot.py +623 -0
  13. jubbio-0.1.0/jubbio/core/cache.py +353 -0
  14. jubbio-0.1.0/jubbio/core/checks.py +306 -0
  15. jubbio-0.1.0/jubbio/core/client.py +471 -0
  16. jubbio-0.1.0/jubbio/core/commands.py +634 -0
  17. jubbio-0.1.0/jubbio/core/converters.py +251 -0
  18. jubbio-0.1.0/jubbio/core/cooldowns.py +185 -0
  19. jubbio-0.1.0/jubbio/core/plugin.py +287 -0
  20. jubbio-0.1.0/jubbio/enums.py +209 -0
  21. jubbio-0.1.0/jubbio/exceptions.py +238 -0
  22. jubbio-0.1.0/jubbio/gateway/__init__.py +10 -0
  23. jubbio-0.1.0/jubbio/gateway/dispatcher.py +75 -0
  24. jubbio-0.1.0/jubbio/gateway/shard.py +248 -0
  25. jubbio-0.1.0/jubbio/models/__init__.py +48 -0
  26. jubbio-0.1.0/jubbio/models/base.py +37 -0
  27. jubbio-0.1.0/jubbio/models/channel.py +233 -0
  28. jubbio-0.1.0/jubbio/models/context.py +239 -0
  29. jubbio-0.1.0/jubbio/models/file.py +118 -0
  30. jubbio-0.1.0/jubbio/models/guild.py +275 -0
  31. jubbio-0.1.0/jubbio/models/interaction.py +691 -0
  32. jubbio-0.1.0/jubbio/models/invite.py +47 -0
  33. jubbio-0.1.0/jubbio/models/member.py +199 -0
  34. jubbio-0.1.0/jubbio/models/message.py +273 -0
  35. jubbio-0.1.0/jubbio/models/role.py +70 -0
  36. jubbio-0.1.0/jubbio/models/user.py +121 -0
  37. jubbio-0.1.0/jubbio/models/webhook.py +48 -0
  38. jubbio-0.1.0/jubbio/permissions.py +172 -0
  39. jubbio-0.1.0/jubbio/py.typed +1 -0
  40. jubbio-0.1.0/jubbio/rest/__init__.py +8 -0
  41. jubbio-0.1.0/jubbio/rest/endpoints.py +314 -0
  42. jubbio-0.1.0/jubbio/rest/http.py +926 -0
  43. jubbio-0.1.0/jubbio/tasks/__init__.py +12 -0
  44. jubbio-0.1.0/jubbio/tasks/loop.py +372 -0
  45. jubbio-0.1.0/jubbio/ui/__init__.py +25 -0
  46. jubbio-0.1.0/jubbio/ui/paginator.py +183 -0
  47. jubbio-0.1.0/jubbio/ui/view.py +362 -0
  48. jubbio-0.1.0/jubbio/utils/__init__.py +15 -0
  49. jubbio-0.1.0/jubbio/utils/color.py +139 -0
  50. jubbio-0.1.0/jubbio/utils/loop.py +20 -0
  51. jubbio-0.1.0/jubbio/utils/mentions.py +54 -0
  52. jubbio-0.1.0/jubbio/utils/snowflake.py +18 -0
  53. jubbio-0.1.0/jubbio.egg-info/PKG-INFO +92 -0
  54. jubbio-0.1.0/jubbio.egg-info/SOURCES.txt +62 -0
  55. jubbio-0.1.0/jubbio.egg-info/dependency_links.txt +1 -0
  56. jubbio-0.1.0/jubbio.egg-info/requires.txt +4 -0
  57. jubbio-0.1.0/jubbio.egg-info/top_level.txt +1 -0
  58. jubbio-0.1.0/pyproject.toml +28 -0
  59. jubbio-0.1.0/setup.cfg +4 -0
  60. jubbio-0.1.0/tests/test_builders.py +94 -0
  61. jubbio-0.1.0/tests/test_mentions.py +30 -0
  62. jubbio-0.1.0/tests/test_models.py +59 -0
  63. jubbio-0.1.0/tests/test_prefix.py +55 -0
  64. jubbio-0.1.0/tests/test_rest.py +40 -0
jubbio-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jubbio
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.
jubbio-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,92 @@
1
+ Metadata-Version: 2.4
2
+ Name: jubbio
3
+ Version: 0.1.0
4
+ Summary: Modern, asenkron ve güçlü Jubbio Python SDK kütüphanesi.
5
+ Author-email: Jubbio Developers <info@jubbio.com>
6
+ License-Expression: MIT
7
+ Keywords: jubbio,bot,sdk,api,asyncio,chat
8
+ Requires-Python: >=3.10
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: aiohttp>=3.9.0
12
+ Requires-Dist: websockets>=12.0
13
+ Requires-Dist: pydantic>=2.0.0
14
+ Requires-Dist: python-dotenv>=1.0.0
15
+ Dynamic: license-file
16
+
17
+ # JubbioPY (Jubbio Python SDK & Prefix Bot) 🚀
18
+
19
+ Modern, tam asenkron, zengin özellikli ve modüler **Jubbio Python SDK** kütüphanesi ve içerisinde gelen hazır **Prefix Komutlu Jubbio Botu**.
20
+
21
+ [![Python Version](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://python.org)
22
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
23
+
24
+ ---
25
+
26
+ ## 🌟 Bot Komutları ve Özellikleri (Prefix: `!`)
27
+
28
+ ### 🛡️ Moderasyon Komutları
29
+ * `!yasakla @kullanıcı [sebep]` (veya `!ban`): Kullanıcıyı sunucudan yasaklar.
30
+ * `!at @kullanıcı [sebep]` (veya `!kick`): Kullanıcıyı sunucudan atar.
31
+ * `!sustur @kullanıcı [dakika] [sebep]` (veya `!mute`): Kullanıcıyı belirlenen dakika kadar susturur.
32
+ * `!susturma-ac @kullanıcı` (veya `!unmute`): Kullanıcının susturmasını kaldırır.
33
+ * `!sil [adet]` (veya `!temizle`): Kanaldaki son mesajları toplu temizler.
34
+ * `!rolver @kullanıcı @rol`: Kullanıcıya rol atar.
35
+ * `!rolal @kullanıcı @rol`: Kullanıcıdan rol kaldırır.
36
+
37
+ ### ℹ️ Bilgi & Profil
38
+ * `!ping`: Botun gecikme süresi ve bağlantı durumunu gösterir.
39
+ * `!yardim` (veya `!help`, `!komutlar`): Şık komut listesi rehberi.
40
+ * `!sunucu`: Sunucu istatistikleri ve bilgileri.
41
+ * `!kullanici [@kullanıcı]`: Kullanıcı profil kartı.
42
+ * `!avatar [@kullanıcı]` (veya `!pp`): Kullanıcının profil fotoğrafını büyük boyutta gösterir.
43
+ * `!hakkinda`: JubbioPY kütüphane bilgisi.
44
+
45
+ ### ✨ İnteraktif Bileşenler (Butonlar & Modallar)
46
+ * `!oylama <soru>`: Canlı Evet 👍 / Hayır 👎 / Kararsızım 🤔 butonlarıyla interaktif oylama başlatır.
47
+ * `!rol-menusu`: Kullanıcıların açılır menüden (SelectMenu) rol seçebileceği panel gönderir.
48
+ * `!destek`: Butonlu destek paneli gönderir (Tıklayınca açılır Form Modalı açılır).
49
+
50
+ ### 🎮 Eğlence & Şans
51
+ * `!zar [yüzey]`: Zar atar (Örn: `!zar 20`).
52
+ * `!yazitura`: Madeni para atar.
53
+ * `!sec <seçenek 1, seçenek 2, ...>`: Seçenekler arasından rastgele birini seçer (Örn: `!sec pizza, burger, döner`).
54
+ * `!echo <mesaj>`: Bot üzerinden mesaj gönderir.
55
+
56
+ ---
57
+
58
+ ## 🚀 Botu Başlatma
59
+
60
+ ### 1. Bot Klasörüne Geçin ve Sanal Ortamı Aktif Edin:
61
+
62
+ ```bash
63
+ cd bot
64
+ source .venv/bin/activate
65
+ ```
66
+
67
+ ---
68
+
69
+ ### 2. Tokeninizi Tanımlayın:
70
+
71
+ `bot/.env` dosyasını açıp tokeninizi yazın:
72
+ ```env
73
+ JUBBIO_BOT_TOKEN=buraya_jubbio_bot_tokeninizi_yazın
74
+ BOT_PREFIX=!
75
+ EMBED_COLOR=blurple
76
+ ```
77
+
78
+ ---
79
+
80
+ ### 3. Botu Çalıştırın:
81
+
82
+ ```bash
83
+ python main.py
84
+ ```
85
+
86
+ ---
87
+
88
+ ## 🧪 SDK Testlerini Çalıştırma
89
+
90
+ ```bash
91
+ bot/.venv/bin/python -m unittest discover tests
92
+ ```
jubbio-0.1.0/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # JubbioPY (Jubbio Python SDK & Prefix Bot) 🚀
2
+
3
+ Modern, tam asenkron, zengin özellikli ve modüler **Jubbio Python SDK** kütüphanesi ve içerisinde gelen hazır **Prefix Komutlu Jubbio Botu**.
4
+
5
+ [![Python Version](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://python.org)
6
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
7
+
8
+ ---
9
+
10
+ ## 🌟 Bot Komutları ve Özellikleri (Prefix: `!`)
11
+
12
+ ### 🛡️ Moderasyon Komutları
13
+ * `!yasakla @kullanıcı [sebep]` (veya `!ban`): Kullanıcıyı sunucudan yasaklar.
14
+ * `!at @kullanıcı [sebep]` (veya `!kick`): Kullanıcıyı sunucudan atar.
15
+ * `!sustur @kullanıcı [dakika] [sebep]` (veya `!mute`): Kullanıcıyı belirlenen dakika kadar susturur.
16
+ * `!susturma-ac @kullanıcı` (veya `!unmute`): Kullanıcının susturmasını kaldırır.
17
+ * `!sil [adet]` (veya `!temizle`): Kanaldaki son mesajları toplu temizler.
18
+ * `!rolver @kullanıcı @rol`: Kullanıcıya rol atar.
19
+ * `!rolal @kullanıcı @rol`: Kullanıcıdan rol kaldırır.
20
+
21
+ ### ℹ️ Bilgi & Profil
22
+ * `!ping`: Botun gecikme süresi ve bağlantı durumunu gösterir.
23
+ * `!yardim` (veya `!help`, `!komutlar`): Şık komut listesi rehberi.
24
+ * `!sunucu`: Sunucu istatistikleri ve bilgileri.
25
+ * `!kullanici [@kullanıcı]`: Kullanıcı profil kartı.
26
+ * `!avatar [@kullanıcı]` (veya `!pp`): Kullanıcının profil fotoğrafını büyük boyutta gösterir.
27
+ * `!hakkinda`: JubbioPY kütüphane bilgisi.
28
+
29
+ ### ✨ İnteraktif Bileşenler (Butonlar & Modallar)
30
+ * `!oylama <soru>`: Canlı Evet 👍 / Hayır 👎 / Kararsızım 🤔 butonlarıyla interaktif oylama başlatır.
31
+ * `!rol-menusu`: Kullanıcıların açılır menüden (SelectMenu) rol seçebileceği panel gönderir.
32
+ * `!destek`: Butonlu destek paneli gönderir (Tıklayınca açılır Form Modalı açılır).
33
+
34
+ ### 🎮 Eğlence & Şans
35
+ * `!zar [yüzey]`: Zar atar (Örn: `!zar 20`).
36
+ * `!yazitura`: Madeni para atar.
37
+ * `!sec <seçenek 1, seçenek 2, ...>`: Seçenekler arasından rastgele birini seçer (Örn: `!sec pizza, burger, döner`).
38
+ * `!echo <mesaj>`: Bot üzerinden mesaj gönderir.
39
+
40
+ ---
41
+
42
+ ## 🚀 Botu Başlatma
43
+
44
+ ### 1. Bot Klasörüne Geçin ve Sanal Ortamı Aktif Edin:
45
+
46
+ ```bash
47
+ cd bot
48
+ source .venv/bin/activate
49
+ ```
50
+
51
+ ---
52
+
53
+ ### 2. Tokeninizi Tanımlayın:
54
+
55
+ `bot/.env` dosyasını açıp tokeninizi yazın:
56
+ ```env
57
+ JUBBIO_BOT_TOKEN=buraya_jubbio_bot_tokeninizi_yazın
58
+ BOT_PREFIX=!
59
+ EMBED_COLOR=blurple
60
+ ```
61
+
62
+ ---
63
+
64
+ ### 3. Botu Çalıştırın:
65
+
66
+ ```bash
67
+ python main.py
68
+ ```
69
+
70
+ ---
71
+
72
+ ## 🧪 SDK Testlerini Çalıştırma
73
+
74
+ ```bash
75
+ bot/.venv/bin/python -m unittest discover tests
76
+ ```
@@ -0,0 +1,133 @@
1
+ """
2
+ Jubbio Python SDK (JubbioPY)
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Modern, asenkron ve güçlü Jubbio Bot ve API kütüphanesi.
6
+
7
+ :copyright: (c) 2026 Jubbio
8
+ :license: MIT, bkz. LICENSE
9
+ """
10
+
11
+ __title__ = "jubbio"
12
+ __author__ = "Jubbio Developers"
13
+ __license__ = "MIT"
14
+ __copyright__ = "Copyright 2026 Jubbio"
15
+ __version__ = "0.1.0"
16
+
17
+ # ─── Alt Modüller (Submodules - Strict Namespaces) ───────────────────────────
18
+ from . import core as core
19
+ from . import models as models
20
+ from . import builders as builders
21
+ from . import ui as ui
22
+ from . import enums as enums
23
+ from . import permissions as permissions
24
+ from . import exceptions as exceptions
25
+ from . import utils as utils
26
+ from . import rest as rest
27
+ from . import gateway as gateway
28
+ from . import tasks as tasks
29
+ from .core import cache as cache
30
+ from .core import checks as checks
31
+ from .core import converters as converters
32
+ from .core import cooldowns as cooldowns
33
+
34
+ # ─── Çekirdek Sınıflar (Core Classes) ────────────────────────────────────────
35
+ from .core import Bot as Bot
36
+ from .core import Client as Client
37
+ from .core import Plugin as Plugin
38
+ from .core.cache import CacheFlags as CacheFlags
39
+ from .core.cooldowns import BucketType as BucketType, cooldown as cooldown
40
+ from .core.converters import Converter as Converter
41
+
42
+ # ─── Veri Modelleri (Models) ────────────────────────────────────────────────
43
+ from .models.context import Context as Context
44
+ from .models.message import Message as Message
45
+ from .models.user import User as User
46
+ from .models.member import GuildMember as GuildMember
47
+ from .models.guild import Guild as Guild
48
+ from .models.channel import Channel as Channel, TextChannel as TextChannel
49
+ from .models.role import Role as Role
50
+ from .models.file import File as File
51
+ from .models.interaction import (
52
+ BaseInteraction as BaseInteraction,
53
+ ButtonInteraction as ButtonInteraction,
54
+ CommandInteraction as CommandInteraction,
55
+ ModalSubmitInteraction as ModalSubmitInteraction,
56
+ SelectMenuInteraction as SelectMenuInteraction,
57
+ )
58
+
59
+ # ─── UI & Bileşen Builderları (Builders & UI) ────────────────────────────────
60
+ from .ui.view import View as View
61
+ from .ui.paginator import Paginator as Paginator
62
+ from .builders.embed import Embed as Embed
63
+ from .builders.components import ActionRow as ActionRow, Button as Button, SelectMenu as SelectMenu
64
+ from .builders.modal import Modal as Modal, TextInput as TextInput
65
+ from .builders.command import SlashCommandBuilder as SlashCommandBuilder, CommandOption as CommandOption
66
+
67
+ # ─── Yetkiler, Enumlar & Yardımcılar ────────────────────────────────────────
68
+ from .permissions import Permissions as Permissions, PermissionFlagsBits as PermissionFlagsBits
69
+ from .enums import ButtonStyle as ButtonStyle, ChannelType as ChannelType, CommandOptionType as CommandOptionType, GatewayIntent as GatewayIntent
70
+ from .utils.color import Color as Color, Colour as Colour
71
+
72
+ __all__ = [
73
+ # Alt Modüller
74
+ "core",
75
+ "models",
76
+ "builders",
77
+ "ui",
78
+ "enums",
79
+ "permissions",
80
+ "exceptions",
81
+ "utils",
82
+ "rest",
83
+ "gateway",
84
+ "cache",
85
+ "tasks",
86
+ "checks",
87
+ "converters",
88
+ "cooldowns",
89
+ # Çekirdek
90
+ "Bot",
91
+ "Client",
92
+ "Plugin",
93
+ "CacheFlags",
94
+ "BucketType",
95
+ "cooldown",
96
+ "Converter",
97
+ # UI & View & Paginator
98
+ "View",
99
+ "Paginator",
100
+ # Modeller
101
+ "Context",
102
+ "Message",
103
+ "User",
104
+ "GuildMember",
105
+ "Guild",
106
+ "Channel",
107
+ "TextChannel",
108
+ "Role",
109
+ "File",
110
+ "BaseInteraction",
111
+ "ButtonInteraction",
112
+ "CommandInteraction",
113
+ "ModalSubmitInteraction",
114
+ "SelectMenuInteraction",
115
+ # Builderlar
116
+ "Embed",
117
+ "ActionRow",
118
+ "Button",
119
+ "SelectMenu",
120
+ "Modal",
121
+ "TextInput",
122
+ "SlashCommandBuilder",
123
+ "CommandOption",
124
+ # Yetki & Enum & Utils
125
+ "Permissions",
126
+ "PermissionFlagsBits",
127
+ "ButtonStyle",
128
+ "ChannelType",
129
+ "CommandOptionType",
130
+ "GatewayIntent",
131
+ "Color",
132
+ "Colour",
133
+ ]
@@ -0,0 +1,109 @@
1
+ """Jubbio Python SDK (JubbioPY) — Type Stubs for Pylance/IntelliSense."""
2
+
3
+ from typing import Any, Callable, Coroutine, Dict, List, Optional, Sequence, Set, Type, Union
4
+
5
+ from . import core as core
6
+ from . import models as models
7
+ from . import builders as builders
8
+ from . import ui as ui
9
+ from . import enums as enums
10
+ from . import permissions as permissions
11
+ from . import exceptions as exceptions
12
+ from . import utils as utils
13
+ from . import rest as rest
14
+ from . import gateway as gateway
15
+ from . import tasks as tasks
16
+ from .core import cache as cache
17
+ from .core import checks as checks
18
+ from .core import converters as converters
19
+ from .core import cooldowns as cooldowns
20
+
21
+ from .core import Bot as Bot
22
+ from .core import Client as Client
23
+ from .core import Plugin as Plugin
24
+ from .core.cache import CacheFlags as CacheFlags
25
+ from .core.cooldowns import BucketType as BucketType, cooldown as cooldown
26
+ from .core.converters import Converter as Converter
27
+
28
+ from .ui.view import View as View
29
+ from .ui.paginator import Paginator as Paginator
30
+
31
+ from .models.context import Context as Context
32
+ from .models.message import Message as Message
33
+ from .models.user import User as User
34
+ from .models.member import GuildMember as GuildMember
35
+ from .models.guild import Guild as Guild
36
+ from .models.channel import Channel as Channel, TextChannel as TextChannel
37
+ from .models.role import Role as Role
38
+ from .models.file import File as File
39
+ from .models.interaction import (
40
+ BaseInteraction as BaseInteraction,
41
+ ButtonInteraction as ButtonInteraction,
42
+ CommandInteraction as CommandInteraction,
43
+ ModalSubmitInteraction as ModalSubmitInteraction,
44
+ SelectMenuInteraction as SelectMenuInteraction,
45
+ )
46
+ from .builders.embed import Embed as Embed
47
+ from .builders.components import ActionRow as ActionRow, Button as Button, SelectMenu as SelectMenu
48
+ from .builders.modal import Modal as Modal, TextInput as TextInput
49
+ from .builders.command import SlashCommandBuilder as SlashCommandBuilder, CommandOption as CommandOption
50
+ from .permissions import Permissions as Permissions, PermissionFlagsBits as PermissionFlagsBits
51
+ from .enums import ButtonStyle as ButtonStyle, ChannelType as ChannelType, CommandOptionType as CommandOptionType, GatewayIntent as GatewayIntent
52
+ from .utils.color import Color as Color, Colour as Colour
53
+
54
+ __all__: List[str] = [
55
+ "core",
56
+ "models",
57
+ "builders",
58
+ "ui",
59
+ "enums",
60
+ "permissions",
61
+ "exceptions",
62
+ "utils",
63
+ "rest",
64
+ "gateway",
65
+ "cache",
66
+ "tasks",
67
+ "checks",
68
+ "converters",
69
+ "cooldowns",
70
+ "Bot",
71
+ "Client",
72
+ "Plugin",
73
+ "CacheFlags",
74
+ "BucketType",
75
+ "cooldown",
76
+ "Converter",
77
+ "View",
78
+ "Paginator",
79
+ "Context",
80
+ "Message",
81
+ "User",
82
+ "GuildMember",
83
+ "Guild",
84
+ "Channel",
85
+ "TextChannel",
86
+ "Role",
87
+ "File",
88
+ "BaseInteraction",
89
+ "ButtonInteraction",
90
+ "CommandInteraction",
91
+ "ModalSubmitInteraction",
92
+ "SelectMenuInteraction",
93
+ "Embed",
94
+ "ActionRow",
95
+ "Button",
96
+ "SelectMenu",
97
+ "Modal",
98
+ "TextInput",
99
+ "SlashCommandBuilder",
100
+ "CommandOption",
101
+ "Permissions",
102
+ "PermissionFlagsBits",
103
+ "ButtonStyle",
104
+ "ChannelType",
105
+ "CommandOptionType",
106
+ "GatewayIntent",
107
+ "Color",
108
+ "Colour",
109
+ ]
@@ -0,0 +1,21 @@
1
+ from .embed import Embed
2
+ from .components import (
3
+ Button,
4
+ SelectOption,
5
+ SelectMenu,
6
+ ActionRow,
7
+ )
8
+ from .modal import TextInput, Modal
9
+ from .command import SlashCommandBuilder, CommandOption
10
+
11
+ __all__ = [
12
+ "Embed",
13
+ "Button",
14
+ "SelectOption",
15
+ "SelectMenu",
16
+ "ActionRow",
17
+ "TextInput",
18
+ "Modal",
19
+ "SlashCommandBuilder",
20
+ "CommandOption",
21
+ ]
@@ -0,0 +1,175 @@
1
+ from typing import Any, Dict, List, Optional, Union
2
+ from ..enums import CommandOptionType
3
+
4
+
5
+ class CommandOption:
6
+ """Slash komut parametre seçeneği."""
7
+
8
+ def __init__(
9
+ self,
10
+ name: str,
11
+ description: str,
12
+ *,
13
+ type: Union[CommandOptionType, int] = CommandOptionType.STRING,
14
+ required: bool = False,
15
+ choices: Optional[List[Dict[str, Any]]] = None,
16
+ autocomplete: bool = False,
17
+ ):
18
+ self.name: str = name.lower().strip()
19
+ self.description: str = description
20
+ self.type: int = int(type)
21
+ self.required: bool = required
22
+ self.choices: Optional[List[Dict[str, Any]]] = choices
23
+ self.autocomplete: bool = autocomplete
24
+
25
+ def add_choice(self, name: str, value: Union[str, int, float]) -> "CommandOption":
26
+ if self.choices is None:
27
+ self.choices = []
28
+ self.choices.append({"name": name, "value": value})
29
+ return self
30
+
31
+ def to_dict(self) -> Dict[str, Any]:
32
+ data: Dict[str, Any] = {
33
+ "name": self.name,
34
+ "description": self.description,
35
+ "type": self.type,
36
+ "required": self.required,
37
+ }
38
+ if self.choices:
39
+ data["choices"] = self.choices
40
+ if self.autocomplete:
41
+ data["autocomplete"] = True
42
+ return data
43
+
44
+
45
+ class SlashCommandBuilder:
46
+ """Slash komut tanımlama oluşturucu."""
47
+
48
+ def __init__(
49
+ self,
50
+ name: str,
51
+ description: str,
52
+ *,
53
+ options: Optional[List[CommandOption]] = None,
54
+ ):
55
+ self.name: str = name.lower().strip()
56
+ self.description: str = description
57
+ self.options: List[CommandOption] = options or []
58
+
59
+ def add_option(self, option: CommandOption) -> "SlashCommandBuilder":
60
+ self.options.append(option)
61
+ return self
62
+
63
+ def add_string_option(
64
+ self,
65
+ name: str,
66
+ description: str,
67
+ *,
68
+ required: bool = False,
69
+ choices: Optional[List[Dict[str, Any]]] = None,
70
+ autocomplete: bool = False,
71
+ ) -> "SlashCommandBuilder":
72
+ return self.add_option(
73
+ CommandOption(
74
+ name,
75
+ description,
76
+ type=CommandOptionType.STRING,
77
+ required=required,
78
+ choices=choices,
79
+ autocomplete=autocomplete,
80
+ )
81
+ )
82
+
83
+ def add_integer_option(
84
+ self,
85
+ name: str,
86
+ description: str,
87
+ *,
88
+ required: bool = False,
89
+ choices: Optional[List[Dict[str, Any]]] = None,
90
+ ) -> "SlashCommandBuilder":
91
+ return self.add_option(
92
+ CommandOption(
93
+ name,
94
+ description,
95
+ type=CommandOptionType.INTEGER,
96
+ required=required,
97
+ choices=choices,
98
+ )
99
+ )
100
+
101
+ def add_boolean_option(
102
+ self,
103
+ name: str,
104
+ description: str,
105
+ *,
106
+ required: bool = False,
107
+ ) -> "SlashCommandBuilder":
108
+ return self.add_option(
109
+ CommandOption(
110
+ name,
111
+ description,
112
+ type=CommandOptionType.BOOLEAN,
113
+ required=required,
114
+ )
115
+ )
116
+
117
+ def add_user_option(
118
+ self,
119
+ name: str,
120
+ description: str,
121
+ *,
122
+ required: bool = False,
123
+ ) -> "SlashCommandBuilder":
124
+ return self.add_option(
125
+ CommandOption(
126
+ name,
127
+ description,
128
+ type=CommandOptionType.USER,
129
+ required=required,
130
+ )
131
+ )
132
+
133
+ def add_channel_option(
134
+ self,
135
+ name: str,
136
+ description: str,
137
+ *,
138
+ required: bool = False,
139
+ ) -> "SlashCommandBuilder":
140
+ return self.add_option(
141
+ CommandOption(
142
+ name,
143
+ description,
144
+ type=CommandOptionType.CHANNEL,
145
+ required=required,
146
+ )
147
+ )
148
+
149
+ def add_role_option(
150
+ self,
151
+ name: str,
152
+ description: str,
153
+ *,
154
+ required: bool = False,
155
+ ) -> "SlashCommandBuilder":
156
+ return self.add_option(
157
+ CommandOption(
158
+ name,
159
+ description,
160
+ type=CommandOptionType.ROLE,
161
+ required=required,
162
+ )
163
+ )
164
+
165
+ def to_dict(self) -> Dict[str, Any]:
166
+ data: Dict[str, Any] = {
167
+ "name": self.name,
168
+ "description": self.description,
169
+ }
170
+ if self.options:
171
+ data["options"] = [opt.to_dict() for opt in self.options]
172
+ return data
173
+
174
+ def __repr__(self) -> str:
175
+ return f"<SlashCommandBuilder name={self.name!r} options={len(self.options)}>"