2023-02-01 15:17:38 +01:00
|
|
|
const command = {
|
|
|
|
name: "user",
|
|
|
|
desc: "get info about a certain user",
|
2023-02-02 23:37:42 +01:00
|
|
|
restricted: false,
|
2023-02-02 23:58:58 +01:00
|
|
|
mod: false,
|
2023-02-01 15:17:38 +01:00
|
|
|
run: async (client, msg, splitted) => {
|
|
|
|
const data = await fetch(
|
|
|
|
`https://api.ivr.fi/v2/twitch/user?login=${
|
2023-02-09 18:40:33 +01:00
|
|
|
splitted[2]
|
|
|
|
? encodeURIComponent(splitted[2])
|
|
|
|
: encodeURIComponent(msg.displayName)
|
2023-02-01 15:17:38 +01:00
|
|
|
}`
|
|
|
|
)
|
|
|
|
.then((res) => res.json())
|
|
|
|
.then((data) => data[0])
|
2023-02-11 13:48:05 +01:00
|
|
|
.catch((err) => console.error("Error with leppunen api: " + err.message));
|
2023-02-01 15:17:38 +01:00
|
|
|
|
2023-02-11 13:48:05 +01:00
|
|
|
await client.say(
|
|
|
|
msg.channelName,
|
|
|
|
`${msg.displayName}, information about user ${
|
|
|
|
data.displayName
|
|
|
|
}: Created at: ${new Date(data.createdAt).toLocaleString()}, ${
|
|
|
|
data.banned ? `Banned: yes; Reason: ${data.banReason}` : ""
|
|
|
|
} ${
|
|
|
|
data.lastBroadcast.startedAt
|
|
|
|
? `Last stream: ${data.lastBroadcast.title}; ${Math.floor(
|
|
|
|
(new Date().getTime() -
|
|
|
|
new Date(data.lastBroadcast.startedAt).getTime()) /
|
|
|
|
(1000 * 3600 * 24)
|
|
|
|
)} days ago`
|
|
|
|
: ""
|
|
|
|
}`
|
|
|
|
);
|
2023-02-01 15:17:38 +01:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2023-02-01 22:11:48 +01:00
|
|
|
module.exports = { command };
|