🚀 Unione dei servizi per l’utente
Quando un utente decide di collegarsi a uno specifico bot sniper, il nostro servizio deve fornire un meccanismo per collegare in modo sicuro l’utente al bot sniper, quindi ogni bot sniper deve aggiungere una condizione (quando l’utente invia messaggi), di seguito forniamo un esempio su una delle librerie Node.js più popolarinode-telegram-bot-api , come fare:
const TelegramBot = require('node-telegram-bot-api');
const TRIGGER_KEY = 'LOTUSMARKET';
// API-KEYS
const TELEGRAM_TOKEN = 'YOUR_TELEGRAM_BOT_TOKEN';
const LOTUSMARKET_API_KEY = 'YOUR_LOTUS_MARKET_API_KEY';
(() => {
const bot = new TelegramBot(TELEGRAM_TOKEN, {
polling: true,
});
bot.on('message', async (data) => {
const {
text,
chat: { id },
} = data;
if (text.startsWith(TRIGGER_KEY)) {
const response = await fetch('https://lotusmarket.io/api/v1/sniper-bots/verify', {
method: 'POST',
headers: {
‘Accept’: ‘application/json’,
'Content-Type': 'application/json',
'Api-Key': LOTUSMARKET_API_KEY,
},
body: JSON.stringify({
verificationCode: text,
id,
}),
});
if (response.status === 200) {
// NOTIFY USER THAT EVERYTHING IS OKAY
bot.sendMessage(id, 'You was connected to LotusMarket terminal!');
return;
}
// NOTIFY USER THAT EVERYTHING IS OKAY
bot.sendMessage(id, "Now you can't connect to LotusMarket terminal!");
}
});
})();
Qui, come puoi vedere, c’è anche una parte in cui il bot sniper dovrà inviare una richiesta aggiuntiva quando legge questo tipo di messaggio; di seguito troverai le istruzioni dettagliate su come utilizzare il percorso mostrato nell’esempio sopra.
https://lotusmarket.io/api/v1/sniper-bots/verify
FAI ATTENZIONE! L’ACCESSO POTREBBE ESSERE RESTRITO PER I SEGUENTI MOTIVI:
- IL TUO IP È STATO CAMBIATO, E ORA L’API NON È DISPONIBILE PER TE TI PREGO DI NOTIFICARCI
- HAI UTILIZZATO TROPPI TENTATIVI DI RICHIESTE, IL NOSTRO LIMITE È 60 RICHIESTE AL MINUTO
- A VOLTE Dobbiamo AGGIORNARE LE NOSTRE LISTE BIANCHE E IN QUESTO MOMENTO IL SERVER POTREBBE NON ESSERE DISPONIBILE
Accept: application/json
Content-Type: application/json
Api-Key: <YOUR_API_KEY>
{
"id": 0,
"verificationCode": "VERIFICATION_CODE",
}
id
NUMERO
Id chat Telegram dell’utente che ha scritto il codice di verifica
verificationCode
STRINGA
Codice che l’utente copia dal terminale per la connessione al bot sniper
Se la richiesta è passata con tutte le condizioni, la risposta sarà nel formato seguente
{
"status": 200,
"message": "Utente verificato con successo!"
}
Se la richiesta è fallita, il codice e il motivo saranno forniti nella risposta
{
"status": 404,
"message": "Codice di verifica non trovato!"
}
Se l’API-KEY è invalida, la risposta sarà nel formato seguente
{
"status": 403,
"message": "Non autorizzato"
}
Se l’utente è già stato attivato con il codice di verifica fornito, la risposta sarà nel formato seguente
{
"status": 400,
"message": "Utente già attivato"
}
Quando l’utente ha effettuato troppi tentativi, la risposta sarà nel formato seguente
{
"status": 429,
"message": "Non più di 60 richieste al minuto"
}
Non più di 60 richieste al minuto
NUMERO
Codice di errore nell’API interna
messaggio
NUMERO/p>
Motivo descritto per cui la richiesta è fallita