discord-self-lite 0.1.2 → 0.1.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 +17 -0
- package/package.json +1 -1
- package/src/classes/Guild.js +5 -1
- package/src/classes/Message.js +8 -0
- package/src/connection/rest/RestManager.js +1 -1
package/README.md
CHANGED
|
@@ -103,6 +103,7 @@ const client = new Client();
|
|
|
103
103
|
- `message.content` - Message content
|
|
104
104
|
- `message.author` - Message author
|
|
105
105
|
- `message.channel` - Message channel
|
|
106
|
+
- `message.guild` - Message guild (null for DMs)
|
|
106
107
|
- `message.components` - Message components (buttons, etc.)
|
|
107
108
|
|
|
108
109
|
### Channel
|
|
@@ -118,6 +119,22 @@ const client = new Client();
|
|
|
118
119
|
- `channel.name` - Channel name
|
|
119
120
|
- `channel.type` - Channel type
|
|
120
121
|
|
|
122
|
+
### Guild
|
|
123
|
+
|
|
124
|
+
#### Methods
|
|
125
|
+
|
|
126
|
+
- `guild.getChannels()` - Get cached channels for this guild
|
|
127
|
+
- `guild.fetchChannels()` - Fetch all channels for this guild from API
|
|
128
|
+
- `guild.getChannel(channelId)` - Get a specific channel from cache
|
|
129
|
+
- `guild.fetchChannel(channelId)` - Fetch a specific channel from API
|
|
130
|
+
|
|
131
|
+
#### Properties
|
|
132
|
+
|
|
133
|
+
- `guild.id` - Guild ID
|
|
134
|
+
- `guild.name` - Guild name
|
|
135
|
+
- `guild.icon` - Guild icon hash
|
|
136
|
+
- `guild.ownerId` - Guild owner ID
|
|
137
|
+
|
|
121
138
|
### WebhookClient
|
|
122
139
|
|
|
123
140
|
Send messages to Discord webhooks with support for embeds and more.
|
package/package.json
CHANGED
package/src/classes/Guild.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const Channel = require("./Channel");
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Represents a Discord guild (server)
|
|
3
5
|
*/
|
|
@@ -79,7 +81,9 @@ class Guild {
|
|
|
79
81
|
const data = await this.rest.fetchChannels(this.id);
|
|
80
82
|
const channels = [];
|
|
81
83
|
for (const channelData of data) {
|
|
82
|
-
|
|
84
|
+
// Create channel with full data and cache it
|
|
85
|
+
const channel = new Channel(this.client, this.rest, channelData);
|
|
86
|
+
this.client.channels.set(channelData.id, channel);
|
|
83
87
|
channels.push(channel);
|
|
84
88
|
}
|
|
85
89
|
return channels;
|
package/src/classes/Message.js
CHANGED
|
@@ -36,6 +36,14 @@ class Message {
|
|
|
36
36
|
return this.client.getChannel(this.channelId);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Get the guild this message was sent in
|
|
41
|
+
* @returns {Guild|null} The guild instance, or null if message was sent in DM
|
|
42
|
+
*/
|
|
43
|
+
get guild() {
|
|
44
|
+
return this.guildId ? this.client.getGuild(this.guildId) : null;
|
|
45
|
+
}
|
|
46
|
+
|
|
39
47
|
/**
|
|
40
48
|
* Reply to this message
|
|
41
49
|
* @param {string|object} payload - Message content or payload object
|
|
@@ -312,7 +312,7 @@ class RestManager {
|
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
/**
|
|
315
|
-
* Click a button on a message
|
|
315
|
+
* Click a button on a message (interaction)
|
|
316
316
|
* @param {string} channelId - The channel ID
|
|
317
317
|
* @param {string} messageId - The message ID
|
|
318
318
|
* @param {string} applicationId - The application ID
|