Bot Discord: Difference between revisions
No edit summary |
No edit summary |
||
Line 13: | Line 13: | ||
'''community''': https://community.multitheftauto.com/index.php?p=resources&s=details&id=18961 | '''community''': https://community.multitheftauto.com/index.php?p=resources&s=details&id=18961 | ||
'''free host for bot''': https://render.com/ | |||
'''Current Version''': 1.4.0 | '''Current Version''': 1.4.0 | ||
Line 33: | Line 34: | ||
Add the bot token details in config.lua. | Add the bot token details in config.lua. | ||
if you using render must use environment variables not config for token. | |||
Start the server and use the command /start yourresourcename. | Start the server and use the command /start yourresourcename. | ||
Line 83: | Line 86: | ||
Ensure MTA is correctly configured in the script and that you have updated credentials such as username, password, host, and port to match your MTA server settings. | Ensure MTA is correctly configured in the script and that you have updated credentials such as username, password, host, and port to match your MTA server settings. | ||
my account discord is ahmedly. | |||
[[Category:Resources]] | [[Category:Resources]] |
Revision as of 20:54, 23 February 2025
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
community: https://community.multitheftauto.com/index.php?p=resources&s=details&id=18961
free host for bot: https://render.com/
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.
if you using render must use environment variables not config for token.
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.
Additional dependencies: Install discord.py, Flask, and requests using:
pip install discord.py Flask requests
Troubleshooting
Ensure the bot token is correct in config.ini.
Verify that the bot has permission to send messages in the required channel.
Use /debugscript 3 to monitor any errors within MTA.
Notes
Ensure MTA is correctly configured in the script and that you have updated credentials such as username, password, host, and port to match your MTA server settings.
my account discord is ahmedly.