|Discord bots connect to Discord's infrastructure at an intimate API level, and once enabled into a given "guild" or server, begin receiving a massive stream of events. These can be anything from ordinary channel messages to any administrative changes, arrival and departure of users, rearrangement of channels and roles and permissions, connect and disconnect to audio/video channels, etc. In most setups, the "bot sees all" because it's often serving to auto-moderate conversation traffic, but now I was curious whether Discord's infrastructure would honor its own permission structure and withhold events that a bot's permissions would prevent it [as a "user"] from receiving. In other words: would disallowing a bot's purview of most channel traffic physically limit the number of "regular" events being transmitted? Most bots have their own support servers, so I went off to those to try and find out.|
|One problem with large and busy public forums like these is the number of incompetent trolls who just hang out there to insult people for asking legitimate questions. Fortunately, there are also truly helpful folks who work with this stuff all day and actually know the backend workings, or at the very least where else to ask and have a better chance of receiving solid information.|
|Once the *helpful* folks realized that I was asking something fairly genuine, they were a little more forthcoming. Their bottom line was that it probably didn't matter much, but couldn't hurt to limit things for an assortment of reasons.|
|I asked the same thing into the Dyno forum, and after the same apparently necessary round of troll-filtering, got more reasonable answers. And additional reasons why letting *everything* get hoovered up by a bot might not be the best idea in general.|
If we look at some basic bot stats, the volume of a popular one like YAGPDB
is really enormous.
A million and a half servers, all spewing events at once.
Now that's split across something over
so the stream volume to any one parsing engine could still be in the
hundreds of items per second.
In any of those blocks, we usually see between 100 and 300 per second, for
an average around 150 e/s per shard.
And I'll bet 95% of that is total fluff that isn't worth sending.
But what if server operators were more discerning, and were willing to at least limit traffic across 100 channels down to less than 10? Other than guild-wide events like user and role changes and other admin stuff, bot-driven things like rolemenus, command handlers, and even moderation could theoretically be confined to a much smaller purview. It's like pollution; if everyone cleans up their own little act, the world benefits.
|Another helpful dev-level type person from the YAGPDB camp who spotted my question chimed in very late in the game, but with more confirmation that my theory was at least partially correct. At this point the bots I was using were configured with a fairly limited view of the Arisia server, so after that initial big crash hiccup that wasn't anyone's fault, we were doing just fine with it.|