Create invite links to the server automatically by bot

I want to generate an invite link. Of course, I can do it manually in Discord but I want to automate it and generate the invite link to the specific server by user and provide it to others so that they can join the server - just exactly the same as they do in Discord but without doing it manually, automate it in React.
4 Replies
d.js toolkit
d.js toolkit13mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
OliverJansen
OliverJansenOP13mo ago
Discord.js is latest. 14.14.0 and node is 20.9.0 I have an error. I can't require('discord.js') because of error.
d.js docs
d.js docs13mo ago
Discord does not condone bots creating invites without the expressed consent of the guild owner/admins. source (Discord Developer Policy)
You may not use the APIs in any way to [...] process Discord Data in a way that surprises or violates Discord users' expectations.
- If you are experiencing problems with a particular guild, have your bot leave and/or blacklist it
OliverJansen
OliverJansenOP13mo ago
Oh... I just want to generate an invite link. In discord, you right click other member and select create invite to server, and select specific server. Then message is generated with a link of invite to that server. I want to do this in react automatically - just when user refreshes the page, there is a link on the screen and that link is exactly the same of when user right click and select invite to server in Discord. Can you help me? "Discord does not condone bots creating invites without the expressed consent of the guild owner/admins." Who is guild owner/admins and how can I get expressed consent? I created a server for test so I am the owner. So I have permission, right? How can I do that? And I can't even use require('discord.js'). I will show you the error message. wait - compiling... event - compiled client and server successfully in 176 ms (742 modules) wait - compiling /home-feed (client and server)... Watchpack Error (initial scan): Error: ENOTDIR: not a directory, scandir 'E:\MyWork\19\Dean\Frontend\codsland\node_modules\next\dist\compiled\timers-browserify\main.js' Watchpack Error (initial scan): Error: ENOTDIR: not a directory, scandir 'E:\MyWork\19\Dean\Frontend\codsland\node_modules\next\dist\compiled\stream-browserify\index.js' Watchpack Error (initial scan): Error: ENOTDIR: not a directory, scandir 'E:\MyWork\19\Dean\Frontend\codsland\node_modules\next\dist\compiled\util\util.js' error - ./node_modules/@discordjs/ws/dist/index.js:113:0 Module not found: Can't resolve 'worker_threads' Import trace for requested module: ./node_modules/discord.js/src/index.js ./pages/home-feed.js If I erase require('discord.js'), it works without an error Anyway, can you explain the reason I get error by requireing discord.js module? You mean I can't use any action related to Discord.js in browser? Thank you for your kind explanation. I didn't get it clearly but I feel thankful. So please clarify once again for me. Is it possible to create invite link by bot (not manually) in case I am the owner of the server? Thanks. You have been a great help. I will try and tell you the result. Do I have to use Intents when creating client? I thought this was challenging thing and I really want to realize this with code. And you said it is possible to do this. Do I need to have/tell intention about this? This is just a simple one utilizing the provided functionality of discord.js, isn't it? Um... I think we are digressing from the main point. I don't want alternatives or shortcuts to this solution. I encountered error in my code and I want to correct it with your help. As I said, I don't know what Intent is because I am not experienced with discord.js. If I skip this by using easier method, I won't get to know deeper and the real power of discord.js. Please be patient and help me. What do you say? Er... sorry. I insist in react and my methodology. So you mean there is no way-out in my way? I can't use Intents? I have an error like "you have to use Intents from discord.js 13 version", so I thought I should use Intents. Is it impossible to use Intents in discord.js 14? Ok. Let's say I intend to prepare full meals for thousands of people and want my noddles to be prepared in an industrial kitchen. Then...? Menu is simple. I want to automate create invite link work. If you want to make 10 different link for 10 different people it's annoying to do it by human hands and wanna automate it. This solution is using bot I think. Make sense? Could you provide me code I would use in react? By /rest or /core/http-only like?
Want results from more Discord servers?
Add your server