From b0f616fd329f760c1121b28c37acadf39fccbdfe Mon Sep 17 00:00:00 2001 From: Er2 Date: Fri, 25 Feb 2022 10:31:32 +0300 Subject: [PATCH] =?UTF-8?q?add=20=D1=85=D1=83=D0=B5=D1=85=20on=20=D1=8D?= =?UTF-8?q?=D1=85,=20start=20command?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.lua | 1 + src/cmds/start.lua | 4 ++-- src/events/message.lua | 9 +++++++++ src/locales/en.json | 3 +++ src/locales/ru.json | 3 +++ 5 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 src/events/message.lua diff --git a/config.lua b/config.lua index eead837..4bd033e 100644 --- a/config.lua +++ b/config.lua @@ -12,6 +12,7 @@ return { 'command', 'ready', 'inlineQuery', + 'message', }, parts = { 'locale', diff --git a/src/cmds/start.lua b/src/cmds/start.lua index efc2688..4dd620e 100644 --- a/src/cmds/start.lua +++ b/src/cmds/start.lua @@ -1,6 +1,6 @@ return { hide = true, run = function(C, msg) - C.api:reply(msg, 'TODO!') + C.api:reply(msg, msg.loc.msg) end -} \ No newline at end of file +} diff --git a/src/events/message.lua b/src/events/message.lua new file mode 100644 index 0000000..4235900 --- /dev/null +++ b/src/events/message.lua @@ -0,0 +1,9 @@ +return function(C, api, msg) + -- надоели эхать + if msg.text + and msg.text:match '[Ээ]+[Хх]+' then + C.api:reply(msg, msg.text + :gsub('[Ээ]+[Хх]+', 'хуех') + ,nil) + end +end diff --git a/src/locales/en.json b/src/locales/en.json index 5b58d54..4ba14c2 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -26,6 +26,9 @@ "cur": "Currency at %s:\n%s", "notf": "\nNot found: ", "prov": "\nData provided from central bank of Russia." + }, + "start": { + "msg": "Hi! I'm Computer - an open-source bot.\nIf you looking for source code: https://gitdab.com/er2/comp-tg" } } } diff --git a/src/locales/ru.json b/src/locales/ru.json index 1f72af5..18d6d7c 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -26,6 +26,9 @@ "cur": "Курс на %s:\n%s", "notf": "\nНе нашлось: ", "prov": "\nДанные предоставлены центральным банком России." + }, + "start": { + "msg": "Привет! Я Computer - бот с открытым исходным кодом.\nЕсли ты ищешь исходники: https://gitdab.com/er2/comp-tg" } } }