sosad 0.1.0__py3-none-any.whl
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.
- sosad/__init__.py +113 -0
- sosad/__main__.py +4 -0
- sosad/_meta.py +4 -0
- sosad/api/__init__.py +30 -0
- sosad/api/client.py +633 -0
- sosad/api/rate_limit.py +131 -0
- sosad/api/types.py +151 -0
- sosad/checks/__init__.py +24 -0
- sosad/checks/base.py +37 -0
- sosad/checks/builtin.py +119 -0
- sosad/checks/decorator.py +41 -0
- sosad/cli/__init__.py +1 -0
- sosad/cli/runner.py +29 -0
- sosad/commands/__init__.py +5 -0
- sosad/commands/decorators.py +161 -0
- sosad/commands/executor.py +64 -0
- sosad/commands/models.py +67 -0
- sosad/commands/registration.py +24 -0
- sosad/commands/registry.py +197 -0
- sosad/commands/router.py +164 -0
- sosad/commands/sync.py +124 -0
- sosad/components/__init__.py +19 -0
- sosad/components/base.py +107 -0
- sosad/components/decorators.py +119 -0
- sosad/components/registry.py +60 -0
- sosad/context/__init__.py +4 -0
- sosad/context/context.py +220 -0
- sosad/cooldowns/__init__.py +13 -0
- sosad/cooldowns/buckets.py +38 -0
- sosad/cooldowns/decorator.py +52 -0
- sosad/cooldowns/storage.py +58 -0
- sosad/core/__init__.py +5 -0
- sosad/core/app.py +35 -0
- sosad/core/client.py +187 -0
- sosad/core/constants.py +38 -0
- sosad/di/__init__.py +7 -0
- sosad/di/container.py +114 -0
- sosad/di/markers.py +40 -0
- sosad/di/providers.py +26 -0
- sosad/di/scopes.py +37 -0
- sosad/errors/__init__.py +20 -0
- sosad/errors/base.py +56 -0
- sosad/errors/builtin.py +27 -0
- sosad/errors/handler.py +55 -0
- sosad/events/__init__.py +5 -0
- sosad/events/dispatcher.py +63 -0
- sosad/events/models.py +19 -0
- sosad/events/registration.py +20 -0
- sosad/events/typed.py +40 -0
- sosad/middleware/__init__.py +5 -0
- sosad/middleware/builtins.py +33 -0
- sosad/middleware/registry.py +59 -0
- sosad/middleware/types.py +35 -0
- sosad/permissions/__init__.py +12 -0
- sosad/permissions/builtin.py +21 -0
- sosad/permissions/decorator.py +38 -0
- sosad/permissions/resolver.py +30 -0
- sosad/plugins/__init__.py +5 -0
- sosad/plugins/base.py +34 -0
- sosad/plugins/loader.py +52 -0
- sosad/plugins/manager.py +101 -0
- sosad/tasks/__init__.py +7 -0
- sosad/tasks/base.py +39 -0
- sosad/tasks/decorators.py +56 -0
- sosad/tasks/scheduler.py +126 -0
- sosad/utils/__init__.py +1 -0
- sosad/utils/async_utils.py +20 -0
- sosad/utils/importing.py +23 -0
- sosad/utils/typing.py +10 -0
- sosad-0.1.0.dist-info/METADATA +12 -0
- sosad-0.1.0.dist-info/RECORD +72 -0
- sosad-0.1.0.dist-info/WHEEL +4 -0
sosad/__init__.py
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"""SoSad — A modern, modular, type-safe Discord framework built on Hikari."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import hikari
|
|
6
|
+
|
|
7
|
+
from sosad._meta import __version__
|
|
8
|
+
from sosad.api import RESTClient
|
|
9
|
+
from sosad.checks import (
|
|
10
|
+
CheckResult,
|
|
11
|
+
bot_has_permissions,
|
|
12
|
+
check,
|
|
13
|
+
dm_only,
|
|
14
|
+
guild_only,
|
|
15
|
+
has_permissions,
|
|
16
|
+
has_role,
|
|
17
|
+
in_guild,
|
|
18
|
+
is_owner,
|
|
19
|
+
)
|
|
20
|
+
from sosad.commands import CommandRegistry, command_group, slash_command, sub_command
|
|
21
|
+
from sosad.commands.executor import execute_command
|
|
22
|
+
from sosad.components import button, modal, select
|
|
23
|
+
from sosad.components.base import ComponentContext
|
|
24
|
+
from sosad.context import InteractionContext, ResponseBuilder
|
|
25
|
+
from sosad.cooldowns import BucketScope, CooldownConfig, cooldown
|
|
26
|
+
from sosad.core import App, Client
|
|
27
|
+
from sosad.di import Container, ScopeManager, inject
|
|
28
|
+
from sosad.errors import (
|
|
29
|
+
CheckFailed,
|
|
30
|
+
CommandError,
|
|
31
|
+
CommandNotFound,
|
|
32
|
+
ErrorPipeline,
|
|
33
|
+
RateLimited,
|
|
34
|
+
SoSadError,
|
|
35
|
+
SyncError,
|
|
36
|
+
)
|
|
37
|
+
from sosad.events import EventDispatcher, listen
|
|
38
|
+
from sosad.middleware import HandlerFunc, MiddlewareFunc, MiddlewareStack
|
|
39
|
+
from sosad.permissions import PermissionResolver, requires_permissions
|
|
40
|
+
from sosad.plugins import Plugin, PluginManager
|
|
41
|
+
from sosad.tasks import TaskMeta, TaskScheduler, loop, task
|
|
42
|
+
|
|
43
|
+
__version__ = __version__
|
|
44
|
+
|
|
45
|
+
__all__ = [
|
|
46
|
+
# Core
|
|
47
|
+
"App",
|
|
48
|
+
"Client",
|
|
49
|
+
# Context
|
|
50
|
+
"InteractionContext",
|
|
51
|
+
"ResponseBuilder",
|
|
52
|
+
# Commands
|
|
53
|
+
"CommandRegistry",
|
|
54
|
+
"slash_command",
|
|
55
|
+
"sub_command",
|
|
56
|
+
"command_group",
|
|
57
|
+
"execute_command",
|
|
58
|
+
# Components
|
|
59
|
+
"button",
|
|
60
|
+
"select",
|
|
61
|
+
"modal",
|
|
62
|
+
"ComponentContext",
|
|
63
|
+
# Events
|
|
64
|
+
"EventDispatcher",
|
|
65
|
+
"listen",
|
|
66
|
+
# Middleware
|
|
67
|
+
"MiddlewareFunc",
|
|
68
|
+
"HandlerFunc",
|
|
69
|
+
"MiddlewareStack",
|
|
70
|
+
# DI
|
|
71
|
+
"Container",
|
|
72
|
+
"ScopeManager",
|
|
73
|
+
"inject",
|
|
74
|
+
# Checks
|
|
75
|
+
"CheckResult",
|
|
76
|
+
"check",
|
|
77
|
+
"is_owner",
|
|
78
|
+
"has_permissions",
|
|
79
|
+
"has_role",
|
|
80
|
+
"in_guild",
|
|
81
|
+
"dm_only",
|
|
82
|
+
"guild_only",
|
|
83
|
+
"bot_has_permissions",
|
|
84
|
+
# Cooldowns
|
|
85
|
+
"BucketScope",
|
|
86
|
+
"CooldownConfig",
|
|
87
|
+
"cooldown",
|
|
88
|
+
# Permissions
|
|
89
|
+
"PermissionResolver",
|
|
90
|
+
"requires_permissions",
|
|
91
|
+
# Errors
|
|
92
|
+
"SoSadError",
|
|
93
|
+
"CommandError",
|
|
94
|
+
"CommandNotFound",
|
|
95
|
+
"CheckFailed",
|
|
96
|
+
"RateLimited",
|
|
97
|
+
"SyncError",
|
|
98
|
+
"ErrorPipeline",
|
|
99
|
+
# Plugins
|
|
100
|
+
"Plugin",
|
|
101
|
+
"PluginManager",
|
|
102
|
+
# Tasks
|
|
103
|
+
"TaskMeta",
|
|
104
|
+
"TaskScheduler",
|
|
105
|
+
"task",
|
|
106
|
+
"loop",
|
|
107
|
+
# API
|
|
108
|
+
"RESTClient",
|
|
109
|
+
# Re-export hikari for convenience
|
|
110
|
+
"hikari",
|
|
111
|
+
# Version
|
|
112
|
+
"__version__",
|
|
113
|
+
]
|
sosad/__main__.py
ADDED
sosad/_meta.py
ADDED
sosad/api/__init__.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""REST API client for Discord."""
|
|
2
|
+
|
|
3
|
+
from sosad.api.client import RESTClient
|
|
4
|
+
from sosad.api.rate_limit import RateLimitState, parse_route
|
|
5
|
+
from sosad.api.types import (
|
|
6
|
+
APIError,
|
|
7
|
+
ApplicationCommandData,
|
|
8
|
+
ChannelData,
|
|
9
|
+
GuildData,
|
|
10
|
+
HTTPMethod,
|
|
11
|
+
InteractionResponseData,
|
|
12
|
+
MessageData,
|
|
13
|
+
RESTResponse,
|
|
14
|
+
WebhookData,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
__all__ = [
|
|
18
|
+
"APIError",
|
|
19
|
+
"ApplicationCommandData",
|
|
20
|
+
"ChannelData",
|
|
21
|
+
"GuildData",
|
|
22
|
+
"HTTPMethod",
|
|
23
|
+
"InteractionResponseData",
|
|
24
|
+
"MessageData",
|
|
25
|
+
"RESTClient",
|
|
26
|
+
"RESTResponse",
|
|
27
|
+
"RateLimitState",
|
|
28
|
+
"WebhookData",
|
|
29
|
+
"parse_route",
|
|
30
|
+
]
|