diff --git a/config/config-sample.yaml b/config/config-sample.yaml index bec92e0..aff8efc 100644 --- a/config/config-sample.yaml +++ b/config/config-sample.yaml @@ -14,6 +14,7 @@ anonymous_tickets: true # Include userid in tickets or not anonymous_replies: true # Include staff member name in response show_auto_replied: false # Send auto replied msgs to staff chat show_user_ticket: false # Show ticket id to user +autoreply_confirmation: true # Reply with language.confirmationMessage on each incoming message signal_enabled: false # Enable/disable signal signal_number: '+12345689' # Your signal number / account @@ -37,7 +38,7 @@ language: /clear - *Staff* Closes all tickets /ban - *Staff* Ban a user from the chat /unban - *Staff* Unban a user" - contactMessage: "Thank you for contacting us. We will answer as soon as possible. " + confirmationMessage: "Thank you for contacting us. We will answer as soon as possible. " blockedSpam: 'You sent quite a number of questions in the last while. Please calm down and wait until staff reviews them.' ticket: 'Ticket' closed: 'closed' diff --git a/src/files.ts b/src/files.ts index 81452da..f411f0b 100644 --- a/src/files.ts +++ b/src/files.ts @@ -217,7 +217,7 @@ function fileHandler(type: string, bot: TelegramAddon, ctx: Context) { } // Confirmation message let message = - cache.config.language.contactMessage + + cache.config.language.confirmationMessage + (cache.config.show_user_ticket ? cache.config.language.yourTicketId + ' #T' + diff --git a/src/index.ts b/src/index.ts index d1a07d6..a73f423 100644 --- a/src/index.ts +++ b/src/index.ts @@ -33,6 +33,8 @@ function createBot() { } defaultBot = new TelegramAddon(cache.config.bot_token); } + cache.config.autoreply_confirmation = cache.config.autoreply_confirmation === undefined ? true : cache.config.autoreply_confirmation + cache.config.language.confirmationMessage = cache.config.language.confirmationMessage || cache.config.language.contactMessage // left for backward compatibility return defaultBot; } diff --git a/src/interfaces.ts b/src/interfaces.ts index 3c7bdc6..4f5d922 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -26,7 +26,8 @@ interface Language { startCommandText: string; faqCommandText: string; helpCommandText: string; - contactMessage: string; + confirmationMessage: string; + contactMessage: string; // left for backward compatibility blockedSpam: string; ticket: string; closed: string; @@ -100,6 +101,7 @@ interface Config { dev_mode: boolean; show_user_ticket: boolean; language: Language; + autoreply_confirmation: boolean; autoreply: Autoreply[]; categories: Category[]; } diff --git a/src/users.ts b/src/users.ts index 82d4008..57eb29c 100644 --- a/src/users.ts +++ b/src/users.ts @@ -91,10 +91,10 @@ function chat(ctx: Context, chat: { id: string }) { chat.id, ctx.session.groupCategory, function(ticket: { id: string }) { - if (!isAutoReply) { + if (!isAutoReply && cache.config.autoreply_confirmation) { middleware.msg( chat.id, - cache.config.language.contactMessage + '\n' + + cache.config.language.confirmationMessage + '\n' + (cache.config.show_user_ticket ? cache.config.language.ticket + ' #T' + diff --git a/test/test.ts b/test/test.ts index b1bf036..4593bfb 100644 --- a/test/test.ts +++ b/test/test.ts @@ -21,7 +21,7 @@ describe('Messages', function() { botAssert.assertMsgWildcard( 'Hello, this is some test!', expected, - lang.contactMessage, + lang.confirmationMessage, ); }); });