disagreement 0.0.1__tar.gz → 0.0.2__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.
- {disagreement-0.0.1/disagreement.egg-info → disagreement-0.0.2}/PKG-INFO +39 -32
- {disagreement-0.0.1 → disagreement-0.0.2}/README.md +38 -31
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/__init__.py +1 -1
- disagreement-0.0.2/disagreement/ext/__init__.py +0 -0
- disagreement-0.0.2/disagreement/ext/app_commands/__init__.py +46 -0
- disagreement-0.0.2/disagreement/ext/app_commands/commands.py +513 -0
- disagreement-0.0.2/disagreement/ext/app_commands/context.py +556 -0
- disagreement-0.0.2/disagreement/ext/app_commands/converters.py +478 -0
- disagreement-0.0.2/disagreement/ext/app_commands/decorators.py +569 -0
- disagreement-0.0.2/disagreement/ext/app_commands/handler.py +627 -0
- disagreement-0.0.2/disagreement/ext/commands/__init__.py +49 -0
- disagreement-0.0.2/disagreement/ext/commands/cog.py +155 -0
- disagreement-0.0.2/disagreement/ext/commands/converters.py +175 -0
- disagreement-0.0.2/disagreement/ext/commands/core.py +490 -0
- disagreement-0.0.2/disagreement/ext/commands/decorators.py +150 -0
- disagreement-0.0.2/disagreement/ext/commands/errors.py +76 -0
- disagreement-0.0.2/disagreement/ext/commands/help.py +37 -0
- disagreement-0.0.2/disagreement/ext/commands/view.py +103 -0
- disagreement-0.0.2/disagreement/ext/loader.py +43 -0
- disagreement-0.0.2/disagreement/ext/tasks.py +89 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/gateway.py +11 -8
- {disagreement-0.0.1 → disagreement-0.0.2/disagreement.egg-info}/PKG-INFO +39 -32
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement.egg-info/SOURCES.txt +17 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/examples/component_bot.py +0 -4
- {disagreement-0.0.1 → disagreement-0.0.2}/pyproject.toml +1 -1
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_context.py +2 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_gateway_backoff.py +2 -1
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_presence_update.py +1 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/LICENSE +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/MANIFEST.in +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/cache.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/client.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/components.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/enums.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/error_handler.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/errors.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/event_dispatcher.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/http.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/hybrid_context.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/i18n.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/interactions.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/logging_config.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/models.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/oauth.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/permissions.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/rate_limiter.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/shard_manager.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/typing.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/ui/__init__.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/ui/button.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/ui/item.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/ui/modal.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/ui/select.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/ui/view.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement/voice_client.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement.egg-info/dependency_links.txt +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement.egg-info/requires.txt +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/disagreement.egg-info/top_level.txt +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/docs/caching.md +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/docs/commands.md +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/docs/context_menus.md +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/docs/converters.md +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/docs/events.md +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/docs/gateway.md +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/docs/i18n.md +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/docs/oauth2.md +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/docs/permissions.md +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/docs/presence.md +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/docs/reactions.md +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/docs/slash_commands.md +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/docs/task_loop.md +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/docs/typing_indicator.md +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/docs/using_components.md +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/docs/voice_client.md +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/docs/voice_features.md +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/docs/webhooks.md +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/examples/basic_bot.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/examples/context_menus.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/examples/hybrid_bot.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/examples/modal_command.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/examples/modal_send.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/examples/sharded_bot.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/examples/task_loop.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/examples/voice_bot.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/setup.cfg +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_additional_converters.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_cache.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_client_context_manager.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_command_checks.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_components_factory.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_context_menus.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_converter_registration.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_converters.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_error_handler.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_errors.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_event_dispatcher.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_event_error_hook.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_extension_loader.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_help_command.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_http_reactions.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_hybrid_context.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_i18n.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_interaction.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_logging_config.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_modal_send.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_modals.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_oauth.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_permissions.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_presence_and_typing.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_rate_limiter.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_reactions.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_sharding.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_slash_contexts.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_tasks_extension.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_typing_indicator.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_ui.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_view_layout.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_voice_client.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_wait_for.py +0 -0
- {disagreement-0.0.1 → disagreement-0.0.2}/tests/test_webhooks.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: disagreement
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.2
|
4
4
|
Summary: A Python library for the Discord API.
|
5
5
|
Author-email: Slipstream <me@slipstreamm.dev>
|
6
6
|
License: BSD 3-Clause
|
@@ -60,29 +60,33 @@ Requires Python 3.11 or newer.
|
|
60
60
|
```python
|
61
61
|
import asyncio
|
62
62
|
import os
|
63
|
+
|
63
64
|
import disagreement
|
65
|
+
from disagreement.ext import commands
|
66
|
+
|
67
|
+
|
68
|
+
class Basics(commands.Cog):
|
69
|
+
def __init__(self, client: disagreement.Client) -> None:
|
70
|
+
super().__init__(client)
|
71
|
+
|
72
|
+
@commands.command()
|
73
|
+
async def ping(self, ctx: commands.CommandContext) -> None:
|
74
|
+
await ctx.reply("Pong!")
|
75
|
+
|
76
|
+
|
77
|
+
token = os.getenv("DISCORD_BOT_TOKEN")
|
78
|
+
if not token:
|
79
|
+
raise RuntimeError("DISCORD_BOT_TOKEN environment variable not set")
|
80
|
+
|
81
|
+
client = disagreement.Client(token=token, command_prefix="!")
|
82
|
+
client.add_cog(Basics(client))
|
64
83
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
if message.content.lower() == '!ping':
|
72
|
-
await message.reply('Pong!')
|
73
|
-
|
74
|
-
async def main():
|
75
|
-
if not client.token:
|
76
|
-
print("Error: DISCORD_BOT_TOKEN environment variable not set.")
|
77
|
-
return
|
78
|
-
try:
|
79
|
-
async with client:
|
80
|
-
await asyncio.Future() # run until cancelled
|
81
|
-
except KeyboardInterrupt:
|
82
|
-
print("Bot shutting down...")
|
83
|
-
# Add any other specific exception handling from your library, e.g., disagreement.AuthenticationError
|
84
|
-
|
85
|
-
if __name__ == '__main__':
|
84
|
+
|
85
|
+
async def main() -> None:
|
86
|
+
await client.run()
|
87
|
+
|
88
|
+
|
89
|
+
if __name__ == "__main__":
|
86
90
|
asyncio.run(main())
|
87
91
|
```
|
88
92
|
|
@@ -117,21 +121,20 @@ setup_logging(logging.DEBUG, file="bot.log")
|
|
117
121
|
### Defining Subcommands with `AppCommandGroup`
|
118
122
|
|
119
123
|
```python
|
120
|
-
from disagreement.ext.app_commands import AppCommandGroup
|
124
|
+
from disagreement.ext.app_commands import AppCommandGroup, slash_command
|
125
|
+
from disagreement.ext.app_commands.context import AppCommandContext
|
121
126
|
|
122
|
-
|
127
|
+
settings_group = AppCommandGroup("settings", "Manage settings")
|
128
|
+
admin_group = AppCommandGroup("admin", "Admin settings", parent=settings_group)
|
123
129
|
|
124
|
-
|
125
|
-
|
126
|
-
|
130
|
+
|
131
|
+
@slash_command(name="show", description="Display a setting.", parent=settings_group)
|
132
|
+
async def show(ctx: AppCommandContext, key: str):
|
127
133
|
...
|
128
134
|
|
129
|
-
@settings.group("admin", description="Admin settings")
|
130
|
-
def admin_group():
|
131
|
-
pass
|
132
135
|
|
133
|
-
@
|
134
|
-
async def set_setting(ctx, key: str, value: str):
|
136
|
+
@slash_command(name="set", description="Update a setting.", parent=admin_group)
|
137
|
+
async def set_setting(ctx: AppCommandContext, key: str, value: str):
|
135
138
|
...
|
136
139
|
## Fetching Guilds
|
137
140
|
|
@@ -161,3 +164,7 @@ Contributions are welcome! Please open an issue or submit a pull request.
|
|
161
164
|
|
162
165
|
See the [docs](docs/) directory for detailed guides on components, slash commands, caching, and voice features.
|
163
166
|
|
167
|
+
## License
|
168
|
+
|
169
|
+
This project is licensed under the BSD 3-Clause license. See the [LICENSE](LICENSE) file for details.
|
170
|
+
|
@@ -28,29 +28,33 @@ Requires Python 3.11 or newer.
|
|
28
28
|
```python
|
29
29
|
import asyncio
|
30
30
|
import os
|
31
|
+
|
31
32
|
import disagreement
|
33
|
+
from disagreement.ext import commands
|
34
|
+
|
35
|
+
|
36
|
+
class Basics(commands.Cog):
|
37
|
+
def __init__(self, client: disagreement.Client) -> None:
|
38
|
+
super().__init__(client)
|
39
|
+
|
40
|
+
@commands.command()
|
41
|
+
async def ping(self, ctx: commands.CommandContext) -> None:
|
42
|
+
await ctx.reply("Pong!")
|
43
|
+
|
44
|
+
|
45
|
+
token = os.getenv("DISCORD_BOT_TOKEN")
|
46
|
+
if not token:
|
47
|
+
raise RuntimeError("DISCORD_BOT_TOKEN environment variable not set")
|
48
|
+
|
49
|
+
client = disagreement.Client(token=token, command_prefix="!")
|
50
|
+
client.add_cog(Basics(client))
|
32
51
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
if message.content.lower() == '!ping':
|
40
|
-
await message.reply('Pong!')
|
41
|
-
|
42
|
-
async def main():
|
43
|
-
if not client.token:
|
44
|
-
print("Error: DISCORD_BOT_TOKEN environment variable not set.")
|
45
|
-
return
|
46
|
-
try:
|
47
|
-
async with client:
|
48
|
-
await asyncio.Future() # run until cancelled
|
49
|
-
except KeyboardInterrupt:
|
50
|
-
print("Bot shutting down...")
|
51
|
-
# Add any other specific exception handling from your library, e.g., disagreement.AuthenticationError
|
52
|
-
|
53
|
-
if __name__ == '__main__':
|
52
|
+
|
53
|
+
async def main() -> None:
|
54
|
+
await client.run()
|
55
|
+
|
56
|
+
|
57
|
+
if __name__ == "__main__":
|
54
58
|
asyncio.run(main())
|
55
59
|
```
|
56
60
|
|
@@ -85,21 +89,20 @@ setup_logging(logging.DEBUG, file="bot.log")
|
|
85
89
|
### Defining Subcommands with `AppCommandGroup`
|
86
90
|
|
87
91
|
```python
|
88
|
-
from disagreement.ext.app_commands import AppCommandGroup
|
92
|
+
from disagreement.ext.app_commands import AppCommandGroup, slash_command
|
93
|
+
from disagreement.ext.app_commands.context import AppCommandContext
|
89
94
|
|
90
|
-
|
95
|
+
settings_group = AppCommandGroup("settings", "Manage settings")
|
96
|
+
admin_group = AppCommandGroup("admin", "Admin settings", parent=settings_group)
|
91
97
|
|
92
|
-
|
93
|
-
|
94
|
-
|
98
|
+
|
99
|
+
@slash_command(name="show", description="Display a setting.", parent=settings_group)
|
100
|
+
async def show(ctx: AppCommandContext, key: str):
|
95
101
|
...
|
96
102
|
|
97
|
-
@settings.group("admin", description="Admin settings")
|
98
|
-
def admin_group():
|
99
|
-
pass
|
100
103
|
|
101
|
-
@
|
102
|
-
async def set_setting(ctx, key: str, value: str):
|
104
|
+
@slash_command(name="set", description="Update a setting.", parent=admin_group)
|
105
|
+
async def set_setting(ctx: AppCommandContext, key: str, value: str):
|
103
106
|
...
|
104
107
|
## Fetching Guilds
|
105
108
|
|
@@ -129,3 +132,7 @@ Contributions are welcome! Please open an issue or submit a pull request.
|
|
129
132
|
|
130
133
|
See the [docs](docs/) directory for detailed guides on components, slash commands, caching, and voice features.
|
131
134
|
|
135
|
+
## License
|
136
|
+
|
137
|
+
This project is licensed under the BSD 3-Clause license. See the [LICENSE](LICENSE) file for details.
|
138
|
+
|
@@ -14,7 +14,7 @@ __title__ = "disagreement"
|
|
14
14
|
__author__ = "Slipstream"
|
15
15
|
__license__ = "BSD 3-Clause License"
|
16
16
|
__copyright__ = "Copyright 2025 Slipstream"
|
17
|
-
__version__ = "0.0.
|
17
|
+
__version__ = "0.0.2"
|
18
18
|
|
19
19
|
from .client import Client
|
20
20
|
from .models import Message, User
|
File without changes
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# disagreement/ext/app_commands/__init__.py
|
2
|
+
|
3
|
+
"""
|
4
|
+
Application Commands Extension for Disagreement.
|
5
|
+
|
6
|
+
This package provides the framework for creating and handling
|
7
|
+
Discord Application Commands (slash commands, user commands, message commands).
|
8
|
+
"""
|
9
|
+
|
10
|
+
from .commands import (
|
11
|
+
AppCommand,
|
12
|
+
SlashCommand,
|
13
|
+
UserCommand,
|
14
|
+
MessageCommand,
|
15
|
+
AppCommandGroup,
|
16
|
+
)
|
17
|
+
from .decorators import (
|
18
|
+
slash_command,
|
19
|
+
user_command,
|
20
|
+
message_command,
|
21
|
+
hybrid_command,
|
22
|
+
group,
|
23
|
+
subcommand,
|
24
|
+
subcommand_group,
|
25
|
+
OptionMetadata,
|
26
|
+
)
|
27
|
+
from .context import AppCommandContext
|
28
|
+
|
29
|
+
# from .handler import AppCommandHandler # Will be imported when defined
|
30
|
+
|
31
|
+
__all__ = [
|
32
|
+
"AppCommand",
|
33
|
+
"SlashCommand",
|
34
|
+
"UserCommand",
|
35
|
+
"MessageCommand",
|
36
|
+
"AppCommandGroup", # To be defined
|
37
|
+
"slash_command",
|
38
|
+
"user_command",
|
39
|
+
"message_command",
|
40
|
+
"hybrid_command",
|
41
|
+
"group",
|
42
|
+
"subcommand",
|
43
|
+
"subcommand_group",
|
44
|
+
"OptionMetadata",
|
45
|
+
"AppCommandContext", # To be defined
|
46
|
+
]
|