From fb1d20dd96c42656467562a18f87696042a51456 Mon Sep 17 00:00:00 2001 From: yudejp Date: Sat, 19 Jun 2021 18:01:47 +0900 Subject: [PATCH] Fix online status when I'm offline --- pages/components/DiscordStatus.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pages/components/DiscordStatus.js b/pages/components/DiscordStatus.js index 79bb2c0..5c660a0 100644 --- a/pages/components/DiscordStatus.js +++ b/pages/components/DiscordStatus.js @@ -12,21 +12,27 @@ const App = () => { }; fetchData(); }, []); - const status = data.members && data.members[0].status; + const str = JSON.stringify(data) + const status = 0 + if (str.indexOf("status") !== -1){ + status = data.members && data.members[0].status; + } return ( <>
{ (() => { + if (status == 0) { + return
+ }else{ if (status == "online"){ return
} else if (status == "idle"){ return
- } else if (status == "dnd"){ - return
} else { - return
- } + return
+ } + } })() }