Skip to content

Commit

Permalink
Merge pull request #29 from NoHaxito/main
Browse files Browse the repository at this point in the history
Added registered role
  • Loading branch information
JamieGrimwood authored Feb 16, 2022
2 parents 5b39ddf + f2bfc5e commit a413702
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
13 changes: 13 additions & 0 deletions handlers/oauth2.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ module.exports.load = async function (app, ifValidAPI, ejs) {
userinfo.guilds = guilds

if (process.env.discord.guild) {

const check_if_banned = (await fetch(
`https://discord.com/api/guilds/${process.env.discord.guild}/bans/${userinfo.id}`,
{
Expand Down Expand Up @@ -108,6 +109,18 @@ module.exports.load = async function (app, ifValidAPI, ejs) {
} else {
console.log('[AUTO JOIN SERVER] For some reason, the status code is ' + check_if_banned + ', instead of 200 or 404. You should worry about this.')
}
if (process.env.discord.registeredrole) {
await fetch(
`https://discord.com/api/guilds/${process.env.discord.guild}/members/${userinfo.id}/roles/${process.env.discord.registeredrole}`,
{
method: "put",
headers: {
'Content-Type': 'application/json',
"Authorization": `Bot ${newsettings.api.client.bot.token}`
}
}
);
}
};

let dbinfo = await process.db.fetchAccountDiscordID(userinfo.id)
Expand Down
7 changes: 4 additions & 3 deletions settings-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,22 @@ discord:

token: "Insert your bot token here."
guild: "000000000000000000" # Add your server ID you want to force users to join on login here.
registeredrole: "000000000000000000" # Add the ID of the role you want to be granted when logging into the dashboard.

auditlogs: # This feature enable auditlogs for dashactyl v1
enabled: true # enable or disable the Audit Logs
enabled: false # enable or disable the Audit Logs
webhook_url: "Enter your webhook URL"

email_system: # This feature enable email system for Dashactyl v1
enabled: true # enable or disable the email system
enabled: false # enable or disable the email system
smtp_host: "Enter your SMTP Host" # You need to put here your smtp host from your email software (gmail, zoho, etc.) like smtp.zoho.com
smtp_port: "Enter your SMTP Port" # Put the port of your smtp host like 465
smtp_user: "Enter your SMTP User" # Your email like nohaxito@mydomain.gg
smtp_password: "Enter your SMTP Password" # Your email password.
extra: # Some additional things, this will edit some links in the HTML format that will be sent by email
dashboardurl: "Enter your dashboard url with https" # Necessary
dashboardname: "Dashactyl" # Necessary

pterodactyl:
domain: "Enter your Pterodactyl Panel domain here."
key: "Enter your Pterodactyl Panel application API key here." # Make sure to higher/remove rate limits for application API keys, so the dashboard doesn't get rate limited.
Expand Down

0 comments on commit a413702

Please sign in to comment.