Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust compatible? #1

Open
Flash-Ticker opened this issue Jun 16, 2024 · 0 comments
Open

Rust compatible? #1

Flash-Ticker opened this issue Jun 16, 2024 · 0 comments

Comments

@Flash-Ticker
Copy link

Hey,
Is it also compatible with the game Rust?
I have the problem that I can establish a connection but cannot query any data?
`import discord
from discord.ext import commands, tasks
from discord.commands import slash_command
from gamercon_async import GameRCON

class RCONCog(commands.Cog):
def init(self, bot):
self.bot = bot
self.rcon_host = '12.123.12.123' #Blur
self.rcon_port = 28016
self.rcon_password = '123456' #Blur
self.get_server_name.start()

def cog_unload(self):
    self.get_server_name.cancel()

@slash_command(name="rconstatus", description="Überprüft den Status der RCON-Verbindung.")
async def check_rcon_status(self, ctx):
    try:
        client = GameRCON(self.rcon_host, self.rcon_port, self.rcon_password, timeout=10)
        async with client as rcon:
            await rcon.connect()
            response = await rcon.send('status')
            await ctx.send(f"RCON-Verbindung erfolgreich. Server-Status: {response}")
    except Exception as e:
        await ctx.send(f"Fehler beim Verbinden mit RCON: {str(e)}")

@tasks.loop(seconds=60)
async def get_server_name(self):
    try:
        client = GameRCON(self.rcon_host, self.rcon_port, self.rcon_password, timeout=10)
        async with client as rcon:
            await rcon.connect()
            server_name = await rcon.send('hostname')
            print(f"Aktueller Servername: {server_name}")
    except Exception as e:
        print(f"Fehler beim Abrufen des Servernamens: {str(e)}")

@get_server_name.before_loop
async def before_get_server_name(self):
    await self.bot.wait_until_ready()

def setup(bot):
bot.add_cog(RCONCog(bot))
`

he always says:
Fehler beim Abrufen des Servernamens: Authentication failed - Timeout while reading data from server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant