getChat
استفاده از متد getChat
برای دریافت اطلاعات مرتبط با چت فعلی.
ورودی ها
نام | نوع | توضیح |
---|---|---|
chat_id | string | شناسه چتی که باید اطلاعات آن بازیابی شود |
خروجی
فیلد | نوع | توضیح |
---|---|---|
chat_id | string | شناسه چت |
chat_type | ChatTypeEnum | نوع چت |
user_id | string | شناسه کاربر |
first_name | string | نام کوچک |
last_name | string | نام خانوادگی |
title | string | عنوان چت |
username | string | نام کاربری |
نحوه استفاده
const { Bot } = require("rubjs");
const bot = new Bot("YOUR_TOKEN");
bot.command("/chatInfo", async (ctx) => {
const chatInfo = await bot.getChat(ctx.chat_id);
await ctx.replay(JSON.stringify(chatInfo));
});
bot.run();