Added /claim command, added logic to allow tips for users withouth known telegram id, by just username.
This commit is contained in:
@@ -16,6 +16,32 @@ function sendMessage(int $chatId, string $text, array $options = []): void {
|
||||
curl_close($ch);
|
||||
}
|
||||
|
||||
|
||||
function sendGif(int $chatId, string $fileIdOrUrl, ?string $caption = null): void {
|
||||
global $config;
|
||||
$url = "https://api.telegram.org/bot{$config['TELEGRAM_BOT_TOKEN']}/sendAnimation";
|
||||
|
||||
$payload = [
|
||||
'chat_id' => $chatId,
|
||||
'animation' => $fileIdOrUrl,
|
||||
];
|
||||
|
||||
if ($caption) {
|
||||
$payload['caption'] = $caption;
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
|
||||
if (!empty($config['IPV4_ONLY'])) {
|
||||
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
|
||||
}
|
||||
curl_exec($ch);
|
||||
curl_close($ch);
|
||||
}
|
||||
|
||||
function isValidSalviumAddress(string $address): bool {
|
||||
// Accepts standard and subaddress prefixes for Salvium (e.g. SaLvd, SaLvs)
|
||||
return preg_match('/^SaLv[a-zA-Z0-9]{95}$/', $address) === 1;
|
||||
|
||||
Reference in New Issue
Block a user