creeppork / apollo Goto Github PK
View Code? Open in Web Editor NEWDiscord bot that allows to get status updates on your Arma 3 server.
License: MIT License
Discord bot that allows to get status updates on your Arma 3 server.
License: MIT License
Once the bot is running and polling our server it shows "Playing Zeus on [map] (X/30)" instead of stating the mission name. For instance, if the mission is called "Operation Curtains Down", shouldn't the bot be saying "Playing Operation Curtains Down on [map] (X/30)"?
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.
This could be possibly used to display the player list and other vital info more quickly.
This would prevent it from throwing errors and would stop it pinging the server and not ping the role.
Sentry Issue: APOLLO-11-C
DiscordAPIError: Unknown Message
If there is a bot failure event then when using !updateForce
it doesn't remove the message ID from settings so it continues to fail because the message got deleted.
Noticeable when toggling maintenance mode.
Sentry Issue: APOLLO-11-5
DiscordAPIError: Invalid Form Body
embed.fields[2].value: This field is required
This happened because Discord changed their API by deploying their intention-based Gateway API, which in turn, broke the underlying code library used to communicate with the Discord API, discord.js
. You can see their FAQ update here.
discord.js
now requires a newer version of Node.js, you must upgrade Node.js to at least v12.x
.v3
. You can do this, by doing this:git pull origin master
npm install
npm run build
Privileged Gateway Intents
to function correctly. To set this up correctly, navigate to your Bot application page in the Discord Developer portal (e.g. https://discord.com/developers/applications/xxxx/bot
). Here you'll need to flip the toggle for SERVER MEMBERS INTENT
to on.Now, Apollo should be working fine!
Using Discord reactions, Apollo could generate a message (similar to how it does with server status), and put an emoji of the users' choice on the message. The message could contain basic stats of the server, maybe player count, map, etc, and whether or not maintenance mode is on. Upon clicking the reaction, the bot checks if you have the correct role to manage the bot, and if you do, it'll enable maintenance mode.
So basically, just a reaction message that allows you to toggle maintenance mode without flooding the channel with bot commands all the time. Could branch off into other features as well.
One common example would be when Discord goes down, it loses auth with Discord and requires a restart of the bot.
From eatpantboio on Discord:
I have a suggestion: Make a role that gets pinged whenever there are a significant amount of people on the public server (ex. 6 or more) Me and a few others would probably find that handy as constantly having to check #📄-public_server_info ends up being a bit annoying and I usually forget to do so
Additional Suggestions
Hello @CreepPork i have a problem with the bot, when i try to connect this to my server, i have this message
Bot has logged in
Apollo is ready.
Performing first-start refresh.
Error: Failed all 2 attempts
at QueryRunner.run (/apollo/Apollo/node_modules/gamedig/lib/QueryRunner.js:88:21)
Attempt #1 - Port=2333 Retry=0:
Error: UDP - Timed out after 2000ms
at Timeout.setTimeout (/apollo/Apollo/node_modules/gamedig/lib/Promises.js:7:25)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10)
Attempt #2 - Port=2332 Retry=0:
Error: UDP - Timed out after 2000ms
at Timeout.setTimeout (/apollo/Apollo/node_modules/gamedig/lib/Promises.js:7:25)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10)
Failed to refresh server info. Remaining retries: 1/3
I try with 2 VPS on debian (same problem)
I try différent arma ip server (and a server arma with your bot)
if you have an idea 👍
Receiving the following error on npm start after building and configuring my .env file.
PS C:\Arma3\Apollo> npm start
> [email protected] start
> node .
Error: Incorrect login details were provided.
at WebSocketConnection.<anonymous> (C:\Arma3\Apollo\node_modules\discord.js\src\client\ClientManager.js:48:41)
at Object.onceWrapper (node:events:434:26)
at WebSocketConnection.emit (node:events:327:20)
at WebSocketConnection.EventEmitter.emit (node:domain:486:12)
at WebSocketConnection.onClose (C:\Arma3\Apollo\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:390:10)
at WebSocket.onClose (C:\Arma3\Apollo\node_modules\ws\lib\event-target.js:124:16)
at WebSocket.emit (node:events:327:20)
at WebSocket.EventEmitter.emit (node:domain:486:12)
at WebSocket.emitClose (C:\Arma3\Apollo\node_modules\ws\lib\websocket.js:191:10)
at TLSSocket.socketOnClose (C:\Arma3\Apollo\node_modules\ws\lib\websocket.js:850:15)
at TLSSocket.emit (node:events:339:22)
at TLSSocket.EventEmitter.emit (node:domain:486:12)
at node:net:656:12
at TCP.done (node:_tls_wrap:563:7)
C:\Arma3\Apollo\node_modules\discord.js\src\client\ClientManager.js:48
if (event.code === 4004) reject(new Error(Constants.Errors.BAD_LOGIN));
^
Error: Incorrect login details were provided.
at WebSocketConnection.<anonymous> (C:\Arma3\Apollo\node_modules\discord.js\src\client\ClientManager.js:48:41)
at Object.onceWrapper (node:events:434:26)
at WebSocketConnection.emit (node:events:327:20)
at WebSocketConnection.EventEmitter.emit (node:domain:486:12)
at WebSocketConnection.onClose (C:\Arma3\Apollo\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:390:10)
at WebSocket.onClose (C:\Arma3\Apollo\node_modules\ws\lib\event-target.js:124:16)
at WebSocket.emit (node:events:327:20)
at WebSocket.EventEmitter.emit (node:domain:486:12)
at WebSocket.emitClose (C:\Arma3\Apollo\node_modules\ws\lib\websocket.js:191:10)
at TLSSocket.socketOnClose (C:\Arma3\Apollo\node_modules\ws\lib\websocket.js:850:15)
at TLSSocket.emit (node:events:339:22)
at TLSSocket.EventEmitter.emit (node:domain:486:12)
at node:net:656:12
at TCP.done (node:_tls_wrap:563:7)
npm ERR! code 1
npm ERR! path C:\Arma3\Apollo
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c "node ."
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\*********\AppData\Local\npm-cache\_logs\2020-10-30T13_50_59_820Z-debug.log
PS C:\Arma3\Apollo>
My ENV:
IP=xx.xxx.xxx.xxx
DISPLAY_IP=xx.xxx.xxx.xxx
PORT=2302
COLOR_OK=3779158
COLOR_ERROR=14370117
COLOR_MAINTENANCE=2526162
LOCALE=en
REFRESH_COMMAND="!a info"
REFRESH_FORCE_COMMAND="!a info force"
LIMIT_REFRESH_FORCE_TO_MANAGER=true
REPLY_DM_ON_NO_PERMS=false
MAINTENANCE_TOGGLE_COMMAND="!a maint"
REACTION_MESSAGE_ID=
REACTION_ROLE_ID=
REACTION_EMOJI=🚨
MINIMUM_PLAYER_COUNT_FOR_PING=6
TIMEOUT_BETWEEN_PLAYER_PINGS_IN_MINUTES=40
CHANNEL_ID=xxxxxxxxxxxxxxxxxxx
SERVER_MANAGER_ROLE_ID=Xxxxxxxxxxxxxxxxxx
TIME_TO_CHECK_MINUTES=1
MAXIMUM_REFRESH_FAILURES=3
SENTRY_DSN=
SECRET=xxxxxxxxxxxxx
I don't see anywhere to define the discord bot API tokens. Where do I do that?
DiscordAPIError: Invalid Form Body embed.fields[5].value: Must be 1024 or fewer in length. at /root/armaLvServer/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:85:15 at /root/armaLvServer/node_modules/snekfetch/src/index.js:215:21 at processTicksAndRejections (internal/process/task_queues.js:89:5) { name: 'DiscordAPIError', message: 'Invalid Form Body\nembed.fields[5].value: Must be 1024 or fewer in length.', path: '/api/v7/channels/579041656427511808/messages/579043913957113888', code: 50035, method: 'PATCH' }
Firstly I’d just like to say thanks for the release!
And also, I think adding support for monitoring multiple servers would be a useful feature.
Line 25 in 15e5d52
/root/xxx/dist/discord.js:224
const roles = this.getAllRoles(member.guild.id);
^
TypeError: Cannot read property 'guild' of null
at Discord.doesUserHaveServerManagerPermissions (/root/xxx/dist/discord.js:224:47)
at Bot.refreshBotWithRolePermissions (/root/xxx/dist/bot.js:107:26)
at Bot.onMessage (/root/xxx/dist/bot.js:61:22)
at Client.<anonymous> (/root/xxx/dist/bot.js:51:59)
at Client.emit (events.js:315:20)
at Client.EventEmitter.emit (domain.js:483:12)
at MessageCreateHandler.handle (/root/xxx/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
at WebSocketPacketManager.handle (/root/xxx/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:105:65)
at WebSocketConnection.onPacket (/root/xxx/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (/root/xxx/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
at WebSocket.onMessage (/root/xxx/node_modules/ws/lib/event-target.js:120:16)
at WebSocket.emit (events.js:315:20)
at WebSocket.EventEmitter.emit (domain.js:483:12)
at Receiver.receiverOnMessage (/root/xxx/node_modules/ws/lib/websocket.js:789:20)
at Receiver.emit (events.js:315:20)
at Receiver.EventEmitter.emit (domain.js:483:12)
at Receiver.dataMessage (/root/xxx/node_modules/ws/lib/receiver.js:422:14)
at Receiver.getData (/root/xxx/node_modules/ws/lib/receiver.js:352:17)
at Receiver.startLoop (/root/xxx/node_modules/ws/lib/receiver.js:138:22)
at Receiver._write (/root/xxx/node_modules/ws/lib/receiver.js:74:10)
at doWrite (_stream_writable.js:403:12)
at writeOrBuffer (_stream_writable.js:387:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-10-31T15_16_08_250Z-debug.log
bot has been running fine for a while but its now spitting errors when running any of these commands
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.