From 4c6080b3fafc65cc7f5e254f74b2316e652f97ed Mon Sep 17 00:00:00 2001 From: 0xCA Date: Mon, 13 Nov 2023 16:49:05 +0500 Subject: [PATCH] Telegram support, send config button --- custom/js/helper.js | 12 ++++- go.mod | 1 + go.sum | 2 + handler/routes.go | 52 ++++++++++++++++++ main.go | 62 ++++++++++++++++------ telegram/bot.go | 116 +++++++++++++++++++++++++++++++++++++++++ templates/clients.html | 106 +++++++++++++++++++++++++++++++++++++ util/util.go | 3 +- 8 files changed, 335 insertions(+), 19 deletions(-) create mode 100644 telegram/bot.go diff --git a/custom/js/helper.js b/custom/js/helper.js index 4f21c1c..9f0b91b 100644 --- a/custom/js/helper.js +++ b/custom/js/helper.js @@ -1,5 +1,15 @@ function renderClientList(data) { $.each(data, function(index, obj) { + // render telegram button + let telegramButton = '' + if (obj.Client.telegram_userid) { + telegramButton = `
+ +
` + } + // render client status css tag style let clientStatusHtml = '>' if (obj.Client.enabled) { @@ -43,7 +53,7 @@ function renderClientList(data) { data-target="#modal_email_client" data-clientid="${obj.Client.id}" data-clientname="${obj.Client.name}">Email - + ${telegramButton}
+
+
+ + +
+ + + + + + +