Skip to content

Commit 31e687e

Browse files
committed
Add emojis endpoints
1 parent 29e65bf commit 31e687e

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,19 @@ Here is the full list of available functions, check [`index.js`](./index.js).
163163
- `api.pinnedMessages(channelId)`
164164
- `api.addPin(channelId, messageId)`
165165
- `api.deletePin(channelId, messageId)`
166+
- `api.listEmojis(guildId)`
167+
- `api.getEmoji(guildId, emojiId)`
168+
- `api.createEmoji(guildId, name, image, roles)`
169+
- `api.editEmoji(guildId, emojiId, name, roles)`
170+
- `api.deleteEmoji(guildId, emojiId)`
166171
- `api.changeNick(guildId, nick)`
167172
- `api.leaveServer(guildId)`
168173
- `api.getDMs()`
169174
- `api.getUser(userId)`
175+
- `api.getCurrentUser()`
176+
- `api.editCurrentUser(username, avatar)`
177+
- `api.listCurrentUserGuilds()`
178+
- `api.listReactions(channelId, messageId, emojiUrl)`
170179
- `api.addReaction(channelId, messageId, emojiUrl)`
171180
- `api.deleteReaction(channelId, messageId, emojiUrl)`
172181
- `api.typing(channelId)`

index.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,23 @@
5353
addPin: (channelId, messageId) => apiCall(`/channels/${channelId}/pins/${messageId}`, null, 'PUT'),
5454
deletePin: (channelId, messageId) => apiCall(`/channels/${channelId}/pins/${messageId}`, null, 'DELETE'),
5555

56+
listEmojis: guildId => apiCall(`/guilds/${guildId}/emojis`),
57+
getEmoji: (guildId, emojiId) => apiCall(`/guilds/${guildId}/emojis/${emojiId}`),
58+
createEmoji: (guildId, name, image, roles) => apiCall(`/guilds/${guildId}`, { name, image, roles }, 'POST'),
59+
editEmoji: (guildId, emojiId, name, roles) => apiCall(`/guilds/${guildId}/${emojiId}`, { name, roles }, 'PATCH'),
60+
deleteEmoji: (guildId, emojiId) => apiCall(`/guilds/${guildId}/${emojiId}`, null, 'DELETE'),
61+
5662
changeNick: (guildId, nick) => apiCall(`/guilds/${guildId}/members/@me/nick`, { nick }, 'PATCH'),
5763
leaveServer: guildId => apiCall(`/users/@me/guilds/${guildId}`, null, 'DELETE'),
5864

5965
getDMs: () => apiCall(`/users/@me/channels`),
6066
getUser: userId => apiCall(`/users/${userId}`),
6167

68+
getCurrentUser: () => apiCall('/users/@me'),
69+
editCurrentUser: (username, avatar) => apiCall('/users/@me', { username, avatar }, 'PATCH'),
70+
listCurrentUserGuilds: () => apiCall('/users/@me/guilds'),
71+
72+
listReactions: (channelId, messageId, emojiUrl) => apiCall(`/channels/${channelId}/messages/${messageId}/reactions/${emojiUrl}/@me`),
6273
addReaction: (channelId, messageId, emojiUrl) => apiCall(`/channels/${channelId}/messages/${messageId}/reactions/${emojiUrl}/@me`, null, 'PUT'),
6374
deleteReaction: (channelId, messageId, emojiUrl) => apiCall(`/channels/${channelId}/messages/${messageId}/reactions/${emojiUrl}/@me`, null, 'DELETE'),
6475

@@ -78,11 +89,15 @@
7889
var cid = '' // Current channel id
7990

8091
// Call this to update `cid` and `gid` to current channel and guild id
81-
var id = () => {
92+
var id = (log = true) => {
8293
gid = window.location.href.split('/').slice(4)[0]
8394
cid = window.location.href.split('/').slice(4)[1]
95+
if (log) {
96+
console.log(`\`gid\` was set to the guild id you are currently looking at (${gid})`)
97+
console.log(`\`cid\` was set to the channel id you are currently looking at (${cid})`)
98+
}
8499
}
85-
id()
100+
id(false)
86101

87102
// Set your `Authorization` token here
88103
var authHeader = ''

0 commit comments

Comments
 (0)