mirror of
https://github.com/System-End/slack-end.git
synced 2026-04-19 22:05:10 +00:00
enhancement(lint): Fix lint errors for src/index.ts
Co-authored-by: NeonGamerBot-QK <saahilattud@gmail.com> Signed-off-by: zeon-neon[bot] <136533918+zeon-neon[bot]@users.noreply.github.com>
This commit is contained in:
parent
39910789bb
commit
8a9bdc41b3
1 changed files with 55 additions and 56 deletions
111
src/index.ts
111
src/index.ts
|
|
@ -1,44 +1,24 @@
|
|||
import "dotenv/config"
|
||||
import "./modules/watch-git"
|
||||
import "dotenv/config";
|
||||
import "./modules/watch-git";
|
||||
// import "./modules/smee"
|
||||
import app from './modules/slackapp'
|
||||
import { View } from "@slack/bolt"
|
||||
import app from "./modules/slackapp";
|
||||
import { View } from "@slack/bolt";
|
||||
|
||||
app.start(process.env.PORT || 3000).then((d) => {
|
||||
console.log(`App is UP (please help)`)
|
||||
})
|
||||
console.log(`App is UP (please help)`);
|
||||
});
|
||||
// this is temp i swear
|
||||
app.command('/ping',async ({ command, ack, respond }) => {
|
||||
const stamp = Date.now()
|
||||
await ack()
|
||||
respond(`Pong took: \`${Date.now() - stamp}ms\``).then(d => {
|
||||
})
|
||||
})
|
||||
app.command("/ping", async ({ command, ack, respond }) => {
|
||||
const stamp = Date.now();
|
||||
await ack();
|
||||
respond(`Pong took: \`${Date.now() - stamp}ms\``).then((d) => {});
|
||||
});
|
||||
// Listen for users opening your App Home
|
||||
app.event('app_home_opened', async ({ event, client, logger }) => {
|
||||
try {
|
||||
console.log(`USER: ${event.user}`)
|
||||
function genView():View {
|
||||
if(process.env.MY_USER_ID !== event.user) return {
|
||||
// Home tabs must be enabled in your app configuration page under "App Home"
|
||||
type: "home",
|
||||
blocks: [
|
||||
{
|
||||
type: "section",
|
||||
text: {
|
||||
type: "mrkdwn",
|
||||
text: "*Not for you <@" + event.user + "> :x: *"
|
||||
}
|
||||
},
|
||||
{
|
||||
type: "section",
|
||||
text: {
|
||||
type: "mrkdwn",
|
||||
text: "Nothing on the home page for you :P."
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
app.event("app_home_opened", async ({ event, client, logger }) => {
|
||||
try {
|
||||
console.log(`USER: ${event.user}`);
|
||||
function genView(): View {
|
||||
if (process.env.MY_USER_ID !== event.user)
|
||||
return {
|
||||
// Home tabs must be enabled in your app configuration page under "App Home"
|
||||
type: "home",
|
||||
|
|
@ -47,29 +27,48 @@ app.event('app_home_opened', async ({ event, client, logger }) => {
|
|||
type: "section",
|
||||
text: {
|
||||
type: "mrkdwn",
|
||||
text: "*Welcome home, <@" + event.user + "> :house:*"
|
||||
}
|
||||
text: "*Not for you <@" + event.user + "> :x: *",
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "section",
|
||||
text: {
|
||||
type: "mrkdwn",
|
||||
text: "Learn how home tabs can be more useful and interactive <https://api.slack.com/surfaces/tabs/using|*in the documentation*>."
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
// Call views.publish with the built-in client
|
||||
const result = await client.views.publish({
|
||||
// Use the user ID associated with the event
|
||||
user_id: event.user,
|
||||
view: genView()
|
||||
});
|
||||
|
||||
// logger.info(result);
|
||||
text: "Nothing on the home page for you :P.",
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
return {
|
||||
// Home tabs must be enabled in your app configuration page under "App Home"
|
||||
type: "home",
|
||||
blocks: [
|
||||
{
|
||||
type: "section",
|
||||
text: {
|
||||
type: "mrkdwn",
|
||||
text: "*Welcome home, <@" + event.user + "> :house:*",
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "section",
|
||||
text: {
|
||||
type: "mrkdwn",
|
||||
text: "Learn how home tabs can be more useful and interactive <https://api.slack.com/surfaces/tabs/using|*in the documentation*>.",
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
catch (error) {
|
||||
logger.error(error);
|
||||
}
|
||||
});
|
||||
// Call views.publish with the built-in client
|
||||
const result = await client.views.publish({
|
||||
// Use the user ID associated with the event
|
||||
user_id: event.user,
|
||||
view: genView(),
|
||||
});
|
||||
|
||||
// logger.info(result);
|
||||
} catch (error) {
|
||||
logger.error(error);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue