mic-bot/bot/setup_mode/init.ts

18 lines
675 B
TypeScript
Raw Normal View History

2024-10-19 10:47:33 +00:00
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}`)
})
}