Skip to content

Commit

Permalink
Add developments list menu
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantGeekDev committed Jan 5, 2024
1 parent 94788ca commit a89d1c6
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/config/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { getOrCreateChat } from "../services/chat.service.js";
import { propertiesController } from "../controllers/properties.js";
import { fileIdController } from "../controllers/fileId.js";
import { contactSalesController } from "../controllers/contactSales.js";
import { developmentsController } from "../controllers/developments.js";

function extendContext(bot: Bot, database: Database) {
bot.use(async (ctx, next) => {
Expand Down Expand Up @@ -59,6 +60,7 @@ function setupControllers(bot: Bot) {
bot.use(propertiesController);
bot.use(fileIdController);
bot.use(contactSalesController);
bot.use(developmentsController);
}

export async function startBot(database: Database) {
Expand Down
35 changes: 35 additions & 0 deletions src/controllers/developments.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Composer } from "grammy";
import type { CustomContext } from "../types/context.js";
import { developmentsMenu } from "../menus/developmentsMenu.js";

export const developmentsController = new Composer<CustomContext>();
developmentsController.callbackQuery("view-developments", async ctx => {
ctx.answerCallbackQuery();
await ctx.reply("Please select the development", {
reply_markup: developmentsMenu
});
});

developmentsController.callbackQuery(
"view-development:salisol-resort",
async ctx => {
ctx.answerCallbackQuery();
await ctx.reply("SaliSol Resort Selected");
}
);

developmentsController.callbackQuery(
"view-development:salisol-hills",
async ctx => {
ctx.answerCallbackQuery();
await ctx.reply("SaliSol Hills Selected");
}
);

developmentsController.callbackQuery(
"view-development:salisol-golf",
async ctx => {
ctx.answerCallbackQuery();
await ctx.reply("SaliSol Golf Selected");
}
);
11 changes: 11 additions & 0 deletions src/menus/developmentsMenu.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { InlineKeyboard } from "grammy";

export const developmentsMenu = new InlineKeyboard()
.text(
"🏠 SaliSol Resort - Guardamar, Spain",
"view-development:salisol-resort"
)
.row()
.text("🏔️ SaliSol Hills - Benidorm, Spain", "view-development:salisol-hills")
.row()
.text("⛳ SaliSol Golf - Benidorm, Spain", "view-development:salisol-golf");

0 comments on commit a89d1c6

Please sign in to comment.