disgroove 0.0.2 → 0.0.3
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/README.md +50 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# disgroove
|
|
2
|
+
|
|
3
|
+
An NPM package to interact with the Discord API
|
|
4
|
+
|
|
5
|
+
## Getting started
|
|
6
|
+
|
|
7
|
+
- Install the package
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
npm install disgroove
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
- Import the package
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
const { Client, GatewayIntents } = require("discord.js");
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
- Create the client
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
const client = new Client("token", {
|
|
23
|
+
intents: GatewayIntents.AllNonPrivileged,
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Example
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
const { Client, GatewayIntents, GatewayEvents } = require("disgroove");
|
|
31
|
+
const client = new Client("token", {
|
|
32
|
+
intents: GatewayIntents.AllNonPrivileged,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
client.on(GatewayEvents.Ready, async () => {
|
|
36
|
+
const user = await client.getUser();
|
|
37
|
+
|
|
38
|
+
console.log(`${user.username} is ready`);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
client.on(GatewayEvents.MessageCreate, async (message) => {
|
|
42
|
+
if (message.content === "!ping") {
|
|
43
|
+
const channel = await client.getChannel(message.channelId);
|
|
44
|
+
|
|
45
|
+
await channel.createMessage({
|
|
46
|
+
content: "Pong! �",
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
```
|