mic-bot/bot/setup_mode/init.ts

19 lines
688 B
TypeScript
Raw Permalink 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) => {
2024-10-25 17:35:12 +00:00
bot.command("getchat", async ctx => {
2024-10-19 10:47:33 +00:00
if (!ctx.from || !ctx.message) return
if (ctx.message.chat.type != "group"
&& ctx.message.chat.type != "supergroup") return
2024-10-25 17:35:12 +00:00
await ctx.deleteMessage()
2024-10-19 10:47:33 +00:00
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}`)
})
2024-10-25 17:35:12 +00:00
}