Open mcknight05 opened 1 month ago
Yes, each module has a ".settings" folder that contains the default config files. E.g. https://github.com/Yoshi-E/ArmaRconDiscordBot/tree/master/modules/core/.settings
Duplicate the settings files and change the extension from .default_json to .json. Fill in the values. Entries ending with "_description" are just the texts for the UI and can be ignored.
For your use case doing this for the modules "core", and "rcon" should be sufficient. Other modules should be disabled by default.
Perfect, I'll try that when I'm home and I'll let you know. On another note, I saw yesterday some of the descriptions in the file for start server and stop server give an example of an exe file for the armaserver file.
Since the arma server is hosted on Linux, will that still work if I put in the appropriate file?
Perfect, I'll try that when I'm home and I'll let you know. On another note, I saw yesterday some of the descriptions in the file for start server and stop server give an example of an exe file for the armaserver file.
Since the arma server is hosted on Linux, will that still work if I put in the appropriate file?
Although I realise now that was for the settings within the arma module
Yes, if you are hosting the bot on a different server, it wont be able to access the arma 3 server directly to read logs, or to start or stop it. That's why the arma module isn't of much use to you here.
In principle its just a simple subprocess.Popen call that should work on all platforms: https://github.com/Yoshi-E/ArmaRconDiscordBot/blob/098b6b73889afa8e9ed2262f0710279ffda44f58/modules/arma/module.py#L223
I have the bot running on my discord server now, thanks :) My only question is now, in which file do I modify permissions? right now I can't use any of the rcon commands
In "modules/core/" you should find the files permissions_@everyone.json
and permissions_Admin.json
etc.
Its the format of permissions_{role}.json
--> role being the name of the discord role.
So I have the bot working now with the permissions configured correctly. Most of the commands work perfectly fine. The one thing I seem to have an issue with is sending messages to server/player. When I run the command, it executes, but shows a blank message ingame.
Great to hear!
I am a bit puzzled as to why the say command is not working correctly. The say command is pretty trivial:
For some reason the message
parameter doesn't seem to be set. I am unsure why.
You could try replacing that code with this to figure out where it goes wrong:
@CommandChecker.command(name='say',
brief="Sends a global message",
pass_context=True)
async def sayGlobal(self, ctx, *message):
name = ctx.message.author.name
if not message:
await ctx.send("No message provided.")
return
message = " ".join(message)
message = self.setEncoding(message)
if not message:
await ctx.send("Encoding Broke it.")
await self.arma_rcon.sayGlobal(f"{name}: {message}")
msg = f"Send: {name}: `{message}`"
await ctx.send(msg)
If you are willing to experiment, you can try this out and report back. It is possible the encoding breaks it, or perhaps discord API changed again...
I currently do not have a setup to reproduce this issue, so you can try it out yourself or wait 1-2 weeks.
Tried with new code, bot says no message provided. Nothing shows ingame, whereas the previous code did show a blank message
Also tried the sayPlayer command, that doesn't seem to work either, unless I am imputting the command wrong. Although for my purpose I do care more about the normal say command
Thank you, that helped to identify the issue. It is in Fact a change in discords API (>Version 1.0). I will review and migrate the code at a later time, but a quick fix should be possible: https://github.com/Yoshi-E/ArmaRconDiscordBot/blob/098b6b73889afa8e9ed2262f0710279ffda44f58/modules/core/utils.py#L268-L269
Add the ctx
like so:
async def wrapper(ctx, *args,**kwargs):
return await func(ctx, *args,**kwargs)
I'll commit the changes once I verify that it didnt break anything.
Good news the say command now fully works, thanks for that :)
I did test a few tests on other commands like sayPlayer and kickPlayer which will now return a valid response on discord when I input the command, following with my player id (which I assume refers to steamid64?) but it will not perform said action ingame.
The Player ID used by most commands is the player number generated by Battleye for the current game session (not to be confused with Battleye ID or SteamID).
Use the command !players to get a list of players and their corresponding number
Here it would be e.g. 2 for the player Ztppp
Some commands come with two versions:
!banPlayer PlayerID
(Use if the player is still online)
!addBan GUID/BattleyeID
(Use if the player is already disconnected or online)
the !player+ command will provide both GUID and PlayerID of current players
if you enable the rcon_database module you can also use !find name playername
to search for people that have disconnected.
Ahhhhh right, it works perfectly now. Tried both sayPlayer and kickPlayer, working as intended.
Some commands come with two versions: !banPlayer PlayerID (Use if the player is still online) !addBan GUID/BattleyeID (Use if the player is already disconnected or online)
the !player+ command will provide both GUID and PlayerID of current players
if you enable the rcon_database module you can also use !find name playername to search for people that have disconnected.
I'll keep that in mind, anyways thanks for all the help, much appreciated and is a cool bot to have with a server
Using a discord bot host for the bot. Cannot access using localhost
Is there a way around this to still setup the bot?