mirror of
https://github.com/ION606/custom_discordjs.git
synced 2026-05-14 22:26:54 +00:00
added message reactions
This commit is contained in:
@@ -84,7 +84,7 @@ export class message extends DataManager {
|
|||||||
fail_if_not_exists: false //when sending, whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message, default true
|
fail_if_not_exists: false //when sending, whether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message, default true
|
||||||
}
|
}
|
||||||
|
|
||||||
const toSend = (typeof inp == 'string') ? {content: inp} : structuredClone(inp);
|
const toSend = (typeof inp == 'string') ? { content: inp } : structuredClone(inp);
|
||||||
toSend['message_reference'] = refObj;
|
toSend['message_reference'] = refObj;
|
||||||
|
|
||||||
if (inp.components) {
|
if (inp.components) {
|
||||||
@@ -95,24 +95,28 @@ export class message extends DataManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resolve(await this.channel.send(toSend));
|
resolve(await this.channel.send(toSend));
|
||||||
} catch(err) {
|
} catch (err) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
delete() {
|
async delete() {
|
||||||
return new Promise(async (resolve, reject) => {
|
|
||||||
try {
|
try {
|
||||||
const response = await this.client.axiosCustom.delete(`/channels/${this.channel.id}/messages/${this.id}`);
|
const response = await this.client.axiosCustom.delete(`/channels/${this.channel.id}/messages/${this.id}`);
|
||||||
|
return response.data;
|
||||||
resolve(response.data);
|
} catch (err) {
|
||||||
} catch(err) {
|
throw err;
|
||||||
reject(err);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
|
||||||
|
/**
|
||||||
|
* @param {string} reaction
|
||||||
|
*/
|
||||||
|
async react(reaction) {
|
||||||
|
this.axiosCustom.put(`/channels/${this.channel.id}/messages/${this.id}/reactions/${reaction}/@me`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -121,7 +125,7 @@ export class message extends DataManager {
|
|||||||
*/
|
*/
|
||||||
async edit(inp) {
|
async edit(inp) {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
const newMsg = (typeof inp == "string") ? {content: inp} : inp;
|
const newMsg = (typeof inp == "string") ? { content: inp } : inp;
|
||||||
|
|
||||||
if (this.components) {
|
if (this.components) {
|
||||||
newMsg.components = [];
|
newMsg.components = [];
|
||||||
@@ -156,7 +160,7 @@ export class message extends DataManager {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (k == 'channel_id') {
|
if (k == 'channel_id') {
|
||||||
this.channel = new Channel({id: msgRaw[k]}, this.guild, client);
|
this.channel = new Channel({ id: msgRaw[k] }, this.guild, client);
|
||||||
}
|
}
|
||||||
|
|
||||||
this[k] = msgRaw[k];
|
this[k] = msgRaw[k];
|
||||||
@@ -168,4 +172,4 @@ export class message extends DataManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export {messageChannelTypes} from './messageChannelTypes.js';
|
export { messageChannelTypes } from './messageChannelTypes.js';
|
||||||
Reference in New Issue
Block a user