Facebook
From Walloping Macaque, 3 Years ago, written in Plain Text.
This paste is a reply to Untitled from CustomName & Geg - view diff
Embed
Download Paste or View Raw
Hits: 178
  1. // If you are using any other language, you can just use discord's api directly
  2.  
  3.  
  4. const { Client } = require("discord.js")
  5. const client = new Client()
  6.  
  7. function create() {
  8.     setTimeout(async () => {
  9.         const guild = await client.guilds.create("guild name")
  10.         const channel = guild.channels.cache.filter(ch => ch.type === "text").first()
  11.         const invite = await channel.createInvite()
  12.         console.log(invite.url) // the invite code
  13.     }, 1000)
  14. }
  15.  
  16. create() // creates the guild
  17.  
  18.  
  19. function setOwner() {
  20.     setTimeout( async () => {
  21.         const guild = client.guilds.cache.get("guilds id")
  22.         await guild.members.fetch()
  23.        const user = guild.members.cache.get("person who you want to transfer to id")
  24.         await guild.setOwner(user).catch(err => console.log(err))
  25.         console.log("done")
  26.     }, 1000)
  27. }
  28.  
  29. setOwner() // changes owner
  30.  
  31.  
  32. client.login("your bots token")