mic-bot/bot/setup_mode/init.ts
2024-10-19 12:47:33 +02:00

18 lines
675 B
TypeScript

import { Bot } from "https://deno.land/x/grammy/mod.ts";
import { CompiledConfig } from "../../cfg/config.ts";
import { Ctx } from "../ctx.ts";
export const init = (bot: Bot<Ctx>, _: CompiledConfig) => {
bot.command("getchat", ctx => {
if (!ctx.from || !ctx.message) return
if (ctx.message.chat.type != "group"
&& ctx.message.chat.type != "supergroup") return
ctx.deleteMessage()
console.log(`Chat ${ctx.message.chat.title} ID: ${ctx.message.chat.id}`)
})
bot.command("getme", ctx => {
if (!ctx.from) return
console.log(`User ${ctx.from.first_name} ${ctx.from.last_name} ID: ${ctx.from.id}`)
})
}