CreepPork / Apollo

Discord bot that allows to get status updates on your Arma 3 server.
MIT License
17 stars 8 forks source link

Apollo doesn't work in discord servers other than the first one it's invited to #159

Closed Guac0 closed 2 years ago

Guac0 commented 2 years ago

When attempting to use the bot in a discord server other than the first server it is added to, all automatic refreshes fail due to a "Failed to edit current message" error, although bot does not crash so it just keeps trying to update the status every minute and errors. Using the !updateForce command successfully generates a new status message with correct information, but simultaneously crashes the bot with the same error (but this time an actual crash). Tested in several discord servers and same errors in each, just sometimes slightly different message IDs (and different discord server IDs that messages are in, note that the server ID doesn't actually match the ID of the server it's supposed to be currently active in) that it's trying to edit. Errors still persist if you remove the bot from all discord servers except the active one (unless of course it's active in the original server, which always works).

This is a problem for users who deploy the bot to a testing discord server before actually adding it to their community server for real, as it will be nonfunctional on the community server. Workaround: Make a second bot account and make sure to add it to your community server first, as it will only function in the first server it's added to.

Screenshot of console window attached. It successfully connected to the arma server, but the automatic refresh failed (same error would repeat if I left it run for longer and more automatic refreshes were attempted). I then ran !updateForce which successfully generated a server status message in Discord, but resulted in the same error in the console, but this time it was a fatal error/crash. apolloError

Guac0 commented 2 years ago

Note that I heard a second-hand account of someone else having this same/similar error with Apollo so it's probably not an error on my side, might have been an old version of the bot though. Also, this issue might be related to https://github.com/CreepPork/Apollo/issues/13

CreepPork commented 2 years ago

Hey there, thanks for reaching out,

This issue is different from the referenced issue because the message was created successfully per your report rather where it couldn't create it because a field was empty.

Here, I would ask, are the permissions correct for the bot? As a quick test, I would ask if you could give the bot admin privileges and see if that works, then we can narrow down the required permissions.

Also, do you see the bot in side panel where all the users are in Discord, when you select the channel were the bot sent the message?

Could you also attach a screenshot of the message that the bot posted (you can blur out some stuff like the IP if you like)?

Guac0 commented 2 years ago

No change is noticeable when admin perms are given. In both admin and basic privileges tests, bot could successfully add the reaction to the reaction message, could send messages, was visible in the channel, etc.

For producing the requested screenshot, I followed the same steps outlined in the initial post which resulted in the same console window (note that the channel ID in the error message is correct[first set of numbers], but AFAIK message ID isn't[can't be sure as I don't know if there's a way for users to search for a message by its ID]). A new status message was produced that looked normal, but bot crashed immediately after it was sent. Bot continues to work perfectly when used in the first server it is added to (I double checked that I wasn't mixing up the different channel IDs and stuff between the servers in the .env so that's probably not it). output

Also, bot status in discord shows as "bot failure" from the first attempted message edit until the crash at updateForce. I recall it being on the yellow "idle" status with same "bot failure" message in the past though instead of the green "online" status with the "bot failure" message it was today, but might be misremembering. user

EDIT: censored some extra names and profile pictures due to them using unit logos (and deleted old revisions of this comment). Also, bot doesn't actually use 127.0.0.1 as display IP for normal use, just changed it to that for this test so I wouldn't have to censor it.

CreepPork commented 2 years ago

Could you check if your bot follows the 3rd point outlined in #154?

Guac0 commented 2 years ago

Both of my Apollo bot instances (I set up a second to properly test my hypothesis of it only working in the first server it's added to) have both of those permissions. In fact, I remember forgetting to enable this permissions for the second instance of the bot during initial setup and errors appeared in the console, which were fixed by giving it the privileged gateway permissions.

image

Guac0 commented 2 years ago

Just for clarity since I saw you removing the "bug" label, it's not fixed. Me talking about the errors going away is not the same errors referenced in the first post, I was just sharing that I knew it would output different errors if privileged gateway wasn't enabled so that you would know that this wasn't the issue. (apologies if you're changing the labels from bug to question for a separate reason)

CreepPork commented 2 years ago

I added the question label because I validated that it was a configuration bug, rather than an Apollo bug by itself but re-reading your issue title I just noticed the issue.

It has never been intended for Apollo to be running on multiple servers (the same instance). Apollo looks only at the first guild server it has been attached to and works its magic there, if you have multiple guild servers, it simply wasn't programmed to do that. I didn't consider you using the same instance and same configuration options to make it work on each server.

Due to my time constraints at this time, I can't dedicate the time to Apollo to implement this issue as I deem it relatively minor.

If you want, you can create a pull-request and implement it yourself or just learn how to configure it in a new Discord server, once all the settings work, you can create a hidden channel on your old Discord server and just configure it there.

Edit: It couldn't anyways possibly work for two different Discord servers because the message IDs, role IDs and everything else are unique to a server.

CreepPork commented 2 years ago

Due to the nature of this issue, I'm closing this issue. If you think it's not correct closing this issue, feel free to reopen.