mirror of
https://github.com/System-End/slack-end.git
synced 2026-04-20 00:25:23 +00:00
enhancement(lint): Fix lint errors for src/commands/you_cant_join.ts
Co-authored-by: NeonGamerBot-QK <neon@saahild.com> Signed-off-by: zeon-neon[bot] <136533918+zeon-neon[bot]@users.noreply.github.com>
This commit is contained in:
parent
1a37bddcb5
commit
bff48b5439
1 changed files with 47 additions and 44 deletions
|
|
@ -2,49 +2,52 @@
|
|||
import { Command } from "../modules/BaseCommand";
|
||||
import { ModifiedApp } from "../modules/slackapp";
|
||||
|
||||
const dev_ch_id = "C083C2ABX4K"
|
||||
const dev_ch_id = "C083C2ABX4K";
|
||||
export default class UserJoinEvent implements Command {
|
||||
name: string;
|
||||
description: string;
|
||||
is_event?: boolean;
|
||||
constructor() {
|
||||
this.name = `member_joined_channel`;
|
||||
this.description = `User no join channel `;
|
||||
this.is_event = true;
|
||||
}
|
||||
run(app: ModifiedApp) {
|
||||
let prod_channel_id = null;
|
||||
// app.command()
|
||||
app.event(this.name, async ({ event, say }) => {
|
||||
console.debug(event, "#userjoin");
|
||||
//@ts-ignore
|
||||
const { user, channel } = event;
|
||||
if(!prod_channel_id) {
|
||||
const channelInfo = await app.client.conversations.info({
|
||||
channel: channel,
|
||||
});
|
||||
|
||||
const channelName = channelInfo.channel.name;
|
||||
//@ts-ignore
|
||||
if (event.channel !== dev_ch_id && channelName !== "u-cant-join-this-channel") return;
|
||||
prod_channel_id = channelInfo.channel.id;
|
||||
} else {
|
||||
if (event.channel !== prod_channel_id) return;
|
||||
}
|
||||
|
||||
//@ts-ignore
|
||||
await app.client.conversations.kick({
|
||||
channel: channel,
|
||||
users: user,
|
||||
});
|
||||
//@ts-ignore
|
||||
await app.client.chat.postMessage({
|
||||
//@ts-ignore
|
||||
channel,
|
||||
//@ts-ignore
|
||||
text: `You cant join <@${user}>`
|
||||
})
|
||||
});
|
||||
}
|
||||
name: string;
|
||||
description: string;
|
||||
is_event?: boolean;
|
||||
constructor() {
|
||||
this.name = `member_joined_channel`;
|
||||
this.description = `User no join channel `;
|
||||
this.is_event = true;
|
||||
}
|
||||
|
||||
run(app: ModifiedApp) {
|
||||
let prod_channel_id = null;
|
||||
// app.command()
|
||||
app.event(this.name, async ({ event, say }) => {
|
||||
console.debug(event, "#userjoin");
|
||||
//@ts-ignore
|
||||
const { user, channel } = event;
|
||||
if (!prod_channel_id) {
|
||||
const channelInfo = await app.client.conversations.info({
|
||||
channel: channel,
|
||||
});
|
||||
|
||||
const channelName = channelInfo.channel.name;
|
||||
//@ts-ignore
|
||||
if (
|
||||
event.channel !== dev_ch_id &&
|
||||
channelName !== "u-cant-join-this-channel"
|
||||
)
|
||||
return;
|
||||
prod_channel_id = channelInfo.channel.id;
|
||||
} else {
|
||||
if (event.channel !== prod_channel_id) return;
|
||||
}
|
||||
|
||||
//@ts-ignore
|
||||
await app.client.conversations.kick({
|
||||
channel: channel,
|
||||
users: user,
|
||||
});
|
||||
//@ts-ignore
|
||||
await app.client.chat.postMessage({
|
||||
//@ts-ignore
|
||||
channel,
|
||||
//@ts-ignore
|
||||
text: `You cant join <@${user}>`,
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue