bostrot / telegram-support-bot

A Telegram ticketing/supporting system.
https://botspace.bostrot.com
GNU General Public License v3.0
426 stars 151 forks source link

Editing the response message to the user #117

Closed IN80 closed 1 year ago

IN80 commented 1 year ago

Hello. In the file /src/users.ts I found the function autoReply

/** Ticket auto reply for common questions
 * @param {context} ctx Bot context.
 * @param {bot} bot Bot object.
 * @param {chat} chat Bot chat.
 * @return {boolean}
 */
function autoReply(ctx: Context) {
  const strings = cache.config.autoreply;
  for (const i in strings) {
    if (ctx.message.text.toString().indexOf(strings[i]['question']) > -1) {
      // Define message
      const msg =
        `${cache.config.language.dear} ` +
        `${ctx.message.from.first_name},\n\n` +
        `${strings[i]['answer']}\n\n` +
        `${cache.config.language.regards}\n` +
        `${cache.config.language.automatedReplyAuthor}\n\n` +
        `_${cache.config.language.automatedReply}_`;

      // Send message with keyboard
      middleware.reply(ctx, msg, {parse_mode: cache.config.parse_mode});
      return true;
    }
  }
  return false;
}

She replies to any message from the user, right? I edit it, but nothing changes.

I want to change the signature. Make sure that the answer is not from a person, but from a group.