A full featured Discord bot plugin for AMP by Cubecoders that can be used to display the server status in a dynamically updating info panel along with the ability to manage the server directly from Discord.
- Use buttons or commands to start/stop/restart/kill/update/manage.
- Send console commands directly from Discord to your server.
- Send server output to a Discord channel.
- Track playtime of players.
- Assign permissions to a role so only select members can manage the server.
Important
The plugin cannot be used on ADS. It can only run on non-ADS instances.
Submit any bug reports or feature requests here
Any known issues and workarounds can be found here
If you appreciate my work on this plugin, feel free to buy me a beer to keep me fueled up here
Discord Info Panel:
Web Panel:
Command | Description |
---|---|
/[BOT NAME] info |
Display Server Info |
/[BOT NAME] start-server |
Start the Server |
/[BOT NAME] stop-server |
Stop the Server |
/[BOT NAME] restart-server |
Restart the Server |
/[BOT NAME] kill-server |
Kill the Server |
/[BOT NAME] update-server |
Update the Server |
/[BOT NAME] console [command] |
Send a command to the server |
/[BOT NAME] playtime |
Show playtime leaderboard |
/[BOT NAME] full-playtime-list |
Show full playtime list with last seen value |
/[BOT NAME] take-backup |
Send a request to the AMP Panel to create an instance backup |
Note: If Remove Bot Name
is enabled in settings then the commands will exclude the name.
Thanks to Bluscream there is now a handy install script to take care of activating instances, downloading the plugin, and enabling it.
The script can be found here.
For instructions to run the script, see here.
Before the plugin can be used you need to configure AMP in a specific way. NOTE: The plugin cannot be used on ADS. It can only run on non-ADS instances.
- Request a developer licence from AMP via the licence portal https://manage.cubecoders.com/Login
- Once you have received the licence log into your server console and as the amp user run
ampinstmgr stop [ADS INSTANCE NAME]
followed byampinstmgr reactivate [INSTANCE NAME] [DEVELOPER KEY]
where[INSTANCE NAME]
is the name of your instance you want to set up a bot for and[DEVELOPER KEY]
is the key received from CubeCoders. - Start your ADS instance again with
ampinstmgr start [ADS INSTANCE NAME]
.
- Edit the AMPConfig.conf file in the root folder of your instance (e.g.
/home/amp/.ampdata/instances/INSTANCENAME01/AMPConfig.conf
) - Under AMP.LoadPlugins add
DiscordBotPlugin
to the list (e.g.AMP.LoadPlugins=["FileManagerPlugin","EmailSenderPlugin","WebRequestPlugin","LocalFileBackupPlugin","CommonCorePlugin","DiscordBotPlugin"]
) - In the plugins folder for your instance (e.g.
/home/amp/.ampdata/instances/INSTANCENAME01/Plugins/
) create a new folder calledDiscordBotPlugin
and insert the .dll file from the current release - Restart your instance with
ampinstmgr restart [INSTANCE NAME]
- Log in to your instance and you will see a new menu item under Configuration for the Discord Bot
- Log in to https://discord.com/developers/applications with your Discord account.
- Click
New Application
- Enter a name for your application and click
Create
- Click
Bot
on the menu bar along the left, then clickAdd Bot
- Give your bot an icon and enable
Server Members Intent
(this is to ensure that cached member groups are not used if using permissions for controlling servers (start/stop/update/restart/kill)) ANDMessage Content Intent
(this is for writing chat messages back to Minecraft servers if enabled) - Save your changes
- Copy your bot token and paste it in the token field of the Discord Bot menu in AMP
- Click the
OAuth2
option on the left hand menu followed byURL Generator
- Select
bot
andapplications.commands
followed bySend Messages
,Manage Messages
,Embed Links
, andRead Message History
- Copy the resulting URL and paste into a new browser tab
Tip
The resulting URL will be similar to this, but with your application ID under client_id
:
- Log in if nedded and add the bot to your Discord server by selecting it in the list
- If you plan to use pemissions for the server commands, create a new role on your Discord server to use later on.
Option | Description |
---|---|
Discord Bot Token | Enter your Discord bot token here |
Bot Tagline | This is in the footer of the messages from the bot |
Server Display Name | Name of the server displayed in the info panel |
Server Connection URL | URL that players can use to join the game server |
Server Password | If you have a server password that you want your users to see enter it here |
Modpack URL | This will show as a link in the info panel, useful if you are running a modpack or have a steam workshop collection for the server mods being used |
Game Image URL | A publicly accessible image to be shown in the info panel |
Valid Player Count | Set to true if the server has a valid player count, this will determine if the online count is shown in Discord |
Bot Activated | If the bot should be activated |
Bot Refresh Interval | How often, in seconds, the bot should update the presence and info message. Recommended minimum 30 seconds otherwise requests to Discord could be throttled |
Restrict Functions to Discord Role | If server commands (start/stop/restart/kill/update) should be restricted to a Discord Role |
Discord Role Name | Role name associated with the permissions for the previous setting |
Log Button Presses and Commands | Toggle if button presses and command use should be logged |
Button Log Channel (Name OR ID) | Name or ID of the channel to log button presses in. If blank it will be logged to the same channel as the info panel |
Post Join and Leave Messages | If the bot should post user join and leave events to a Discord channel |
Post Join and Leave Messages Channel (Name OR ID) | Channel name or ID for the bot to post join and leave events to (only if enabled) |
Base Management URL | Address to be used to manage instances. Should be in the format of amp.domain.com or your external IP address |
Display Start Button | Toggle the start button on the info panel |
Display Stop Button | Toggle the stop button on the info panel |
Display Restart Button | Toggle the restart button on the info panel |
Display Kill Button | Toggle the kill button on the info panel |
Display Update Button | Toggle the update button on the info panel |
Display Manage Button | Toggle the manage button on the info panel |
Display Backup Button | Toggle the backup button on the info panel |
Display Online Player List | Show a list of online players in the info panel (if supported) |
Change Displayed Status | Change default AMP status text to custom (see here) |
Online Server Bot Presence Text | Change the presence text when the application is running. Use {OnlinePlayers} and {MaximumPlayers} as variables |
Display Playtime Leaderboard | Toggle the playtime leaderboard on the info panel |
Remove Bot Name | Removes the bot name from the base command to allow granular permissions from within the Discord server settings |
Additional Embed Field Title | Add an additional field in the info panel embed, put your title here |
Additional Embed Field Text | Add an additional field in the info panel embed, put your content here |
Send Chat to Discord | Send chat messages to a Discord channel |
Chat Discord Channel | Discord channel name to send chat messages to (if enabled) |
Send Chat from Discord to Server | Attempt to send chat messages from Discord chat channel to the server (currently only supported for Minecraft) |
Send Console to Discord | Send console output to a Discord channel |
Console Discord Channel | Discord channel name to send console output to (if enabled) |
Enable Web Panel | Enable the web panel. This will create a html file in a similar format to the Discord info panel for website embeds. Additional steps are required to map the html file to make it accessible. See the Wiki |
The Discord Bot Colours
section give you the ability to change the colour of your embedded messages in Discord. For each option you want to change insert the hex colour code required.
The Discord Bot Game Specific
section is for game specific settings. These will be added over time as requested.
Option | Description |
---|---|
Valheim Join Code | Keep track of the Valheim join code in the console output and add it to the info panel accordingly |