A Python Wrapper for the RemoteConnection SCP:SL EXILED plugin
This wrapper requires this plugin to be installed and configured on the SCP:SL Server.
Python 3 is required for this wrapper.
The Discord Bot requires discord.py
and python-dotenv
which can both be installed through pip
.
- Download and Extract the files from the Release Tab.
- Create a file named
.env
, and addTOKEN = <your bot token>
. - Open
commands.py
and on line 10, change theIP
,Port
, andPassword
to the correct values. - Start your SCP:SL server, and run the
bot.py
file to start the bot. The default prefix for the bot is=
.
####Discord Bot Commmands
playerlist
/pl
- Displays Player Listuptime
- Displays Uptime (The following commands require a role with Admin to use.)broadcast <message>
- Broadcast a message to the SCP:SL serverban <player game ID>
- Bans a player for a monthkick <player game ID>
- Kicks a player
A Server socket can be created by calling serverhandler.SCPSL(ip, port, password)
. This will create an object of the SCPSL class, that contains basic commands and actions for the plugin.
The following are functions that you can run from the SCPSL
class.
.get_player_list()
returns a list of players, thier Unique ID, and thier Game ID..get_uptime()
- Returns the number of minutes the server has been running for..broadcast()
- Broadcasts a message to the server for 5 seconds..ban_player()
- Bans a Player using their Game ID..kick_player()
- Kicks a Player using their Game ID.
The wrapper uses a function (.connect_to_socket()
) to connect to the Server, and pass/recieve information. This info is then used server side, and a response and handed back. The sockets then disconnect, allowing for future use in the same port. In this wrapper, when a command is passed through .connect_to_socket()
, a class named CommandJson
is created, containing the information that needs to be sent. It is converted to JSON, then passed to the server. The response from the server is parsed back into a seperate class named ReturnJson
which contains the command_type
passed through, the result
, and success
(which will either be 1
or 0
.)
For mote information on how the JSON should be formatted, check the main plugin repo.