22
33# Install
44
5- API: Download rcon.py and simply import it
6- Discord: Download all files and add discord_module.py to your bot as [ Cogs] ( https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html ) .
7- Example Structure:
8- discord_bot/
9- ├── bot.py (Your discord bot)
10- ├── modules/
11- │ └── rcon/
12- │ ├── __ init__ .py
13- │ ├── module.py
14- │ ├── rcon.py
15- │ └── rcon_cfg.json
5+ API: Download rcon.py and simply import it.
6+ Discord: Download all files and add discord_module.py to your bot as [ Cogs] ( https://discordpy.readthedocs.io/en/latest/ext/commands/cogs.html ) .
7+ Example Structure:
8+ discord_bot/
9+ ├── bot.py (Your discord bot)
10+ ├── modules/
11+ │ └── rcon/
12+ │ ├── __ init__ .py
13+ │ ├── module.py
14+ │ ├── rcon.py
15+ │ └── rcon_cfg.json
1616
1717# Demo
18- Check out the full demo in api_example.py.
18+ Check out the full demo in api_example.py.
1919This short example connects to a RCon server and prints all server messages it receives.
2020``` python
2121
2222def msg (message ):
23- print (message)
24-
23+ print (message)
24+
2525import ARC
2626rcon_client = rcon.ARC(" 192.168.000.001" , " MyPassword" , 2302 )
2727rcon_client.add_Event(" received_ServerMessage" , msg)
@@ -31,14 +31,15 @@ rcon_client.add_Event("received_ServerMessage", msg)
3131* [ Outbound messages can only contain ASCII charaters] ( https://github.com/Yoshi-E/Python-BEC-RCon/issues/1 )
3232
3333# Contact me:
34- Join my Discord: https://discordapp.com/invite/YhBUUSr
34+ Join my Discord: https://discordapp.com/invite/YhBUUSr
3535or on the Bohemia Interactive Forum Thread: https://forums.bohemia.net/forums/topic/223835-api-bec-rcon-api-for-python-and-discord/
3636
3737# Documentation
3838## Event Handlers:
3939The passed functions can by async and can be class objects.
40+
4041| Event | passed args |
41- | ----------------------- | :-------------: |
42+ | : ----------------------- | :-------------- |
4243| on_disconnect | none |
4344| login_Sucess | none |
4445| login_fail | none |
@@ -75,14 +76,14 @@ Closes the connection and connects to the server.
7576###### ARC.authorize()
7677Authorizes the connection using the RConPassword
7778###### ARC.send(command: str) <async >
78- Waits for an opportunity to send a command to the rcon server.
79- Only one send will be executed at a time. At most ARC.max_waiting_for_send (Defaut: 10) can be waiting
80- Will raise the "Failed to send command!" exception if it failed to send the command within the timeout limit
81- ARC.activeSend tracks how many commands are trying to be send at the same time
79+ Waits for an opportunity to send a command to the rcon server.
80+ Only one send will be executed at a time. At most ARC.max_waiting_for_send (Defaut: 10) can be waiting.
81+ Will raise the "Failed to send command!" exception if it failed to send the command within the timeout limit.
82+ ARC.activeSend tracks how many commands are trying to be send at the same time.
8283###### ARC.add_Event(event_name: str, function: function)
83- Events are: "on_command_fail", "on_disconnect", "login_Sucess", "login_fail", "received_ServerMessage" and "received_CommandMessage"
84- Function can be class function and can be asynchronous
85- Addtional, custom parameters however can not be passed
84+ Events are: "on_command_fail", "on_disconnect", "login_Sucess", "login_fail", "received_ServerMessage" and "received_CommandMessage".
85+ Function can be class function and can be asynchronous.
86+ Addtional, custom parameters however can not be passed.
8687
8788## RCon Commands:
8889See rcon.py for details
0 commit comments