seyfert 3.2.0 → 3.2.1-dev-15657234528.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 +20 -20
- package/README.md +60 -60
- package/lib/components/componentcommand.d.ts +1 -1
- package/lib/components/componentcommand.js +5 -2
- package/lib/components/handler.d.ts +1 -0
- package/lib/components/handler.js +17 -0
- package/package.json +79 -79
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 socram03
|
|
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
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 socram03
|
|
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
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
<div align='center'>
|
|
2
|
-
<img src="./assets/icon.png" alt="seyfert" width="200px" />
|
|
3
|
-
|
|
4
|
-
**Seyfert is a brand-new Discord framework to take the bot development to a next level**
|
|
5
|
-
|
|
6
|
-
[](https://github.com/tiramisulabs/seyfert/blob/main/LICENSE)
|
|
7
|
-
[](https://www.npmjs.com/package/seyfert)
|
|
8
|
-
[](https://discord.com/invite/XNw2RZFzaP)
|
|
9
|
-
|
|
10
|
-
</div>
|
|
11
|
-
|
|
12
|
-
## FAQ
|
|
13
|
-
### So, what is `seyfert`?
|
|
14
|
-
Seyfert is the ultimate Discord framework! We make it easy to interact with the Discord API, big cache control, scalable code and a pretty dev experience.
|
|
15
|
-
|
|
16
|
-
### Why should I use it?
|
|
17
|
-
There are many reasons to use Seyfert, but they dont all fit in this tiny readme, so here is a list of the most awesome reasons!
|
|
18
|
-
|
|
19
|
-
- **Low RAM Usage**
|
|
20
|
-
- **Latest features**
|
|
21
|
-
- **Dev experience**
|
|
22
|
-
- **24/6 support (Sunday is for church)**
|
|
23
|
-
- **Written from Scratch**
|
|
24
|
-
- **Type-safe**
|
|
25
|
-
- **And many more!!**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
## Installation
|
|
29
|
-
> [!NOTE]
|
|
30
|
-
> Node v18>= is required (or v16 with `--experimental-fetch` flag), Bun/Node LTS recommended.
|
|
31
|
-
|
|
32
|
-
```sh
|
|
33
|
-
pnpm add seyfert
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
```sh
|
|
37
|
-
deno add npm:seyfert
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
```sh
|
|
41
|
-
bun add seyfert
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
```sh
|
|
45
|
-
npm i seyfert
|
|
46
|
-
```
|
|
47
|
-
> Or other package manager.
|
|
48
|
-
|
|
49
|
-
## Contributing
|
|
50
|
-
We are open to contributions, fork the repo and make your changes!
|
|
51
|
-
|
|
52
|
-
## Useful links
|
|
53
|
-
|
|
54
|
-
- [GitHub Repository](https://github.com/tiramisulabs/seyfert)
|
|
55
|
-
- [Discord server](https://discord.com/invite/XNw2RZFzaP)
|
|
56
|
-
- [npm - core](https://www.npmjs.com/package/seyfert)
|
|
57
|
-
- [Website](https://seyfert.dev)
|
|
58
|
-
- [Documentation](https://docs.seyfert.dev)
|
|
59
|
-
|
|
60
|
-

|
|
1
|
+
<div align='center'>
|
|
2
|
+
<img src="./assets/icon.png" alt="seyfert" width="200px" />
|
|
3
|
+
|
|
4
|
+
**Seyfert is a brand-new Discord framework to take the bot development to a next level**
|
|
5
|
+
|
|
6
|
+
[](https://github.com/tiramisulabs/seyfert/blob/main/LICENSE)
|
|
7
|
+
[](https://www.npmjs.com/package/seyfert)
|
|
8
|
+
[](https://discord.com/invite/XNw2RZFzaP)
|
|
9
|
+
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
## FAQ
|
|
13
|
+
### So, what is `seyfert`?
|
|
14
|
+
Seyfert is the ultimate Discord framework! We make it easy to interact with the Discord API, big cache control, scalable code and a pretty dev experience.
|
|
15
|
+
|
|
16
|
+
### Why should I use it?
|
|
17
|
+
There are many reasons to use Seyfert, but they dont all fit in this tiny readme, so here is a list of the most awesome reasons!
|
|
18
|
+
|
|
19
|
+
- **Low RAM Usage**
|
|
20
|
+
- **Latest features**
|
|
21
|
+
- **Dev experience**
|
|
22
|
+
- **24/6 support (Sunday is for church)**
|
|
23
|
+
- **Written from Scratch**
|
|
24
|
+
- **Type-safe**
|
|
25
|
+
- **And many more!!**
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
> [!NOTE]
|
|
30
|
+
> Node v18>= is required (or v16 with `--experimental-fetch` flag), Bun/Node LTS recommended.
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
pnpm add seyfert
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
deno add npm:seyfert
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
bun add seyfert
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
npm i seyfert
|
|
46
|
+
```
|
|
47
|
+
> Or other package manager.
|
|
48
|
+
|
|
49
|
+
## Contributing
|
|
50
|
+
We are open to contributions, fork the repo and make your changes!
|
|
51
|
+
|
|
52
|
+
## Useful links
|
|
53
|
+
|
|
54
|
+
- [GitHub Repository](https://github.com/tiramisulabs/seyfert)
|
|
55
|
+
- [Discord server](https://discord.com/invite/XNw2RZFzaP)
|
|
56
|
+
- [npm - core](https://www.npmjs.com/package/seyfert)
|
|
57
|
+
- [Website](https://seyfert.dev)
|
|
58
|
+
- [Documentation](https://docs.seyfert.dev)
|
|
59
|
+
|
|
60
|
+

|
|
@@ -10,7 +10,7 @@ export interface ComponentCommand {
|
|
|
10
10
|
export declare abstract class ComponentCommand {
|
|
11
11
|
type: 0;
|
|
12
12
|
abstract componentType: keyof ContextComponentCommandInteractionMap;
|
|
13
|
-
customId?: string;
|
|
13
|
+
customId?: string | RegExp;
|
|
14
14
|
filter?(context: ComponentContext<typeof this.componentType>): Promise<boolean> | boolean;
|
|
15
15
|
abstract run(context: ComponentContext<typeof this.componentType>): any;
|
|
16
16
|
middlewares: (keyof RegisteredMiddlewares)[];
|
|
@@ -11,8 +11,11 @@ class ComponentCommand {
|
|
|
11
11
|
customId;
|
|
12
12
|
/** @internal */
|
|
13
13
|
_filter(context) {
|
|
14
|
-
if (this.customId
|
|
15
|
-
|
|
14
|
+
if (this.customId) {
|
|
15
|
+
const matches = typeof this.customId === 'string' ? this.customId === context.customId : context.customId.match(this.customId);
|
|
16
|
+
if (!matches)
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
16
19
|
if (this.filter)
|
|
17
20
|
return this.filter(context);
|
|
18
21
|
return true;
|
|
@@ -29,6 +29,7 @@ export type ComponentCommands = ComponentCommand | ModalCommand;
|
|
|
29
29
|
export interface CreateComponentCollectorResult {
|
|
30
30
|
run<T extends CollectorInteraction = CollectorInteraction>(customId: UserMatches, callback: ComponentCallback<T>): void;
|
|
31
31
|
stop(reason?: string): void;
|
|
32
|
+
waitFor<T extends CollectorInteraction = CollectorInteraction>(customId: UserMatches): Promise<T | null>;
|
|
32
33
|
resetTimeouts(): void;
|
|
33
34
|
}
|
|
34
35
|
export declare class ComponentHandler extends BaseHandler {
|
|
@@ -73,6 +73,23 @@ class ComponentHandler extends common_1.BaseHandler {
|
|
|
73
73
|
this.createComponentCollector(messageId, channelId, guildId, options, old.components);
|
|
74
74
|
});
|
|
75
75
|
},
|
|
76
|
+
waitFor: customId => new Promise(resolve => {
|
|
77
|
+
const collector = this.values.get(messageId);
|
|
78
|
+
if (!collector)
|
|
79
|
+
return resolve(null);
|
|
80
|
+
this.values.get(messageId).__run(customId, interaction => {
|
|
81
|
+
this.clearValue(messageId);
|
|
82
|
+
//@ts-expect-error generic
|
|
83
|
+
resolve(interaction);
|
|
84
|
+
});
|
|
85
|
+
if (collector?.timeout)
|
|
86
|
+
clearTimeout(collector.timeout);
|
|
87
|
+
collector.timeout = setTimeout(() => {
|
|
88
|
+
this.clearValue(messageId);
|
|
89
|
+
resolve(null);
|
|
90
|
+
// by default 15 seconds in case user don't do anything
|
|
91
|
+
}, collector?.options?.timeout ?? 15_000);
|
|
92
|
+
}),
|
|
76
93
|
resetTimeouts: () => {
|
|
77
94
|
this.resetTimeouts(messageId);
|
|
78
95
|
},
|
package/package.json
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "seyfert",
|
|
3
|
-
"version": "3.2.0",
|
|
4
|
-
"description": "The most advanced framework for discord bots",
|
|
5
|
-
"main": "./lib/index.js",
|
|
6
|
-
"module": "./lib/index.js",
|
|
7
|
-
"types": "./lib/index.d.ts",
|
|
8
|
-
"files": [
|
|
9
|
-
"lib/**"
|
|
10
|
-
],
|
|
11
|
-
"scripts": {
|
|
12
|
-
"build": "tsc --outDir ./lib",
|
|
13
|
-
"prepublishOnly": "npm run build",
|
|
14
|
-
"prepare": "npm run build && husky",
|
|
15
|
-
"lint": "biome lint --write ./src",
|
|
16
|
-
"format": "biome format --write ./src",
|
|
17
|
-
"check-h": "biome check --write ./src",
|
|
18
|
-
"check": "biome check --verbose --write --no-errors-on-unmatched ./src",
|
|
19
|
-
"test": "vitest run --config ./tests/vitest.config.mts ./tests/"
|
|
20
|
-
},
|
|
21
|
-
"author": "MARCROCK22",
|
|
22
|
-
"license": "MIT",
|
|
23
|
-
"devDependencies": {
|
|
24
|
-
"@biomejs/biome": "1.9.4",
|
|
25
|
-
"@changesets/cli": "^2.29.4",
|
|
26
|
-
"@commitlint/cli": "^19.8.1",
|
|
27
|
-
"@commitlint/config-conventional": "^19.8.1",
|
|
28
|
-
"@types/node": "^24.0.1",
|
|
29
|
-
"husky": "^9.1.7",
|
|
30
|
-
"lint-staged": "^15.5.1",
|
|
31
|
-
"typescript": "^5.8.3",
|
|
32
|
-
"vitest": "^3.2.3"
|
|
33
|
-
},
|
|
34
|
-
"homepage": "https://seyfert.dev",
|
|
35
|
-
"repository": {
|
|
36
|
-
"type": "git",
|
|
37
|
-
"url": "git+https://github.com/tiramisulabs/seyfert.git"
|
|
38
|
-
},
|
|
39
|
-
"bugs": {
|
|
40
|
-
"url": "https://github.com/tiramisulabs/seyfert"
|
|
41
|
-
},
|
|
42
|
-
"keywords": [
|
|
43
|
-
"api",
|
|
44
|
-
"discord",
|
|
45
|
-
"bots",
|
|
46
|
-
"typescript",
|
|
47
|
-
"botdev"
|
|
48
|
-
],
|
|
49
|
-
"publishConfig": {
|
|
50
|
-
"access": "public"
|
|
51
|
-
},
|
|
52
|
-
"maintainers": [
|
|
53
|
-
{
|
|
54
|
-
"name": "socram03",
|
|
55
|
-
"url": "https://github.com/socram03"
|
|
56
|
-
}
|
|
57
|
-
],
|
|
58
|
-
"contributors": [
|
|
59
|
-
{
|
|
60
|
-
"name": "Free 公園",
|
|
61
|
-
"url": "https://github.com/FreeAoi"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"name": "David",
|
|
65
|
-
"url": "https://github.com/Drylozu"
|
|
66
|
-
}
|
|
67
|
-
],
|
|
68
|
-
"lint-staged": {
|
|
69
|
-
"*.ts": [
|
|
70
|
-
"biome check --write"
|
|
71
|
-
]
|
|
72
|
-
},
|
|
73
|
-
"pnpm": {
|
|
74
|
-
"onlyBuiltDependencies": [
|
|
75
|
-
"@biomejs/biome",
|
|
76
|
-
"esbuild"
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "seyfert",
|
|
3
|
+
"version": "3.2.1-dev-15657234528.0",
|
|
4
|
+
"description": "The most advanced framework for discord bots",
|
|
5
|
+
"main": "./lib/index.js",
|
|
6
|
+
"module": "./lib/index.js",
|
|
7
|
+
"types": "./lib/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"lib/**"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc --outDir ./lib",
|
|
13
|
+
"prepublishOnly": "npm run build",
|
|
14
|
+
"prepare": "npm run build && husky",
|
|
15
|
+
"lint": "biome lint --write ./src",
|
|
16
|
+
"format": "biome format --write ./src",
|
|
17
|
+
"check-h": "biome check --write ./src",
|
|
18
|
+
"check": "biome check --verbose --write --no-errors-on-unmatched ./src",
|
|
19
|
+
"test": "vitest run --config ./tests/vitest.config.mts ./tests/"
|
|
20
|
+
},
|
|
21
|
+
"author": "MARCROCK22",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@biomejs/biome": "1.9.4",
|
|
25
|
+
"@changesets/cli": "^2.29.4",
|
|
26
|
+
"@commitlint/cli": "^19.8.1",
|
|
27
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
28
|
+
"@types/node": "^24.0.1",
|
|
29
|
+
"husky": "^9.1.7",
|
|
30
|
+
"lint-staged": "^15.5.1",
|
|
31
|
+
"typescript": "^5.8.3",
|
|
32
|
+
"vitest": "^3.2.3"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://seyfert.dev",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "git+https://github.com/tiramisulabs/seyfert.git"
|
|
38
|
+
},
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/tiramisulabs/seyfert"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"api",
|
|
44
|
+
"discord",
|
|
45
|
+
"bots",
|
|
46
|
+
"typescript",
|
|
47
|
+
"botdev"
|
|
48
|
+
],
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
51
|
+
},
|
|
52
|
+
"maintainers": [
|
|
53
|
+
{
|
|
54
|
+
"name": "socram03",
|
|
55
|
+
"url": "https://github.com/socram03"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"contributors": [
|
|
59
|
+
{
|
|
60
|
+
"name": "Free 公園",
|
|
61
|
+
"url": "https://github.com/FreeAoi"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "David",
|
|
65
|
+
"url": "https://github.com/Drylozu"
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"lint-staged": {
|
|
69
|
+
"*.ts": [
|
|
70
|
+
"biome check --write"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
"pnpm": {
|
|
74
|
+
"onlyBuiltDependencies": [
|
|
75
|
+
"@biomejs/biome",
|
|
76
|
+
"esbuild"
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
}
|