-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path🔎 Search Engine.js
73 lines (61 loc) · 2.25 KB
/
🔎 Search Engine.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
function SearchEngine() {
let msg = Bot.TextContents(_G.contents).text
let sentistiveWord = 'lost found id atm item'
let ignored = "neger lost found id atm item photo obj bezi astu new and then image status date contact please you got for call inbox get yet block with phone what waiting now #call that it's contains dorm door one locker has small type applied central yellow naaf name"
let _Msg_ = `<b>Lost & Found [Database]</b>\n\n`
let toLower = msg.toLowerCase()
let toArriy = toLower.split(" ")
let matchSensitive = false
let resultmatched = false
for (let element of toArriy) {
if (sentistiveWord.match(element)) matchSensitive = true
if (ignored.includes(element)) continue;
if (element.length <= 2) continue;
_G.sheetName = 'Data'
let finder = DB().createTextFinder(element).findAll()
let result = finder.map(r => ({ value: r.getValue(), row: r.getRow(), col: r.getColumn() }));
if (result.length > 0) {
for (let dit of result) {
// console.log(dit)
let _toJson = JSON.parse(dit.value)
if (_toJson['ID']) {
let id = _toJson['ID']
let status = _toJson['status']
_Msg_ = _Msg_ + `➖ \(${status}\) ID : ${id}\n`
}
else if (_toJson['ATM']) {
let atm = _toJson['ATM']
let status = _toJson['status']
_Msg_ = _Msg_ + `➖ \(${status}\) ATM : ${atm}\n`
}
else if (_toJson['ITEM']) {
let item = _toJson['ITEM']
let status = _toJson['status']
_Msg_ = _Msg_ + `➖ \(${status}\) ID : ${item}\n`
}
}
resultmatched = true
}
}
if (resultmatched)
return Bot.sendMessage('@' + _G.Data, _Msg_ + `\n For more detail click #Search or #Bot button`, {
"inline_keyboard": [
[{
"text": "🤖 BOT",
"url": "https://t.me/lococompanybot?start="
}, {
"text": "🔎 Search ",
"switch_inline_query_current_chat": ""
}]
]
})
if (matchSensitive) //if sensetive matched
return Bot.sendMessage('@' + _G.Data, `🤖 <i>Please Register Here</i>`, {
"inline_keyboard": [
[{
"text": "🤖 BOT",
"url": "https://t.me/lococompanybot?start=reg"
}]
]
})
}