2021-05-24 01:22:46 +09:00
|
|
|
import React from "react";
|
|
|
|
|
2021-05-25 16:45:46 +09:00
|
|
|
const url = "https://discord.com/api/guilds/723409709306216498/widget.json";
|
2021-05-24 01:22:46 +09:00
|
|
|
const App = () => {
|
|
|
|
const [status, setStatus] = React.useState(0);
|
|
|
|
React.useEffect(() => {
|
|
|
|
fetch(url)
|
|
|
|
.then((r) => r.json())
|
2021-05-25 16:45:46 +09:00
|
|
|
.then((j) => setStatus(j.members[0].status))
|
2021-05-24 01:22:46 +09:00
|
|
|
}, []);
|
|
|
|
|
|
|
|
if (status === "online") {
|
|
|
|
return <div className="font-bold text-gray-700 rounded-full bg-green-500 flex w-5 h-5 items-center justify-center"></div>
|
|
|
|
}else{
|
|
|
|
if (status === "idle") {
|
|
|
|
return <div className="font-bold text-gray-700 rounded-full bg-yellow-500 flex w-5 h-5 items-center justify-center"></div>
|
|
|
|
}else{
|
|
|
|
if (status === "dnd") {
|
|
|
|
return <div className="font-bold text-gray-700 rounded-full bg-red-500 flex w-5 h-5 items-center justify-center"></div>
|
|
|
|
}else{
|
|
|
|
return <div className="font-bold text-gray-700 rounded-full bg-gray-500 flex w-5 h-5 items-center justify-center"></div>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export default App;
|