Managing an ARK: Survival Evolved server can be demanding, especially when you’re juggling admin tasks and player engagement. For server administrators using Ark Server Manager (ASM), the ASM Discord bot is a powerful tool. However, extending its capabilities for cluster-wide commands and remote management can be even more beneficial. This guide will walk you through setting up a simple relay bot that works alongside your ASM Discord bot, enabling you to control your ARK server cluster directly from Discord using intuitive slash commands. While this guide is tailored for those who are not coding experts, following these steps carefully will empower you to streamline your ARK server administration.
Understanding the Relay Bot: An Extension for Your ASM Discord Bot
This relay bot is designed to complement, not replace, your existing ASM Discord bot. Think of it as an intermediary, translating your Discord commands into actions that the ASM bot can understand and execute. By setting up this relay bot, you can issue commands like starting, stopping, or backing up your entire ARK server cluster with a single Discord command.
This guide is inspired by and adapted from tutorials on creating Javascript Discord bots. For a deeper understanding of the underlying principles, we highly recommend watching Tyler Potts’ Discord V13 tutorial series. This guide provides a practical approach, but understanding the basics of Javascript bots will be beneficial for troubleshooting and customization.
Disclaimer: Please use this bot at your own risk. While thoroughly tested, there may still be unforeseen bugs. Always back up your server data regularly.
What This Relay Bot Does
In essence, this bot simplifies cluster management for ARK servers managed with ASM. It allows you to send commands to your ASM Discord bot to control multiple servers simultaneously. Imagine triggering a backup for all servers in your cluster with just one command – this relay bot makes that possible.
This guide assumes you have multiple ARK servers managed by ASM, potentially across different ASM instances. Setting up this relay bot will involve creating an additional Discord bot and making modifications to the provided code to match your server setup.
Important Note: This is not a plug-and-play solution. You will need to customize the code to fit your specific server aliases and desired commands.
Key Considerations Before You Begin
- Command Delay: The code includes a built-in 4-second delay between commands. This is crucial to prevent overwhelming the ASM Discord bot and causing errors. Do not reduce this delay; consider increasing it if you encounter issues.
- Slash Commands: This bot utilizes Discord’s slash command system for future compatibility. Be aware that slash commands are visible to everyone with permissions in your Discord server. However, they will only function for the ASM Discord bot in the designated channel.
- Permissions: The relay bot needs permission to send messages in the same Discord channel as your ASM bot. Ensure you grant the necessary permissions during setup.
Step-by-Step Guide to Setting Up Your ARK Server Relay Bot
Let’s dive into the setup process. Follow these steps carefully, paying close attention to detail, especially when modifying code files.
1. Setting Up a New Discord Bot for Relay
First, you need to create a new Discord bot application, separate from your ASM Discord bot. Follow the initial steps outlined in Bletch’s Relay Bot setup guide for creating a new bot. Invite this newly created bot to your Discord server. You will need to obtain the bot’s token and application ID, similar to how you did for the ASM bot setup.
2. Downloading and Preparing the Relay Bot Code
Download the necessary code from the GitHub repository: github.com/Karageek/ASM-Discord-Relay-Bot
Click the “Code” button and select “Download ZIP.”
Alternatively, you can download directly from this OneDrive link: One Drive Share Download
Unzip the downloaded file to a location on your system. This location can be anywhere; it doesn’t need to be on your ARK server machine, although keeping it organized there is recommended. The bot has minimal resource requirements (around 100MB of RAM).
3. Configuring the .env
File
Navigate to the unzipped folder and open the .env
file using a text editor like Visual Studio Code (recommended and free) or any code editor of your choice.
-
TOKEN: After creating your relay bot application, copy the bot token from the Bot page on the Discord Developer Portal. Paste this token into the
.env
file, replacingTOKEN=salkJUHoILjOUIYH
(example). -
GUILD_ID: Right-click on your Discord server icon in the Discord app and select “Copy ID.” If you don’t see this option, enable “Developer Mode” in Discord settings under the “Advanced” tab. Paste this server ID into the
.env
file afterGUILD_ID=324534251
(example). “Guild” is Discord’s term for “server.”
4. Modifying bot.js
for Channel ID
Open the bot.js
file in your text editor.
Locate line 55, which should look like: // client.channels.cache.get("Channel ID Here").send("*ASM Relay Bot Online*");
Identify the Discord channel where your ASM Discord bot is active. Right-click on this channel and select “Copy ID.” Paste this channel ID between the quotes on line 55, replacing “Channel ID Here.” This ensures the relay bot sends its “online” message to the correct channel.
5. Customizing Command Files (e.g., asmbackup.js
)
This is the most time-consuming part and requires careful attention. You’ll need to customize the command files (like asmbackup.js
, asmstart.js
, etc.) to match your server aliases and desired bulk commands.
Open asmbackup.js
in your editor.
Starting around line 35, you’ll see lines like: interaction.reply("asm!backup abermod");
Change "abermod"
to the Alias name of your ARK server as configured in ASM. Repeat this for each server you want to include in the bulk backup command. The structure of these commands is crucial; maintain the same format for them to work correctly.
The sleep(4000)
lines represent the 4-second delay between commands. As mentioned earlier, do not reduce this delay.
Important: Once triggered in Discord, these bulk commands will run to completion without interruption. Exercise caution when testing and using them in a live environment.
Repeat this customization process for all command files (e.g., asmstart.js
, asmstop.js
, etc.) based on the bulk commands you want to use. The provided code template includes examples for various server commands. If you have multiple ASM instances, you’ll need to use separate relay bots for each, modifying the command prefixes accordingly (explained in step 5 of the original article, referring to prefixes like asm!
, xsm!
, psm!
). Delete any command files you don’t need to keep your bot streamlined. Using asm!info
or similar non-destructive commands for initial testing is highly recommended.
6. Installing Node.js
To run the bot, you need Node.js installed on the server or computer where you plan to run it. Download Node.js from nodejs.org/en/download/. Choose the “Windows Installer (.msi) 64-bit” option for Windows servers. If you are using a different operating system, follow the appropriate installation instructions for your OS.
7. Node.js Installation
Run the Node.js installer, using the default settings throughout the installation process. On the “Tools for Native Modules” page, you can leave the checkbox unchecked as it’s not required for this bot.
8. Running the Relay Bot
After installation, open File Explorer and navigate to the folder where you unzipped the relay bot files. In an empty area within the folder, Shift+Right-Click and select “Open PowerShell window here.”
In the PowerShell window, type npm run dev
(without quotes) and press Enter.
This command launches the bot. You should see output in the PowerShell window, including lines like “ASM Relay online” and “Successfully registered commands locally.” If the bot has the correct permissions, it will also post “ASM Relay Bot Online.” in the Discord channel you configured in step 4.
9. Keeping the Bot Running
The PowerShell window needs to remain open for the bot to continue running. You can minimize the window but do not close it. Consider using a process manager if you need the bot to run persistently in the background.
10. Whitelisting the Relay Bot in ASM
For security, it’s strongly recommended to whitelist your relay bot’s ID in the ASM Discord Bot settings.
In Discord, right-click on your relay bot and select “Copy ID.”
Open Ark Server Manager, click the “GEAR” icon for server settings, and scroll down to the “Discord Bot” section.
Click the “+” (plus sign) next to “Bot Whitelist,” click in the empty box, and paste the relay bot’s ID.
11. Testing Your Relay Bot
Now you are ready to test your relay bot in Discord.
Go to the Discord channel where both your relay bot and ASM Discord bot are active and authorized. Type /asm-
(or the prefix you configured). This should display a list of available slash commands defined in the .js
files (e.g., /asm-backup
, /asm-start
, /asm-info
).
Select a command (e.g., /asm-info
) and execute it. Monitor the ASM Discord bot channel to confirm that the relay bot successfully sends the command and the ASM bot responds accordingly.
Need More Help?
For further questions or assistance, you can contact AshleyLee#1988 on Discord or email [email protected].
License
This ARK ASM Relay Bot is open-source and licensed under:
- Attribution-NonCommercial 4.0 International
- GNU GPLv3 License
Feel free to modify and share this code according to the terms of these licenses.