The server registration limit for 'GIGAZINE BOT', which can instantly notify new articles from GIGAZINE to the Discord server, has finally been lifted and anyone can use it, so I looked back on the development flow and hellish exchanges with support



GIGAZINE operates

an official Discord server , where new articles are instantly distributed and forums related to articles are set up. To distribute new articles on the official Discord server, the GIGAZINE Technology Department uses a proprietary BOT called ' GIGAZINE BOT ', which is also available for free for readers who want to distribute GIGAZINE articles on their own servers. Detailed installation procedures and usage are explained in the following article.

How to install and use the bot 'GIGAZINE BOT' that allows you to quickly check new articles from GIGAZINE on Discord - GIGAZINE



In fact, when GIGAZINE BOT was first developed, the number of servers that could be registered was limited to 100 due to the use of privileged intent, so new registrations were not possible from around September 2023. After that, through program modifications and exchanges with official Discord support, the restrictions were lifted around October 2023, making GIGAZINE BOT available to anyone, so for those who want to create their own BOT in the future, we will summarize the development history of GIGAZINE BOT and the exchanges with official support up to the lifting of the restrictions.

·table of contents
◆1: Creating a BOT
◆2: First certification application and return
◆3: Privilege Intent Investigation
◆4: Certification application again
◆5: The last remaining privileged intent problem
◆6: Solution
◆7: Review
◆8: Regarding bug reports for GIGAZINE BOT

◆1: Creating a BOT
'GIGAZINE BOT' is a BOT whose primary purpose is to notify readers of new articles on GIGAZINE on their servers. The specific elemental technologies used in its development are as follows:

・Define and configure the BOT on Discord's ' DEVELOPER PORTAL '
・Run an app created using Discord.js in a Node.js + TypeScript environment
・Manage notification servers, channels and latest articles using sqlite3
Put them in a Docker image
・Run Docker containers on Linux servers with spare capacity

The only difficulties I had at this stage were that the samples I found online only had the function of 'responding with pong when someone said ping,' so it was hard to find the information I wanted, and also, because Discord.js has frequently made breaking changes , much of the information I did find was outdated and not useful.



By December 2022, the BOT was working as expected, so I decided to write an article about it and publish it.

How to install and use the bot 'GIGAZINE BOT' that allows you to quickly check new articles from GIGAZINE on Discord - GIGAZINE

https://gigazine.net/news/20221222-discord-gigazine-bot/



◆2: First certification application and return
Discord

has a bot authentication method in which 'unauthenticated bots are limited to a maximum of 100 server registrations, and authentication cannot be performed until the number of registered servers exceeds 75.' At this point, you may be aware of the high barrier to authentication and the lack of room to maneuver until you reach the upper limit, and feel anxious about the future.

At the end of February 2023, I received a direct message from Discord informing me that certification applications were now possible.



If you check the 'DEVELOPER PORTAL', you will see that a yellow-framed message has been added informing you that authentication is required, along with a button to start the authentication process.



When I clicked the 'Get Started' button, a screen for entering information to start the authentication process was displayed. Here, some probing questions are prepared, such as the following:

What does your application do?
-What Discord data will be stored?
How to host a bot?
-What languages/libraries are you using to create your BOT?

And in it there was this line:

- Which

privileged intent do you want to use?

Privileged intent refers to a permission that has special and significant meaning in Discord, and at the time of writing, the following three are defined:

PRESENCE INTENT : Allows you to track members' status and actions
SERVER MEMBERS INTENT : Enables tracking of member entry/exit and updates
MESSAGE CONTENT INTENT : Makes the content of the message traceable

When privileged intents were introduced, there were two, but this number may increase in the future.



When I searched the web for these three privileged intents when creating the BOT, the only information I found was 'Just turn on all three for now and use them,' so I followed that and turned them on. However,

・If you apply for even one intent, the number of questions will increase dramatically (if you apply for three, the number will triple without exception).
・From what I saw in the explanation, I don't think that these are necessary permissions for a BOT that only notifies users of new articles.

Because of this, I had a feeling that applying for these permissions would be a huge hassle, so I would like to be authenticated without applying for them if possible. So, as a test, I turned off all privileged intents in the DEVELOPER PORTAL while the BOT was running, and after observing the situation for a while, I confirmed that it was working without any problems, so I applied for authentication without applying for these permissions.

To sum up, the mistake was that I turned off all privileged intents while the BOT was running when checking the operation. Even though it was a hassle, I should have stopped the BOT first and checked it.

BOTs need to log in to Discord just like users. However, sometimes the BOT would log out on its own while it was running, so I set it to log in automatically in case that happened. However, when the privileged intent was turned off, it would not return from

the blocking state immediately after logging in, and it was no longer possible to operate as a BOT. I frantically tried to turn the privileged intent back on, but of course, I was unable to change any settings related to the BOT during the authentication process.



I was very worried, but then I remembered that support exists for situations like this, so I immediately contacted support and asked them to cancel the authentication process for the time being.



However, contrary to my expectations that 'it's not such a big request, so the cancellation will be approved immediately,' it took about five days to cancel the authentication process. This was not because of technical difficulties, but because it was difficult to communicate with the supporter. Even when I explained in a logical manner why I was requesting to cancel the authentication process, I received cheerful and nonsensical replies such as 'It's okay! The authentication process is proceeding properly!' and 'Just apply to use the intent!' This made me realize that the supporter seemed to be mechanically responding to the first word that caught their eye and giving a standard response.

Still, I had no other options, so I didn't give up and sent it again several times, and it seemed that I finally caught the eye of a decent supporter, and we finally had a conversation. And the authentication process was returned in an instant. It was five days after I learned that Discord had a supporter gacha .

◆3: Privilege Intent Investigation
Since the BOT settings could be changed by the reversal of the application, we decided to investigate which of the three privileged intents were necessary for the BOT to operate. As a result, we found that no matter which privileged intent was turned off, the BOT would not recover from the blocking state.

Also, I found out that the blocking was occurring where the ' slash command ' was set. However, I have no idea why a privileged intent is required to register a slash command, even after re-reading the documentation many times.

I searched online again for information, but I couldn't find any information that specifically examined how to set up intents with the assumption that it would be registered on a large number of servers.

In any case, our investigation at this point in time led us to the conclusion that, given the circumstances, we had no choice but to conclude that 'all privileged intents are required to run the BOT,' and we decided to apply for certification again based on that premise.

◆4: Reapply for certification
In the second certification application, in addition to the contents of the previous application, I will answer the question 'Why do I use privileged intent?'. Since the situation shows behavior that seems to be required when registering slash commands to a BOT, I will explain that it is 'necessary to use slash commands.'

The day after I submitted my application, Discord contacted me and asked me to send the following additional documents:

- Screenshots and videos of the bot running in the Discord server
- BOT help and command list
- Code snippets for the most commonly used commands

After sending these documents and checking the DEVELOPER PORTAL, I saw that it said 'Verification Request Processing,' so I assumed that the authentication process was proceeding smoothly.



And so half a month passed.

Thinking that this was a bit too long of an issue, I requested Discord support to check the progress, and received the unusual response, 'We're waiting for your reply! Please send us the information necessary for BOT authentication!' It seemed that both parties were in a 'waiting' situation, but the supporter's replies were too vague, so I made several inquiries, and after winning the supporter gacha, I got the following progress.

I just noticed that additional materials have been sent.
In other words, they had not even looked at the additional materials sent
And I can't open the additional materials.

I couldn't understand what he meant by 'I can't open the document,' but I realized that maybe he was scared to open the file because he had sent a link to the shared file on Google Drive, but the supporter couldn't tell what the file was just by looking at the URL. I sent the images again using Imgur and the videos using YouTube, a service that allows you to see what the data is at a glance. Then, I repeated the supporter gacha and the progress I got from the lucky person was a carefree 'I'm waiting for a reply from one of my teammates! I recommend waiting a little longer!' I couldn't help but want to reply, 'I don't care about your internal circumstances, just get on with the process.'

So after redoing the authentication process, it took more than two months, and after a lot of back and forth, I was finally approved. When I checked the bot on Discord, I saw that it was indeed a bot, with a check mark indicating that it was approved.



◆5: The last remaining privileged intent problem
While the joy of having completed the authentication process was still fresh in my mind, I received a strange email from Discord support.

The message was, 'We noticed that you are using privileged intent in your BOT! If you want to use it, you need to get approval!' The BOT certification application also asked whether or not you were using privileged intent and why, but what was that about?

... I decided to get approval to use privileged intents with the same explanation and materials as for the BOT certification application, with the policy that 'it is necessary to use slash commands.' When I checked the DEVELOPER PORTAL, I found that an item called 'Apply for privileged intents' was added in a bold blue frame, and I started the process by clicking the 'Apply' button there.



I received a swift rejection. However, as I continued to read the reply, it said, 'You can do what you want to do by using slash commands!', which made me scream in my head, 'But I'm having trouble because I don't have the proper permissions to register the slash command!?'

After that, I tried asking support a number of times, each time from a different angle, but I never got a satisfactory answer. What annoyed me the most was that they seemed to have great confidence in Discord's documentation, and would send me URLs to documents that they had already read through and dismissed as useless, as if they were answers to AI chat, saying, 'If you read this document, I'm sure it will solve your problem!'. Among them, the most useful information was that a supporter from Atari told me about a server called '

Discord Developer Server ', where Discord-related developers gather.

In the end, I had to conclude that Discord's support was completely useless, and I couldn't find much useful information on the Discord Developer Server, so I decided to go back to basics and review my code myself to see if there was a way to avoid using privileged intents.

Up until now, the code had been based on many online samples, so I was okay with some unnecessary settings as long as they worked, but I thought it was possible that privileged intent was required due to unnecessary settings, so I decided that I needed to start by examining whether or not it was necessary. So I decided to reexamine the GatewayIntentBits , which seemed to be related to permissions, by enabling only the bits below that were absolutely necessary and removing the rest, and checking the impact of the presence or absence of privileged intent on behavior.

GatewayIntentBits.Guilds (server related)
GatewayIntentBits.GuildMessages (Server message related)

However, the results were consistent with previous research: the app would launch successfully if all three privileged intents were given, but would fail to launch if any one of them was turned off.

I tried every other experiment I could think of, but none of them produced any useful results. As time passed, I noticed something odd about the behavior of GatewayIntentBits. So I checked the standard output instead of the log file that can be viewed from outside Docker, and found that the WebSocket had been disconnected and an exception had been generated with the following message, stating that an unauthorized intent was used.
[code]
Error: Used disallowed intents
at WebSocketShard.onClose (/home/container/node_modules/@discordjs/ws/dist/index.js:1066:15)
at WebSocket.emit (node:events:513:28)
at WebSocket.emitClose (/home/container/node_modules/ws/lib/websocket.js:258:10)
at TLSSocket.socketOnClose (/home/container/node_modules/ws/lib/websocket.js:1264:15)
at TLSSocket.emit (node:events:525:35)
at node:net:332:12
at TCP.done (node:_tls_wrap:588:7)[/code]



This is clearly different from the phenomenon that occurred during the first authentication request, 'not recovering from blocking immediately after logging in.' Based on the situation, I could surmise that it was not caused by a privileged intent, but by restricting GatewayIntentBits. So I looked closely at the list of GatewayIntentBits and thought that it was most likely related to WebSocket.

GatewayIntentBits.GuildWebhooks

I tried adding only that, and for some reason it started up normally without privileged intent.

There are many things I would like to point out, such as the fact that WebSocket and WebHook are completely different things, but the undeniable fact that it actually works is hard to shake. Furthermore, even after trying to remove GatewayIntentBits.GuildWebhooks afterwards, it seemed to work normally, but I have left this bit set as a talisman just in case it suddenly stops working again.

◆6: Solution
Thus, we were finally able to resolve the issue of privileged intent. In other words, we were able to eliminate all factors that limited the number of servers that could be registered, and finally created a BOT that we were not embarrassed to release to the public.

If you have previously tried to register GIGAZINE BOT on a server and received the following error message, this problem should now be resolved, so please try registering again.

This bot cannot be added to the server anymore because it is not approved or is requesting an unauthorized gateway intent.



Apart from this, some readers have reported that they have registered but are not receiving notifications of new articles. In regards to this, the execution log of the BOT has revealed that one of the following reasons is the cause.

DiscordAPIError[50001]: Missing Access (Cannot access server/channel)
DiscordAPIError[50013]: Missing Permissions (The BOT does not have the appropriate permissions)

Therefore, please check again whether you have registered the BOT according to the BOT installation article , especially regarding the permissions. The Missing Access error is caused by the channel or server itself that the BOT is notifying being deleted.

◆7: Review
After developing a Discord BOT, I realized that when it comes to development-related matters, Discord's support is not very reliable.

First of all, the quality of the supporters varies greatly, and if you have bad 'gacha luck,' you are dismissed with a strange answer that makes you wonder if ChatGPT is much better, and even if the ticket is closed unilaterally. Also, even though the status is 'reviewing,' the progress of the review is unclear, and the case is left unattended unless you contact us, which is another reason why I don't have a good impression of them. In the first place, I wonder if it is a good way of supporting someone to 'not even tell you the situation unless you have great luck with gacha.'

Also, while there is a form available for submitting support requests, it is not exactly user-friendly, and using it to discuss tickets with support is simply a pain.

And I think it's more of a problem with the configuration of Discord itself rather than Discord.js, but I don't like the fact that I can't understand what permissions are involved in what, or what the permissions dependencies are, even when I look at the documentation, and I can't understand anything even when I look at the errors and exceptions. This is probably one of the reasons why support is completely useless. The occurrence of breaking changes is unavoidable from a security perspective, but I can imagine that the burden on developers in dealing with them will undoubtedly be large.

If any of our readers are thinking about making a Discord BOT, we strongly recommend that you make one that runs only on your own server or on a server with very close friends, and be satisfied with that. We're not saying you should never get verified, but you should ask yourself before taking a step whether it's worth trying to get verified by endlessly trying to have a futile conversation with your supporters.

When we think about the Discord service itself from the perspective of the GIGAZINE server, we can say that it is very useful as a place to provide two-way communication between GIGAZINE and its readers. However, I have some concerns about whether we can continue to provide the service in the future regarding the BOT, especially whether we can deal with it appropriately when another destructive change is made, and whether we will be able to get lucky in the supporter gacha at that time. However, since we have somehow managed to make it into a reality, we intend to do as much as we can.

◆8: Regarding bug reports for GIGAZINE BOT
If you experience any symptoms that appear to be a problem, such as 'I tried to install GIGAZINE BOT on my server but couldn't' or 'I tried to get notified of new articles but couldn't,' please report it using this form , including the following information in addition to information about the circumstances under which the problem occurred:

- The 'Server ID' of the server to be installed
- The 'Channel ID' of the channel for which you want to receive notifications about new articles

Without this information, we probably won't be able to determine the cause of the issue and there may be nothing we can do.

In order to obtain the 'Server ID' and 'Channel ID' in the Windows version of the Discord app, you must first enable 'Developer Mode' in 'User Settings.' To display the 'User Settings' screen, click the gear icon next to the logged-in user display area at the bottom of the screen.



Next, select 'Advanced Settings' from the menu list on the left side of the 'User Settings' screen and turn on the top 'Developer Mode' switch to enable 'Developer Mode.'



To obtain the 'Server ID' with 'Developer Mode' enabled, select the server icon lined up on the left side of the screen, right-click to display the context menu, and select ' Copy Server ID ' to copy it to the clipboard.



Similarly, to obtain the 'Channel ID', select the server, right-click the desired channel name from the displayed channel list, and select ' Copy Channel ID ' from the context menu that appears. You can copy it to the clipboard.



In the case of the web or smartphone version of the app, copy the channel URL (in the app, press and hold the channel name and tap 'Copy link' from the context menu that appears) to see ' https://discord.com/shannels/ ' You can get a URL in the format [Server ID]/[Channel ID] , so you can just tell us this as is.



As a result, it ended up being a little messy, but we hope you will continue to support Discord's GIGAZINE server and GIGAZINE BOT.

in Web Application,   Notice,   Pick Up, Posted by log1c_sh