Jeff
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
2 additions and
3 deletions
-
src/components/settings/ConfigPanels/ExternalConfig.tsx
-
src/hooks/useDiscordRpc.ts
|
@ -38,7 +38,6 @@ const ExternalConfig = ({ bordered }: any) => { |
|
|
<StyledToggle |
|
|
<StyledToggle |
|
|
defaultChecked={config.external.discord.enabled} |
|
|
defaultChecked={config.external.discord.enabled} |
|
|
checked={config.external.discord.enabled} |
|
|
checked={config.external.discord.enabled} |
|
|
disabled={config.external.discord.clientId.length !== 18} |
|
|
|
|
|
onChange={(e: boolean) => { |
|
|
onChange={(e: boolean) => { |
|
|
settings.set('discord.enabled', e); |
|
|
settings.set('discord.enabled', e); |
|
|
dispatch(setDiscord({ ...config.external.discord, enabled: e })); |
|
|
dispatch(setDiscord({ ...config.external.discord, enabled: e })); |
|
|
|
@ -12,7 +12,7 @@ const useDiscordRpc = ({ playersRef }: any) => { |
|
|
const [discordRpc, setDiscordRpc] = useState<any>(); |
|
|
const [discordRpc, setDiscordRpc] = useState<any>(); |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
if (config.external.discord.enabled && config.external.discord.clientId.length === 18) { |
|
|
if (config.external.discord.enabled) { |
|
|
const client = new RPC.Client({ transport: 'ipc' }); |
|
|
const client = new RPC.Client({ transport: 'ipc' }); |
|
|
|
|
|
|
|
|
if (discordRpc?.client !== config.external.discord.clientId) { |
|
|
if (discordRpc?.client !== config.external.discord.clientId) { |
|
@ -94,7 +94,7 @@ const useDiscordRpc = ({ playersRef }: any) => { |
|
|
|
|
|
|
|
|
return () => clearInterval(interval); |
|
|
return () => clearInterval(interval); |
|
|
} |
|
|
} |
|
|
return () => clearInterval(); |
|
|
return () => {}; |
|
|
}, [ |
|
|
}, [ |
|
|
config.external.discord.enabled, |
|
|
config.external.discord.enabled, |
|
|
config.external.discord.serverImage, |
|
|
config.external.discord.serverImage, |
|
|