This commit is contained in:
20
commands/refetch.js
Normal file
20
commands/refetch.js
Normal file
@ -0,0 +1,20 @@
|
||||
exports.name = "refetch";
|
||||
exports.description = ":ninja: Refetch user react data.";
|
||||
exports.usage = "<<refetch";
|
||||
exports.example = "<<refetch";
|
||||
exports.hidden = true;
|
||||
exports.run = async (client, message, args) => {
|
||||
const url = "https://drive.overflow.fun/public/react.json";
|
||||
client.usersToReactTo = [];
|
||||
const res = await fetch(url);
|
||||
const data = await res.json();
|
||||
|
||||
client.usersToReactTo = data.map((entry) => {
|
||||
const [userId, emoji] = entry.split(":");
|
||||
return { userId, emoji };
|
||||
});
|
||||
|
||||
message.channel.send(
|
||||
"Refetched react data. " + JSON.stringify(client.usersToReactTo)
|
||||
);
|
||||
};
|
Reference in New Issue
Block a user