Jump to content
Yoshi_E

[API] BEC RCon API for Python and Discord

Recommended Posts

Python API BEC_RCon v0.1.1
Github: https://github.com/Yoshi-E/Python-BEC-RCon

 

This might be late by about 5 years or so, but here is an API for Battleyes Extended Control - Rcon.

Our Server uses Discord a lot. You are on the go and receive a ping that a user needs to get banned? Or maybe the server crashed? 
With this API or Discord module you can directly connect to your server and resolve the issue.
You want to automate server restart, resets, or shutdowns? Yep, can be done with this API.

You want to get a notification when somebody asks ingame for help? All possible with this API.

Loading missions at specific times can also be done now!

 

Works on all platforms! (Windows, Linux, MacOSX)

 

API and Discord:

The API is just a straight forward standalone implementation of accessing BEC RCon without having to worry about anything else. Discord is not needed for it!

Install:

pip install git+https://github.com/Yoshi-E/Python-BEC-RCon.git

To upgrade to the lastest version:

pip install git+https://github.com/Yoshi-E/Python-BEC-RCon.git -U

Version:

  • 0.1.0: Initial release (20.06.2019)
  • 0.1.1: Fixed loadMission, +tweaks (24.06.2019)

 

More details about the API can be found on Github

 

 

 

Discord Bot
Github: https://github.com/Yoshi-E/ArmaRconDiscordBot

Discord module needs to be v1.2.2

This is just an example, not a complete bot! You need python3.6 or greater, and a Discord bot token, to run this example. A Full guided will be provided soon!

Spoiler

 

The Discord module currently support these commands:

Current features:

  • addBan Ban offline player
  • admins lists current admins on the server
  • banPlayer Ban online player
  • changePassword Changes the RCon password
  • command Sends a custom command to the server
  • getBEServerVersion Gets the current version of the BE server
  • getBans Lists most recent bans
  • getChat Sends a custom command to the server
  • getMissions Gets a list of all Missions
  • goVote Users can vote for the mission selection.
  • kickPlayer Kicks a player who is currently on the server
  • loadBans (Re)load the BE ban list from bans.txt
  • loadMission Loads a mission
  • loadScripts Loads the 'scripts.txt' file without the need to restart...
  • loadEvents Loads Events 
  • lock Locks the server. No one will be able to join
  • maxPing Changes the MaxPing value. 
  • monitords Shows performance information in the dedicated server console. Interval 0 means to stop monitoring.
  • players lists current players on the server
  • reassign Shuts down the server after mission ends
  • removeBan Removes a ban 
  • restart Restart mission with current player slot selection
  • restartM Shuts down and restarts the server after mission ends
  • restartServer Shuts down and restarts the server immediately
  • say Sends a global message
  • sayPlayer Sends a message to a specific player
  • shutdown Shutdowns the Server
  • shutdownM Shuts down the server after mission ends
  • unlock Unlocks the Server

Special commands:

  • status Current connection status
  • debug Toggles RCon debug mode
  • getChat Returns most recent chat messages
  • checkAFK Checks if a player is AFK by testing if he responds in chat.
  • players+ Lists all players with their Flag and BEID
  • addKeyWord Add a keyword to triggers a DM to you. (Use „\_“ as space)
  • removeKeyWord Removes a keyword
  • listKeyWords Lists all your keywords
  • setNotification Mute the bot, or tell him to send those messages only when you are online.
  •  
  • streamChat streams all messages from the arma 3 server into the channel where you used the command. (Is persistent)
  • stopStream Stops the stream
  •  
  • The following commands are disabled until configured:
  • start Starts the arma Server Binary
  • stop Stops the arma Server (only works on Windows for now)

 

Planned features are:

  • Discord: Notification on keywords

 

Works on all platforms! (Windows, Linux, MacOSX)

License: https://creativecommons.org/licenses/by-nc-sa/4.0/

 

Known Issues:

  • Outbound messages can only contain ASCII charaters

 

How it looks in Discord:

P0JvSqf.png

 

 

 

 

  • Like 5
  • Thanks 1

Share this post


Link to post
Share on other sites

The API now comes as a package! Version 0.1.0 has been released!
You can directly install it with:

pip install git+https://github.com/Yoshi-E/Python-BEC-RCon.git

Then simply import it with

Quote

 

import bec_rcon

rcon_client = bec_rcon.ARC("192.168.0.1", "MyPassword", 2302)

 

 

Many new commands have been added, together with some additional tweaks.
Added detailed documentation on the API.

  • Thanks 1

Share this post


Link to post
Share on other sites

This would be great to have at least the same functionality like in a Zupa Bot https://bot.devzupa.be/ (this current link just an example. Web version of a bot not working now. Just a standalone version.) For me - my favorite feature is to see the country flag of a player.

This is a commands list https://bot.devzupa.be/commands

Share this post


Link to post
Share on other sites
23 hours ago, varrkan_ua said:

This would be great to have at least the same functionality like in a Zupa Bot

Other than the player+ (wich is now added) all commands and many more are supported.

 

 

---------------------------------------------------------------------------

 

bec_rcon API has been updated to 0.1.1 (fixed loadMission)

Update with:

pip install git+https://github.com/Yoshi-E/Python-BEC-RCon.git -U

Discord module has been updated:

  • getChat Returns most recent chat messages
  • checkAFK Checks if a player is AFK by testing if he responds in chat, does he not, he gets kicked
  • players+ Lists all players with their Flag and BEID
  • loadEvents Loads Events 

  • Like 2

Share this post


Link to post
Share on other sites

is it possible to start a server with this bot?

Share this post


Link to post
Share on other sites
On 7/22/2019 at 9:37 PM, SantoJ said:

is it possible to start a server with this bot?

no. But could be added if you run the python script on your server.

Share this post


Link to post
Share on other sites
56 minutes ago, Dedmen said:

no. But could be added if you run the python script on your server.

I already figured out a simple solution for his problem on Discord with him.

https://pastebin.com/i4nhrnLB

the same commands are also in the main bot too.

 

 

 


The discord bot is now a proper standalone Discord bot, rather than just a Cogs module.

Improved code structure.

 

Added new commands:

Get a notification when a player types specific keywords on the server:

addKeyWord Add a keyword to triggers a DM to you. (Use „\_“ as space)

removeKeyWord Removes a keyword

listKeyWords Lists all your keywords

setNotification Mute the bot, or tell him to send those messages only when you are online.

 

streamChat streams all messages from the arma 3 server into the channel where you used the command. (Is persistent)

stopStream Stops the stream

 

The following commands are disabled until configured:

start Starts the arma Server Binary

stop Stops the arma Server (only works on Windows for now)

 

In the Core Module you can also configure the channels the bots listens to now. Useful if you have multiple instances of the same bot.

  • Like 2

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×