You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 24, 2025. It is now read-only.
BPAPI allows you to retrieve and work with information from [BDFD](https://botdesignerdiscord.com)[Public API](https://nilpointer-software.github.io/bdfd-wiki/nightly/resources/api.html) more easier.
10
+
BPAPI allows you to work with [BDFD](https://botdesignerdiscord.com)[Public API](https://nilpointer-software.github.io/bdfd-wiki/nightly/resources/api.html) more easier and pretty!
11
+
12
+
</div>
13
+
8
14
9
15
# Install
10
16
```sh
@@ -22,7 +28,7 @@ To get started, you should import/require BPAPI:
@@ -31,191 +37,96 @@ To get started, you should import/require BPAPI:
31
37
```ts
32
38
import { functionInfo } from "@nightnutsky/bpapi";
33
39
```
34
-
## Code Examples
35
-
36
-
### functionInfo()
37
-
```js
38
-
/**
39
-
*
40
-
* @param functionTag A tag (i.e `$addButton[]`, `$nomention`) of the function. Supports non-completed tags (i.e `$addBu` will be represented as `$addButton[]`)
41
-
* @returns A promise containing information about the specified function. If could't find the function, `undefined` is returned.
someFunction(RESPONSE.Success, `The function with the \`${tag}\` tag has the following description: \`${description}\` and requires ${intents} intents.`);
50
53
} else {
51
-
console.log('Could not find the specified function!')
54
+
someFunction(RESPONSE.Fail, 'Could not find the function!');
52
55
}
53
56
});
54
57
```
55
58
56
-
### functionList()
57
-
```js
58
-
/**
59
-
*
60
-
* @returns A promise containing an array of functions with their information
61
-
*/
62
-
functionList().then(list => {
63
-
console.log('Functions That Require Intents:');
64
-
for (const functionInfo of list) {
65
-
if (functionInfo.intents != 'None') {
66
-
const tag = functionInfo.tag,
67
-
intents = functionInfo.intents;
68
-
69
-
console.log(`${tag}: ${intents} Intent`);
70
-
}
71
-
}
72
-
});
73
-
```
59
+
### BDFD Callbacks
74
60
75
-
### functionTagList()
76
-
```js
77
-
/**
78
-
*
79
-
* @returns A promise containing an array of function tags
someFunction(RESPONSE.Success, `The callback with the \`${name}\` name ${premium} premium hosting time.`);
69
+
} else {
70
+
someFunction(RESPONSE.Fail, 'Could not find the callback!');
87
71
}
88
72
});
89
73
```
74
+
90
75
## TypeScript Specials
91
76
If you ever worked with TypeScript, then you know that you can (and sometimes must) assign types for your consts, etc.
92
77
93
-
If you want to work with plain BDFD Public API, for example, do request to the `api/function_list` endpoint yourself, BPAPI can help you using one of its type -`PublicAPIResponse`.\
94
-
Import this type and assign it to the request's response.
95
-
96
-
> Original BDFD Public API's response is a bit different and contains unused or deprecated (and now unused) properties. UnlikeBDFD Public API, BPAPI only shows actual and a bit modified properties for your comfort.
0 commit comments