I am making a discord bot command that acts a form of queuing system.
- Announcement gets sent out
- The announcement has a field that got the list of the people who have done a command which gave them a role.
- That role gives them access to a voice channel and a text channel, however the role will be stripped away from them if they leave the voice channel after a specific amount of time has happened (5 minutes to be exact).
I just want to know if these are possible:
I have the bot send an embed message, that message got a field. In that field can I have it that the bot automatically updates that field with the username of the people who have a certain role?
The role will be given with a command that any user can do and the command can only be used when the embed gets send out.
I only want the MOST recent embed to be updated within a specific channel.
What can be done and what can't be done. Discord.js version 12
I believe I have done it. I will give the code, and then show you where everything is.
Here's what's happening:
First, we define a function, that defines a channel and the list of people with a role. Then, we edit the embed from the message defined a bit later. We also state that we will repeat
updateEmbedevery 4 seconds. Thepart is the same as the
updateEmbedfunction, with a few extra bits at the end. These extra bits do: 1. Allow people to become HeJjo, and 2. Set it up so that after 10 seconds, people cannot change their role anymore. (ps: The code in here is what will be in the command to allow people to change their role).The next section fires when someone enters or leaves a voice channel. It checks if it is someone leaving, and if not, returns. If yes, then we check if it is the voice channel restricted for members of our role. If so, we determine if five minutes have passed. If they have, we remove the HeJjo role.
The next bit of code is when someone messages. It only runs the code inside if the message is
'!become role'and it isn't too late to use this command. What the code inside does is this:It writes in the Json that five minutes have not passed, and saves it. It then gives the member the role, and then waits five minutes before writing to the file that five minutes have passed.
Hope this helps!!