4 Commits

Author SHA1 Message Date
d044085739 3.0.0 2019-09-18 15:11:55 +02:00
3510767a72 BREAKING CHANGE(changed main class to SlackAccount): update 2019-09-18 15:11:55 +02:00
ec17d7835e 2.0.12 2019-09-18 12:28:42 +02:00
cb072d0f6a fix(core): update 2019-09-18 12:28:41 +02:00
5 changed files with 9 additions and 9 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@mojoio/slack", "name": "@mojoio/slack",
"version": "2.0.11", "version": "3.0.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@mojoio/slack", "name": "@mojoio/slack",
"version": "2.0.11", "version": "3.0.0",
"private": false, "private": false,
"description": "slack api abstraction for the mojo.io ecosystem", "description": "slack api abstraction for the mojo.io ecosystem",
"main": "dist/index.js", "main": "dist/index.js",

View File

@ -5,11 +5,11 @@ let testQenv = new Qenv(process.cwd(), process.cwd() + '/.nogit');
import * as slackme from '../ts/index'; import * as slackme from '../ts/index';
let testSlackme: slackme.Slackme; let testSlackme: slackme.SlackAccount;
let testSlackMessage: slackme.SlackMessage; let testSlackMessage: slackme.SlackMessage;
tap.test('should create a valid slackme instance', async (tools) => { tap.test('should create a valid slackme instance', async (tools) => {
testSlackme = new slackme.Slackme(testQenv.getEnvVarOnDemand('SLACK_TOKEN')); testSlackme = new slackme.SlackAccount(testQenv.getEnvVarOnDemand('SLACK_TOKEN'));
}); });
tap.test('should send a message to Slack', async (tools) => { tap.test('should send a message to Slack', async (tools) => {
@ -57,7 +57,7 @@ tap.test('should send a message to Slack by directly calling the message', async
testSlackme testSlackme
); );
await testSlackMessage.sendToRoom('random'); await testSlackMessage.sendToRoom('random');
await tools.delayFor(5000); await tools.delayFor(1000);
await testSlackMessage.updateAndSend({ await testSlackMessage.updateAndSend({
author_name: 'GitLab CI', author_name: 'GitLab CI',
author_link: 'https://gitlab.com/', author_link: 'https://gitlab.com/',

View File

@ -1,7 +1,7 @@
import * as plugins from './slack.plugins'; import * as plugins from './slack.plugins';
import { IMessageOptions } from './slack.classes.slackmessage'; import { IMessageOptions } from './slack.classes.slackmessage';
export class Slackme { export class SlackAccount {
private postUrl = 'https://slack.com/api/chat.postMessage'; private postUrl = 'https://slack.com/api/chat.postMessage';
private updateUrl = 'https://slack.com/api/chat.update'; private updateUrl = 'https://slack.com/api/chat.update';
private slackToken: string; private slackToken: string;

View File

@ -1,5 +1,5 @@
import * as plugins from './slack.plugins'; import * as plugins from './slack.plugins';
import { Slackme } from './slack.classes.slackme'; import { SlackAccount } from './slack.classes.slackme';
export interface IAttachmentField { export interface IAttachmentField {
title: string; title: string;
@ -53,11 +53,11 @@ export interface IMessageOptions {
} }
export class SlackMessage { export class SlackMessage {
slackmeRef: Slackme; slackmeRef: SlackAccount;
messageOptions: IMessageOptions; messageOptions: IMessageOptions;
channel: string; channel: string;
ts: string; ts: string;
constructor(messageOptionsArg: IMessageOptions, slackmeArg?: Slackme) { constructor(messageOptionsArg: IMessageOptions, slackmeArg?: SlackAccount) {
if (slackmeArg) { if (slackmeArg) {
this.slackmeRef = slackmeArg; this.slackmeRef = slackmeArg;
} }