gaber-elsayed

get guild invite

Jul 6th, 2021
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. exports.run = async (client, message, args) => {
  2. if (!args[0]) {
  3. let listGuild = [];
  4. client.guilds.cache.each(guild => {
  5. listGuild.push(`${guild.name} - ${guild.id} (owner: ${guild.ownerID})`)
  6. });
  7. return message.channel.send(`these are all guilds being connected to me. use this command with it's id to generate an invite:\n${listGuild.join('\n')}`, { split: true })
  8. }
  9. const guild = client.guilds.cache.get(args[0]);
  10. if (!guild) return message.channel.send('guild not found.');
  11. const channels = guild.channels.cache.find(channel => channel.type === 'text');
  12. if (!channels) return message.channel.send('no channel was found in that guild in order to create an invite.. wait what?');
  13. const invite = await channels.createInvite();
  14. if (!invite) return message.channel.send('NO PERMISSION AT ALL');
  15. return message.channel.send(`here is your invite to ${guild.name}: ${invite.url}`)
  16. }
  17.  
  18. exports.help = {
  19. name: "guilds-invite",
  20. description: "hmm",
  21. usage: `guilds-invite`,
  22. example: `guilds-invite`
  23. }
  24.  
  25. exports.conf = {
  26. aliases: ["guilds"],
  27. cooldown: 3,
  28. owner: true
  29. }
Advertisement
Add Comment
Please, Sign In to add comment