Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
1c7268e1a3
|
|||
|
0e1fbfeb1b
|
|||
|
4530c7105d
|
|||
|
aace2e98e1
|
|||
|
f61500f3e6
|
|||
|
05e441f6a1
|
|||
|
368f297c6b
|
|||
|
5257967f88
|
|||
|
1e438ae73e
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ussd-tg-proxy",
|
||||
"version": "0.2.1",
|
||||
"version": "0.2.5",
|
||||
"description": "ussd-tg-proxy",
|
||||
"main": "src/index.js",
|
||||
"repository": "https://git.grassecon.net/grassrootseconomics/ussd-tg-proxy.git",
|
||||
|
||||
@@ -77,11 +77,7 @@ bot.on("msg:contact", async (ctx) => {
|
||||
log.debug(ctx.update, "msg:contact received");
|
||||
const contact = ctx.msg.contact;
|
||||
|
||||
if (ctx.msg.reply_to_message.from.is_bot && ctx.from.id === contact.user_id) {
|
||||
if (contact.phone_number.slice(0, 4) !== "+254") {
|
||||
return ctx.reply("Sarafu is only available in Kenya at the moment.");
|
||||
}
|
||||
|
||||
if (ctx.from.id === contact.user_id) {
|
||||
await cache.set(contact.user_id, contact.phone_number.slice(1));
|
||||
|
||||
return ctx.reply(
|
||||
@@ -89,7 +85,6 @@ bot.on("msg:contact", async (ctx) => {
|
||||
);
|
||||
}
|
||||
|
||||
log.info(ctx.update.user, "contact spoof attempted");
|
||||
return ctx.reply("Could not verify sent contact.");
|
||||
});
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ async function proxy(sessionId, phone, input = "") {
|
||||
url: config.get("USSD_ENDPOINT"),
|
||||
method: "POST",
|
||||
parse: "string",
|
||||
timeout: 3000,
|
||||
form: {
|
||||
sessionId: sessionId,
|
||||
phoneNumber: phone,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// this regex extracts ussd reply options
|
||||
const regex = /\s(\d{1,2}).\s/g;
|
||||
const regex = /\s(\d{1,2})\.\s/g;
|
||||
|
||||
// TODO: converts the text to a telegram keyboard
|
||||
function createKeyboard(input) {
|
||||
|
||||
Reference in New Issue
Block a user