feat: add message for sending post for approval

main
drendog 2024-01-24 17:14:37 +01:00
parent af0c5c3eee
commit f90e54bd75
1 changed files with 8 additions and 4 deletions

View File

@ -1,19 +1,23 @@
import { BotContext } from "../mod.ts"; import { BotContext } from "../mod.ts";
import { Conversation } from "grammy_conversations"; import { Conversation } from "grammy_conversations";
import { GROUP_ID } from "../config/mod.ts"; import { GROUP_ID } from "../config/mod.ts";
import { getPostApprovalKeyboard } from "../keyboards/vote.ts"; import { getPostApprovalKeyboard } from "../keyboards/mod.ts";
// Handler for the post conversation // Handler for the post conversation
export const post = async ( export const post = async (
conversation: Conversation<BotContext>, conversation: Conversation<BotContext>,
ctx: BotContext, ctx: BotContext,
) => { ) => {
// Start the conversation
await ctx.reply("Please send the content you'd like to post."); await ctx.reply("Please send the content you'd like to post.");
// Wait for a message response const postContext = await conversation.waitFor("message");
const postContext = await conversation.wait();
await postContext.copyMessage(GROUP_ID, { await postContext.copyMessage(GROUP_ID, {
reply_markup: getPostApprovalKeyboard(ctx.session.sessionId), reply_markup: getPostApprovalKeyboard(ctx.session.sessionId),
}); });
const { message_id } = postContext.message;
await postContext.reply("Post sent for approval", {
reply_parameters: {
message_id: message_id,
}
});
}; };