Fix fetchMessage being called with undefined id.

This commit is contained in:
Paul Makles
2021-02-06 17:40:25 +00:00
parent 15e7b569f2
commit cd79c9bd8b
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "revolt.js",
"version": "3.0.1-beta.13",
"version": "3.0.1-beta.14",
"main": "dist/index.js",
"repository": "https://gitlab.insrt.uk/revolt/revolt.js",
"author": "Paul Makles <insrt.uk>",
+1 -1
View File
@@ -12,7 +12,7 @@ export const API_VERSION = {
};
export const LIBRARY_VERSION = {
str: '3.0.1',
str: '3.0.1-beta.14',
major: 3,
minor: 0,
patch: 1
+3 -3
View File
@@ -82,9 +82,9 @@ export default abstract class Channel {
}
async sendMessage(content: string, nonce: string = ulid()) {
let res = await this.client.Axios.post(`/channels/${this.id}/messages`, { content, nonce });
let fire = !this.client.messages.has(res.data.id);
let message = await this.fetchMessage(res.data.id, res.data);
let res = await this.client.Axios.post(`/channels/${this.id}/messages`, { content, nonce }) as { data: Channels.Message };
let fire = !this.client.messages.has(res.data._id);
let message = await this.fetchMessage(res.data._id, res.data);
fire && this.client.emit('message', message);
return message;
}