This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// URL for Telegram API functions | |
const TELEGRAM_API_URL = "https://api.telegram.org/botYOUR-TOKEN/"; | |
// Get the JSON data from the incoming POST request | |
$data = json_decode(file_get_contents("php://input"), true); | |
// Check if the message is set and is not "/start" | |
if (isset($data["message"]) && (!isset($data["message"]["text"]) || $data["message"]["text"] !== "/start")) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function timeDecompose(s, toString) { | |
toString = Boolean(toString) || false; | |
s = Number(s); | |
var time = {}; | |
time.year = Math.floor(s / 3.154e7); | |
time.month = Math.floor(s % 3.154e7 / 2.628e6); | |
time.day = Math.floor(s % 3.154e7 % 2.628e6 / 86400); | |
time.hour = Math.floor(s % 3.154e7 % 2.628e6 % 86400 / 3600); | |
time.minute = Math.floor(s % 3.154e7 % 2.628e6 % 86400 % 3600 / 60); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// m: 1-12 | |
// d: 1-31 | |
const q2j = (y, m, d) => { | |
let result = (((y - 1) + (m - 1) / 12) * 354.3670 + d + 119) / 365.2422 | |
result = result.toString().split('.') | |
y = +result[0] + 1 | |
d = +(('0.' + result[1]) * 365.2422).toString().split('.')[0] | |
if (d > 186) { | |
d = d - 186 | |
m = parseInt(d / 30) + (d % 30 ? 7 : 6) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// m: 1-12 | |
// d: 1-31 | |
const j2q = (y, m, d) => { | |
d = m > 6 ? (6 * 31) + ((m - 7) * 30) + d : ((m - 1) * 31) + d | |
let result = ((y - 1) * 365.2422 + d - 119) / 354.3670 | |
result = result.toString().split('.') | |
y = +result[0] + 1 | |
result = (('0.' + result[1]) * 12).toString().split('.') | |
m = +result[0] + 1 | |
d = +(('0.' + result[1]) * 29.530).toString().split('.')[0] + 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isPersian(str) { | |
var p = /^[\u0600-\u06FF\s]+$/; | |
return p.test(str); | |
} |