style: auto format whole project
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
import findMessage from './find-message';
|
||||
import sendMessageToChannel from './send-a-message-to-channel';
|
||||
|
||||
export default [
|
||||
findMessage,
|
||||
sendMessageToChannel,
|
||||
];
|
||||
export default [findMessage, sendMessageToChannel];
|
||||
|
@@ -38,7 +38,8 @@ export default defineAction({
|
||||
type: 'dropdown' as const,
|
||||
required: false,
|
||||
value: false,
|
||||
description: 'If you choose no, this message will appear to come from you. Direct messages are always sent by bots.',
|
||||
description:
|
||||
'If you choose no, this message will appear to come from you. Direct messages are always sent by bots.',
|
||||
variables: false,
|
||||
options: [
|
||||
{
|
||||
@@ -48,8 +49,8 @@ export default defineAction({
|
||||
{
|
||||
label: 'No',
|
||||
value: false,
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Bot name',
|
||||
@@ -57,7 +58,8 @@ export default defineAction({
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
value: 'Automatisch',
|
||||
description: 'Specify the bot name which appears as a bold username above the message inside Slack. Defaults to Automatisch.',
|
||||
description:
|
||||
'Specify the bot name which appears as a bold username above the message inside Slack. Defaults to Automatisch.',
|
||||
variables: true,
|
||||
},
|
||||
{
|
||||
@@ -65,7 +67,8 @@ export default defineAction({
|
||||
key: 'botIcon',
|
||||
type: 'string' as const,
|
||||
required: false,
|
||||
description: 'Either an image url or an emoji available to your team (surrounded by :). For example, https://example.com/icon_256.png or :robot_face:',
|
||||
description:
|
||||
'Either an image url or an emoji available to your team (surrounded by :). For example, https://example.com/icon_256.png or :robot_face:',
|
||||
variables: true,
|
||||
},
|
||||
],
|
||||
|
@@ -7,7 +7,7 @@ type TData = {
|
||||
username?: string;
|
||||
icon_url?: string;
|
||||
icon_emoji?: string;
|
||||
}
|
||||
};
|
||||
|
||||
const postMessage = async ($: IGlobalVariable) => {
|
||||
const { parameters } = $.step;
|
||||
@@ -37,11 +37,9 @@ const postMessage = async ($: IGlobalVariable) => {
|
||||
sendAsBot,
|
||||
};
|
||||
|
||||
const response = await $.http.post(
|
||||
'/chat.postMessage',
|
||||
data,
|
||||
{ additionalProperties: customConfig },
|
||||
);
|
||||
const response = await $.http.post('/chat.postMessage', data, {
|
||||
additionalProperties: customConfig,
|
||||
});
|
||||
|
||||
if (response.data.ok === false) {
|
||||
throw new Error(JSON.stringify(response.data));
|
||||
|
@@ -59,4 +59,4 @@ export default async function createAuthData($: IGlobalVariable) {
|
||||
await $.auth.set({
|
||||
url,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@@ -22,14 +22,9 @@ const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
|
||||
const {
|
||||
bot_user_id: botId,
|
||||
authed_user: {
|
||||
id: userId,
|
||||
access_token: userAccessToken,
|
||||
},
|
||||
authed_user: { id: userId, access_token: userAccessToken },
|
||||
access_token: botAccessToken,
|
||||
team: {
|
||||
name: teamName,
|
||||
}
|
||||
team: { name: teamName },
|
||||
} = response.data;
|
||||
|
||||
await $.auth.set({
|
||||
@@ -44,7 +39,7 @@ const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
const currentUser = await getCurrentUser($);
|
||||
|
||||
await $.auth.set({
|
||||
screenName: `${currentUser.real_name} @ ${teamName}`
|
||||
screenName: `${currentUser.real_name} @ ${teamName}`,
|
||||
});
|
||||
};
|
||||
|
||||
|
@@ -3,9 +3,9 @@ import { TBeforeRequest } from '@automatisch/types';
|
||||
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||
const authData = $.auth.data;
|
||||
if (
|
||||
requestConfig.headers
|
||||
&& authData?.userAccessToken
|
||||
&& authData?.botAccessToken
|
||||
requestConfig.headers &&
|
||||
authData?.userAccessToken &&
|
||||
authData?.botAccessToken
|
||||
) {
|
||||
if (requestConfig.additionalProperties?.sendAsBot) {
|
||||
requestConfig.headers.Authorization = `Bearer ${authData.botAccessToken}`;
|
||||
@@ -14,7 +14,8 @@ const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||
}
|
||||
}
|
||||
|
||||
requestConfig.headers['Content-Type'] = requestConfig.headers['Content-Type'] || 'application/json; charset=utf-8';
|
||||
requestConfig.headers['Content-Type'] =
|
||||
requestConfig.headers['Content-Type'] || 'application/json; charset=utf-8';
|
||||
|
||||
return requestConfig;
|
||||
};
|
||||
|
@@ -3,7 +3,7 @@ import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||
const getCurrentUser = async ($: IGlobalVariable): Promise<IJSONObject> => {
|
||||
const params = {
|
||||
user: $.auth.data.userId as string,
|
||||
}
|
||||
};
|
||||
const response = await $.http.get('/users.info', { params });
|
||||
const currentUser = response.data.user;
|
||||
|
||||
|
Reference in New Issue
Block a user