fix(core): update
This commit is contained in:
@ -15,27 +15,25 @@ export class SlackAccount {
|
||||
ts?: string;
|
||||
mode: 'new' | 'threaded' | 'update';
|
||||
}) {
|
||||
|
||||
let requestBody: any = {
|
||||
channel: optionsArg.channelArg,
|
||||
text: optionsArg.messageOptions.text,
|
||||
text: optionsArg.messageOptions.text
|
||||
};
|
||||
|
||||
if (optionsArg.messageOptions.fields) {
|
||||
requestBody = {
|
||||
...requestBody,
|
||||
attachments: [{
|
||||
pretext: optionsArg.messageOptions.pretext,
|
||||
fields: optionsArg.messageOptions.fields,
|
||||
ts: optionsArg.messageOptions.ts,
|
||||
color: optionsArg.messageOptions.color
|
||||
}]
|
||||
}
|
||||
attachments: [
|
||||
{
|
||||
pretext: optionsArg.messageOptions.pretext,
|
||||
fields: optionsArg.messageOptions.fields,
|
||||
ts: optionsArg.messageOptions.ts,
|
||||
color: optionsArg.messageOptions.color
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
let postUrl = this.postUrl;
|
||||
|
||||
switch (true) {
|
||||
@ -50,8 +48,7 @@ export class SlackAccount {
|
||||
requestBody = {
|
||||
...requestBody,
|
||||
thread_ts: optionsArg.ts
|
||||
|
||||
}
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { SlackAccount } from "./slack.classes.slackaccount";
|
||||
import { SlackMessage } from "./slack.classes.slackmessage";
|
||||
import { SlackAccount } from './slack.classes.slackaccount';
|
||||
import { SlackMessage } from './slack.classes.slackmessage';
|
||||
|
||||
export class SlackLog {
|
||||
public slackAccount: SlackAccount;
|
||||
@ -8,10 +8,7 @@ export class SlackLog {
|
||||
|
||||
public completeLog = ``;
|
||||
|
||||
constructor(optionsArg: {
|
||||
slackAccount: SlackAccount;
|
||||
channelName: string;
|
||||
}) {
|
||||
constructor(optionsArg: { slackAccount: SlackAccount; channelName: string }) {
|
||||
this.slackAccount = optionsArg.slackAccount;
|
||||
this.channelName = optionsArg.channelName;
|
||||
}
|
||||
@ -23,10 +20,10 @@ export class SlackLog {
|
||||
await this.slackMessage.sendToRoom(this.channelName);
|
||||
}
|
||||
const date = new Date();
|
||||
this.completeLog += `${date.getHours()}:${date.getMinutes()}:${date.getSeconds()} - ` + logText + '\n';
|
||||
this.completeLog +=
|
||||
`${date.getHours()}:${date.getMinutes()}:${date.getSeconds()} - ` + logText + '\n';
|
||||
await this.slackMessage.updateAndSend({
|
||||
text: '```\n' + this.completeLog + '\n```'
|
||||
})
|
||||
text: '```\n' + this.completeLog + '\n```'
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ export class SlackMessage {
|
||||
|
||||
async startThread(messageOptionsArg: IMessageOptions) {
|
||||
this.messageOptions = messageOptionsArg;
|
||||
this.sendToRoom(this.channel, 'threaded')
|
||||
this.sendToRoom(this.channel, 'threaded');
|
||||
}
|
||||
|
||||
async sendToRoom(channelNameArg: string, modeArg: 'new' | 'update' | 'threaded' = 'new') {
|
||||
|
Reference in New Issue
Block a user