Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support getWebhookMessage() #1182

Merged
merged 3 commits into from
Apr 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1679,6 +1679,7 @@ declare namespace Eris {
getUserProfile(userID: string): Promise<UserProfile>;
getVoiceRegions(guildID?: string): Promise<VoiceRegion[]>;
getWebhook(webhookID: string, token?: string): Promise<Webhook>;
getWebhookMessage(webhookID: string, token: string, messageID: string): Promise<Message<GuildTextableChannel>>;
joinVoiceChannel(channelID: string, options?: { opusOnly?: boolean; shared?: boolean }): Promise<VoiceConnection>;
kickGuildMember(guildID: string, userID: string, reason?: string): Promise<void>;
leaveGuild(guildID: string): Promise<void>;
Expand Down
11 changes: 11 additions & 0 deletions lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -2086,6 +2086,17 @@ class Client extends EventEmitter {
return this.requestHandler.request("GET", token ? Endpoints.WEBHOOK_TOKEN(webhookID, token) : Endpoints.WEBHOOK(webhookID), !token);
}

/**
* Get a webhook message
* @arg {String} webhookID The ID of the webhook
* @arg {String} token The token of the webhook
* @arg {String} messageID The message ID of a message sent by this webhook
* @returns {Promise<Message>} Resolves with a webhook message
*/
getWebhookMessage(webhookID, token, messageID) {
return this.requestHandler.request("GET", Endpoints.WEBHOOK_MESSAGE(webhookID, token, messageID), true).then((message) => new Message(message, this));
}

/**
* Join a voice channel. If joining a group call, the voice connection ID will be stored in voiceConnections as "call". Otherwise, it will be the guild ID
* @arg {String} channelID The ID of the voice channel
Expand Down