Bot Discord

From Multi Theft Auto: Wiki
Revision as of 18:30, 20 February 2025 by Ahmed Lyy (talk | contribs) (Created page with "400px|thumb|right|Discord Bot for MTA:SA 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 n...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Discord Bot for MTA:SA

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.