SHARE
TWEET

Untitled

a guest Sep 19th, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module.exports = async (bot, guild) => {
  2.  
  3.  
  4.   console.log("Joined a new guild: " + guild.name);
  5.  
  6.  
  7.   let createdTBNID;
  8.   let createdAnnounceID;
  9.  
  10.       let createdCategoryID;
  11.   const newCat = await guild.createChannel('TBN', { type: 'category' })
  12.   createdCategoryID = newCat.id
  13.    
  14.     const newCh = await guild.createChannel('tbn-chat', { type: 'text' })
  15.     await newCh.setParent(createdCategoryID);
  16.     createdTBNID = newCh.id
  17.    
  18.     const newAnnCh = await guild.createChannel('tbn-announcements', { type: 'text' })
  19.     createdAnnounceID = newAnnCh.id
  20.     await newAnnCh.setParent(createdCategoryID)
  21.     guild.channels.find(channel => channel.id === newAnnCh.id)
  22.     .overwritePermissions(guild.defaultRole, {
  23.       SEND_MESSAGES: false
  24.     })
  25.  
  26.     await console.log(createdTBNID)
  27.  
  28.   guildSchema.findOne({guildID: guild.id }, (err, res) => {
  29.     if (!res) {
  30.       const guildS = new guildSchema({
  31.       guildID: guild.id,
  32.       guildName: guild.name,
  33.       isClubVerified: false,
  34.       isGangVerified: false,
  35.       tbnChannelID: createdTBNID,
  36.       tbnAnnounceChannelID: createdAnnounceID,
  37.     })
  38.    
  39.     guildS.save().then(result => {
  40.       console.log(result)
  41.     })
  42.     .catch(err => console.log(err))
  43.     } else {  
  44.       guildSchema.deleteOne({guildID: guild.id}, function (err) {})
  45.       .then(restwo => {
  46.         const guildS = new guildSchema({
  47.           guildID: guild.id,
  48.           guildName: guild.name,
  49.           isClubVerified: false,
  50.           isGangVerified: false,
  51.           tbnChannelID: createdTBNID,
  52.           tbnAnnounceChannelID: createdAnnounceID
  53.         })
  54.         guildS.save().then(result => {
  55.           console.log(result)
  56.         })
  57.       })
  58.     }
  59.   })
  60. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top