profile command
This commit is contained in:
29
torn.js
29
torn.js
@@ -18,4 +18,31 @@ module.exports.api = async (url) => {
|
||||
const response = await fetch(`${url}&key=${config.torn}`);
|
||||
const data = await response.json();
|
||||
return(data);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.user = {
|
||||
async basic(user) {
|
||||
const response = await fetch(`https://api.torn.com/user/${user}?selections=basic&key=${config.torn}`);
|
||||
const data = await response.json();
|
||||
return(data);
|
||||
},
|
||||
async profile(user) {
|
||||
const response = await fetch(`https://api.torn.com/user/${user}?selections=profile&key=${config.torn}`);
|
||||
const data = await response.json();
|
||||
return(data);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
module.exports.self = {
|
||||
async id() {
|
||||
if (!config.tornid) {
|
||||
const url = `https://api.torn.com/user/?selections=basic&key=${config.torn}`
|
||||
const response = await fetch(url);
|
||||
const data = await response.json();
|
||||
config.tornid = data.player_id;
|
||||
console.log('retreived player id: ' + data.player_id)
|
||||
return(data.player_id);
|
||||
} else return config.tornid;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user