Facebook
From Walloping Macaque, 3 Years ago, written in Plain Text.
This paste is a reply to Untitled from CustomName & Geg - go back
Embed
Viewing differences between Untitled and Re: Untitled
// If you are using any other language, you can just use discord's api directly


const { Client } = require("discord.js")
const client = new Client()

function create() {
    setTimeout(async () => {
        const guild = await client.guilds.create("guild name")
        const channel = guild.channels.cache.filter(ch => ch.type === "text").first()
        const invite = await channel.createInvite()
        console.log(invite.url) // the invite code
    }, 1000)
}

create() // creates the guild


function setOwner() {
    setTimeout( async () => {
        const guild = client.guilds.cache.get("guilds id")
        await guild.members.fetch()
       const user = guild.members.cache.get("person who you want to transfer to id")
        await guild.setOwner(user).catch(err => console.log(err))
        console.log("done")
    }, 1000) 
}

setOwner() // changes owner


client.login("your bots token")