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

19 lines
688 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", async ctx => {
if (!ctx.from || !ctx.message) return
if (ctx.message.chat.type != "group"
&& ctx.message.chat.type != "supergroup") return
await 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}`)
})
}