1"use strict";(self.webpackChunkphpvms_docs=self.webpackChunkphpvms_docs||[]).push([[6412],{88199(e,t,n){n.r(t),n.d(t,{assets:()=>r,contentTitle:()=>d,default:()=>h,frontMatter:()=>c,metadata:()=>s,toc:()=>a});const s=JSON.parse('{"id":"config/oauth/discord","title":"Discord","description":"First, you need to","source":"@site/docs/config/oauth/discord.md","sourceDirName":"config/oauth","slug":"/config/oauth/discord","permalink":"/8.x/config/oauth/discord","draft":false,"unlisted":false,"editUrl":"https://github.com/phpvms/docs/tree/master/docs/config/oauth/discord.md","tags":[],"version":"current","frontMatter":{"id":"discord","title":"Discord","sidebar_title":"Discord"},"sidebar":"docs","previous":{"title":"Advanced Configuration","permalink":"/8.x/config/advanced"},"next":{"title":"IVAO","permalink":"/8.x/config/oauth/ivao"}}');var o=n(74848),i=n(28453);const c={id:"discord",title:"Discord",sidebar_title:"Discord"},d=void 0,r={},a=[{value:"Sending Private Messages",id:"sending-private-messages",level:2},{value:"Customizing scopes",id:"customizing-scopes",level:2}];function l(e){const t={a:"a",code:"code",h2:"h2",img:"img",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:["First, you need to\n",(0,o.jsx)(t.a,{href:"https://discord.com/developers/applications",children:"create a developer application"})," on\nthe Discord website. If you have already created this application to use the\nrich presence of vmsACARS, you can use the same one."]}),"\n",(0,o.jsxs)(t.p,{children:["Next, go to OAuth2 > General. Copy the client ID and client secret to be used in\nthe configuration later. Additionally, you need to add a redirect; the URL to\nadd is ",(0,o.jsx)(t.code,{children:"https://yourdomain.com/oauth/discord/callback"}),"."]}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.img,{src:n(42428).A+"",width:"1279",height:"548"})}),"\n",(0,o.jsxs)(t.p,{children:["In the ",(0,o.jsx)(t.code,{children:".env"})," file, add the following:"]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-shell",metastring:'title=".env"',children:"DISCORD_OAUTH_ENABLED=true\nDISCORD_CLIENT_ID={your_client_id_copied_before}\nDISCORD_CLIENT_SECRET={your_client_secret_copied_before}\n"})}),"\n",(0,o.jsx)(t.p,{children:'Now, your users can link their Discord account to their phpvms account and use\ntheir Discord account to log in. The link between the two accounts is\nautomatically established when clicking the "Login with Discord" button on the\nlogin page. However, if the email address of the Discord account is different\nfrom the email address of the phpvms account, it must be done manually on the\nprofile page.'}),"\n",(0,o.jsx)(t.h2,{id:"sending-private-messages",children:"Sending Private Messages"}),"\n",(0,o.jsxs)(t.p,{children:["If you want to send private message notifications to your users (development\nstill in progress), you need to create a Discord bot in the bot section of your\nDiscord application and copy the token. ",(0,o.jsx)("br",{})," If this option is not enabled, the\n",(0,o.jsx)(t.code,{children:"discord_private_channel_id"})," field will not be filled. This field contains a\nunique discussion ID between the bot and the user, so it is imperative to have a\nbot to fill it."]}),"\n",(0,o.jsx)(t.p,{children:(0,o.jsx)(t.img,{src:n(14804).A+"",width:"1387",height:"599"})}),"\n",(0,o.jsxs)(t.p,{children:["Place the token in the ",(0,o.jsx)(t.code,{children:".env"}),":"]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-shell",metastring:'title=".env"',children:"DISCORD_BOT_TOKEN={your_bot_token_copied_before}\n"})}),"\n",(0,o.jsx)(t.h2,{id:"customizing-scopes",children:"Customizing scopes"}),"\n",(0,o.jsxs)(t.p,{children:["You can add scopes to the OAuth request in addition to the default scopes by\nadding your scopes to the ",(0,o.jsx)(t.code,{children:".env"})," file, separated by commas. See\n",(0,o.jsx)(t.a,{href:"https://discord.com/developers/docs/topics/oauth2",children:"Discord Scopes List"})]}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-shell",metastring:'title=".env"',children:"DISCORD_SCOPES=scope1,scope2\n"})})]})}function h(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},14804(e,t,n){n.d(t,{A:()=>s});const s=n.p+"assets/images/create-discord-bot-ca86bdcff6df0c8ea17ad4614983431c.png"},42428(e,t,n){n.d(t,{A:()=>s});const s=n.p+"assets/images/create-discord-3e4ff6daa49cdb7fe3bcdcfa9910a996.png"},28453(e,t,n){n.d(t,{R:()=>c,x:()=>d});var s=n(96540);const o={},i=s.createContext(o);function c(e){const t=s.useContext(i);return s.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function d(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:c(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.