-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgroup.js
71 lines (66 loc) · 2.3 KB
/
group.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
module.exports = {
command: ["groupinfo"],
help: ["groupinfo"],
tags: ["info"],
run: async (bot, { client: ctx }) => {
const chatId = ctx.chat.id;
const chatInfo = await ctx.telegram.getChat(chatId);
const admins = await ctx.telegram.getChatAdministrators(chatId);
const memberCount = await ctx.telegram.getChatMembersCount(chatId);
const chatDescription = chatInfo.description || "Tidak ada deskripsi grup.";
const createdDate = new Date(chatInfo.date * 1000).toLocaleString("en-US", {
timeZone: "UTC",
});
const chatStats = await ctx.telegram.getChatMember(chatId, bot.botInfo.id);
const isAdmin = admins.some((admin) => admin.user.id === bot.botInfo.id);
const onlineMembers = await ctx.telegram.getChatMembersCount(chatId, {
status: "online",
});
const chatPhotoUrl = await (
await ctx.telegram.getFileLink(chatInfo.photo.small_file_id)
).href;
const inlineKeyboard = {
inline_keyboard: [[{ text: "URL Grup", url: chatInfo.invite_link }]],
};
let replyMessage = `
ℹ️ [CHAT INFO]
🆔 ID: ${chatId}
📛 Group name: ${chatInfo.title}
🗳 Group type: ${chatInfo.type === "private" ? "Private" : "Public"}
🖌 Created: ${createdDate}
⚠ Group level: ${
chatStats.status === "administrator"
? chatStats.can_restrict_members
? "Superadmin"
: "Admin"
: "Member"
}
💬 Viewable messages: ${
chatStats.until_date ? chatStats.until_date : "Unlimited"
}
💬 Messages sent: ${
chatStats.user
? chatStats.user.restrictions
? chatStats.user.restrictions.view_messages
: 0
: 0
}
👥 Members: ${memberCount}
👮 Administrators: ${admins.length}
🤖 Bots: ${admins.filter((admin) => admin.user.is_bot).length}
👀 Currently online: ${onlineMembers}
🔕 Restricted users: ${
chatStats.user
? chatStats.user.restrictions
? chatStats.user.restrictions.is_member
: 0
: 0
} 🦸♂ Supergroup: ${
chatInfo.supergroup ? "Yes" : "No"
} 🗒 Description: ${chatDescription}
${isAdmin ? "👑 I am an administrator in this group." : ""}
`;
ctx.replyWithPhoto({ url: chatPhotoUrl }, { caption: replyMessage });
},
group: true,
};