Answer the question
In order to leave comments, you need to log in
How to return a response on error?
vk.updates.hear(/^(?:hi)\s([^]+)?/i, (message) => {
axios.get(`https://minecraft-statistic.net/api/player/info/${message.$match[1]}/200940`).then(res => {
if((res.data && res.data.status) == 'ok'){
if(res.data && res.data.data) {
let timeplay = res.data.data.total_time_play || 0
var num = timeplay;
var hours = (num / 60);
var play = Math.floor(hours);
if(res.data && res.data.data) {
let visit = res.data.data.visited_server
axios.get(`https://api.ashcon.app/mojang/v1/user/${message.$match[1]}`).then(resp => {
return resp.data.username_history;
}).then(data => {
let names = '';
data.forEach(item => {
names += item.username + '\n';
})
return message.send(`История никнейма:\n\n${names}`)
}).catch(err => message.send(`${err}`));
}}}}else message.send(`❗ Никнейм ${message.$match[1]} не существует!`)
}).catch(err => message.send(`⚠ Произошла ошибка!`));
});
Answer the question
In order to leave comments, you need to log in
return message.send(`♂ ${message.$match[1]}\n\n ${visit > false ? 'Есть доступ к СП-Мини 💚' : 'Не покупал доступ на СП-Мини 💔'}\nВ последний раз играл: ${lastplay}\nВсего наиграно: ${play} часов\n\nИстория никнейма:\n\n${names}`)
}).catch(err => message.send(`♂ ${message.$match[1]}\n\n ${visit > false ? 'Есть доступ к СП-Мини 💚' : 'Не покупал доступ на СП-Мини 💔'}\nВ последний раз играл: ${lastplay}\nВсего наиграно: ${play} часов`));
}}}}else message.send(`❗ Никнейм ${message.$match[1]} не существует!`)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question