Advertisement
unidev01

Untitled

Feb 26th, 2024
979
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. export const markupGreeterMessage = new Menu('markupGreeterMessage');
  2.  
  3.  const notifications = new Set<number>();
  4.  
  5.     function toggleNotifications(id: number) {
  6.       if (!notifications.delete(id)) notifications.add(id);
  7.     }
  8.  
  9.     markupGreeterMessage.text(
  10.       (ctx) => (ctx.from && notifications.has(ctx.from.id) ? '🔔' : '🔕'),
  11.       (ctx) => {
  12.         toggleNotifications(ctx.from.id);
  13.         ctx.menu.update();
  14.       }
  15.     );
  16.  
  17.  const greeterMessage = `...`;
  18.  
  19.       ...
  20.       await <save DB>.then(
  21.         async () =>
  22.           await ctx.reply(greeterMessage, {
  23.             reply_markup: markupGreeterMessage,
  24.           })
  25.       );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement