Bot Discord
This resource is designed to connect an MTA:SA server with a Discord server.
This page is always updated for the latest bot version!
Status: Open Source & Work in Progress
Github Repository: https://github.com/Ahmed-Ly/botdiscord
Current Version: 1.4.0
Features
Send and receive messages between Discord and MTA:SA
Execute admin commands via Discord
Support for sending server notifications to a Discord channel
Installation Guide
Download the files from the link above.
Place the discord-bot folder inside the resources folder in MTA:SA.
Update mtaserver.conf to add the resource to the list.
Add the bot token details in config.lua.
Start the server and use the command /start yourresourcename.
Usage
1. Sending Messages from Discord to MTA
When a message is sent in the designated Discord channel, it will automatically appear in-game.
2. Executing Admin Commands from Discord
Admins in Discord can use the following command:
!kick playerName reason
and the player will be kicked from the server.
3. Sending Notifications from MTA to Discord
When a new player joins, a notification will be sent to the designated Discord channel:
addEventHandler("onPlayerJoin", root, function() local playerName = getPlayerName(source) sendDiscordMessage("" .. playerName .. " has joined the server!") end)
Requirements
MTA:SA server running version 1.6.0 or later.
A Discord bot activated with a token.
discordia or discord.py library on the server.
Troubleshooting
Ensure the bot token is correct in config.lua.
Verify that the bot has permission to send messages in the required channel.
Use /debugscript 3 to monitor any errors within MTA.