Bugsounet Coding

    • Register
    • Login
    • Search
    This Forum is now reserved to registred users!

    Solved TelegramBot custom commands

    EXT-TelegramBot
    2
    3
    80
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      eduardkfc last edited by

      Hi! I’m trying to make MMM-page-indicator working. But on telegramBot no clear(for dummy like me) instruction how to install custom command for changing pages.

      Plugin accept this: this.sendNotification(“PAGE_CHANGED”, 2);

      I don’t know how to interpret this so Telegram and that plugin can understand each other. Please i need help!

      1 Reply Last reply Reply Quote 0
      • bugsounet
        bugsounet Main Coder last edited by bugsounet

        maybe, try something like this in TB configuration with customCommands feature:

        customCommands: [
          {
            command: "pages",
            description: "Change page number",
            callback: (command, handler, self) => {
              if (handler.args) {
                var args = handler.args.split(" ")
                if (args[0] && !isNaN(args[0])) {
                  handler.reply("TEXT", "Change page number to " + args[0])
                  return self.sendNotification("PAGE_CHANGED", args[0])
                } else {
                  return handler.reply("TEXT", "invalid number page!")
                }
              }
              handler.reply("TEXT", "/pages <page number>")
            }
          }
        ]
        

        and you should discover pages commands in /commands

        syntax for /pages command is /pages <page number>
        sample: /pages 1

        1 Reply Last reply Reply Quote 0
        • E
          eduardkfc last edited by

          You’re amazing!!!Thank you!

          1 Reply Last reply Reply Quote 1
          • Topic has been marked as solved  bugsounet bugsounet 
          • First post
            Last post
          Powered by NodeBB | @bugsounet ©2022