-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathErrorReply.js
More file actions
30 lines (29 loc) · 834 Bytes
/
Copy pathErrorReply.js
File metadata and controls
30 lines (29 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class ErrorReply {
constructor(app, message, deleteMessage) {
this.app = app;
this.message = message;
this.deleteMessage = deleteMessage;
}
async postEmphemeralMessage() {
let params = {
token: process.env.SLACK_BOT_TOKEN,
text: ":skull: Sorry, Open AI is down :skull:",
channel: this.message.channel,
user: this.message.user,
};
if (this.message.thread_ts) {
params.thread_ts = this.message.thread_ts;
}
if (this.deleteMessage) {
const chatDelete = await this.app.client.chat.delete({
token: process.env.SLACK_BOT_TOKEN,
channel: this.deleteMessage.channel,
ts: this.deleteMessage.ts,
});
}
const ephemeralFailureMessage = await this.app.client.chat.postEphemeral(
params
);
}
}
module.exports = ErrorReply;