Advertisement
gaber-elsayed

temp channels

Oct 6th, 2021
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. const express = require("express");
  2. const app = express();
  3. const moment = require('moment')
  4. app.listen(() => console.log("Server started"));
  5.  
  6. app.use('/ping', (req, res) => {
  7. res.send(new Date());
  8. });
  9. let category = 'ايدي الغاتيغوري الي تتسوئ فيها الرومات'
  10. const Discord = require("discord.js");
  11. const client = new Discord.Client();
  12.  
  13. const TempChannels = require("discord-temp-channels");
  14. const tempChannels = new TempChannels(client);
  15.  
  16. const db = require("quick.db");
  17.  
  18. client.on("ready", () => {
  19. if (!db.get("temp-channels")) db.set("temp-channels", []);
  20. db.get("temp-channels").forEach((channelData) => {
  21. tempChannels.registerChannel(channelData.channelID, channelData.options);
  22. });
  23. });
  24.  
  25. client.on("message", (message) => {
  26.  
  27. if(message.content.startsWith("!set")){
  28. if(!message.member.hasPermission('MANAGE_CHANNELS')) return;
  29. if(!message.member.voice.channel) return message.channel.send('join a vc first!')
  30. if(tempChannels.channels.some((channel) => channel.channelID === message.member.voice.channel.id)){
  31. return message.channel.send("Your voice channel is already a main voice channel");
  32. }
  33. const options = {
  34. childCategory: category,
  35. childAutoDeleteIfEmpty: true,
  36. childBitrate: 64000,
  37. childFormat: (member, count) => `${member.user.username}`
  38. };
  39. tempChannels.registerChannel(message.member.voice.channel.id, options);
  40. db.push("temp-channels", {
  41. channelID: message.member.voice.channel.id,
  42. options: options
  43. });
  44. message.channel.send("Your voice is now a main voice channel!");
  45. }
  46.  
  47. });
  48. client.login(process.env.token);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement