nubis 0.0.0-stage → 0.1.0-next.0
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.
- package/LICENSE +21 -0
- package/README.md +20 -2
- package/dist/api.d.ts +12 -0
- package/dist/bot.d.ts +45 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +1017 -0
- package/dist/commands.d.ts +24 -0
- package/dist/config-loader.d.ts +10 -0
- package/dist/config.d.ts +51 -0
- package/dist/env.d.ts +15 -0
- package/dist/http.d.ts +41 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +295 -0
- package/dist/intents.d.ts +11 -0
- package/dist/loader.d.ts +33 -0
- package/dist/node-listener.d.ts +8 -0
- package/dist/node.d.ts +19 -0
- package/dist/node.js +592 -0
- package/dist/rest-transport.d.ts +16 -0
- package/dist/route.d.ts +17 -0
- package/dist/run-cli.d.ts +10 -0
- package/dist/sync.d.ts +26 -0
- package/dist/testing.d.ts +2 -0
- package/dist/testing.js +2 -0
- package/package.json +57 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 EYTAK LIMITED
|
|
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.
|
package/README.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
#
|
|
1
|
+
# nubis
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Discord bot framework that feels like building a modern web app: file-based commands, types inferred from your definitions, typed components and modals, guards, and testing without Discord.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { command, option } from "nubis";
|
|
7
|
+
|
|
8
|
+
export default command({
|
|
9
|
+
description: "Say hi",
|
|
10
|
+
options: { who: option.user({ required: true }) },
|
|
11
|
+
run: ({ options, reply }) => reply(`Hi ${options.who.username}!`),
|
|
12
|
+
});
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
- `nubis`: commands, components, modals, guards, and the HTTP interactions handler
|
|
16
|
+
- `nubis/node`: load a bot from its folders, serve it with `node:http`
|
|
17
|
+
- `nubis/testing`: run commands and components as Discord would, in tests
|
|
18
|
+
|
|
19
|
+
Docs: https://eytak.com/nubis/docs. Source: https://github.com/Eytak-Technologies/nubis
|
|
20
|
+
|
|
21
|
+
MIT. Built by [Eytak](https://eytak.com).
|
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { API } from "@discordjs/core/http-only";
|
|
2
|
+
/**
|
|
3
|
+
* Handlers' `api` is @discordjs/core's typed client: `api.channels.createMessage`,
|
|
4
|
+
* `api.guilds.banUser`, and the rest of Discord's REST API, rate limits handled.
|
|
5
|
+
* Core declares NubisApi empty so it doesn't depend on an HTTP library; this
|
|
6
|
+
* fills it in for everyone who imports `nubis`.
|
|
7
|
+
*/
|
|
8
|
+
declare module "@nubisjs/core" {
|
|
9
|
+
interface NubisApi extends API {
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export type { API } from "@discordjs/core/http-only";
|
package/dist/bot.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type ErrorHandler, type NubisApi } from "@nubisjs/core";
|
|
2
|
+
import { type GatewayDispatchPayload, type GatewayPresenceUpdateData } from "discord-api-types/v10";
|
|
3
|
+
import type { Project } from "./loader";
|
|
4
|
+
import { type RestLike } from "./rest-transport";
|
|
5
|
+
import { type RouteOptions } from "./route";
|
|
6
|
+
/** What the bot needs from a gateway connection; @discordjs/ws by default. */
|
|
7
|
+
export interface GatewayLike {
|
|
8
|
+
on(event: "dispatch", listener: (payload: GatewayDispatchPayload, shardId: number) => void): unknown;
|
|
9
|
+
connect(): Promise<void>;
|
|
10
|
+
destroy(): Promise<void> | void;
|
|
11
|
+
}
|
|
12
|
+
export interface BotOptions {
|
|
13
|
+
readonly token: string;
|
|
14
|
+
readonly project: Project;
|
|
15
|
+
/** Intents beyond what the project's events need, e.g. MessageContent. */
|
|
16
|
+
readonly intents?: number;
|
|
17
|
+
/** The status and activity shown when the bot connects. */
|
|
18
|
+
readonly presence?: GatewayPresenceUpdateData;
|
|
19
|
+
/** Guards, middleware and timing for every interaction. */
|
|
20
|
+
readonly dispatch?: RouteOptions;
|
|
21
|
+
/** Every handler error, from interactions and events. */
|
|
22
|
+
readonly onError?: ErrorHandler;
|
|
23
|
+
/** Swappable in tests. */
|
|
24
|
+
readonly rest?: RestLike;
|
|
25
|
+
readonly gateway?: (options: {
|
|
26
|
+
intents: number;
|
|
27
|
+
rest: RestLike;
|
|
28
|
+
presence: GatewayPresenceUpdateData | null;
|
|
29
|
+
}) => GatewayLike;
|
|
30
|
+
}
|
|
31
|
+
export interface Bot {
|
|
32
|
+
/** Discord's REST API, authenticated as the bot. */
|
|
33
|
+
readonly rest: RestLike;
|
|
34
|
+
/** The typed API client handlers get as `api`. */
|
|
35
|
+
readonly api: NubisApi;
|
|
36
|
+
/** The intents the bot connects with. */
|
|
37
|
+
readonly intents: number;
|
|
38
|
+
start(): Promise<void>;
|
|
39
|
+
stop(): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Connects a project to Discord's gateway: interactions go to their
|
|
43
|
+
* dispatchers, every other event to the project's event handlers.
|
|
44
|
+
*/
|
|
45
|
+
export declare function createBot(options: BotOptions): Bot;
|
package/dist/cli.d.ts
ADDED