aio-mc-rcon
aio-mc-rcon copied to clipboard
Error: unpack requires a buffer of 4 bytes
Hello, I'm not entirely sure what to do about this error here.
async def execute_command(self, command: str, server_address: str = None, timeout=20):
success = ""
failed = ""
async with self.bot.pool.acquire() as conn:
async with conn.cursor(aiomysql.DictCursor) as cursor:
await conn.commit()
if server_address is None:
sql = "SELECT * FROM modpacks"
await cursor.execute(sql)
modpacks = await cursor.fetchall()
for modpack in modpacks:
try:
async with Client(modpack['ip_address'], modpack['rcon_port'], rcon_password) as client:
await asyncio.wait_for(client.send_cmd(command), timeout=timeout)
success += f"{modpack['server_address']}\n"
await asyncio.sleep(1)
except Exception as e:
print(e)
failed += f"{modpack['server_address']}\n"
else:
sql = "SELECT * FROM modpacks WHERE server_address = %s"
await cursor.execute(sql, (server_address, ))
modpack = await cursor.fetchone()
try:
async with Client(modpack['ip_address'], modpack['rcon_port'], rcon_password) as client:
await asyncio.wait_for(client.send_cmd(command), timeout=timeout)
success += f"{server_address}\n"
except Exception as e:
print(e)
failed += f"{server_address}\n"
if failed == "":
failed = "N/A"
if success == "":
success = "N/A"
return success, failed
Command used:
tellraw @a ["",{"text":"⭐","color":"yellow"},{"text":"==","bold":true,"color":"white"},{"text":"=","bold":true,"underlined":true,"color":"dark_green"},{"text":"=","bold":true,"underlined":true,"color":"dark_red"},{"text":"=","bold":true,"underlined":true,"color":"dark_green"},{"text":"=","bold":true,"underlined":true,"color":"dark_red"},{"text":"=","bold":true,"underlined":true,"color":"dark_green"},{"text":"=","bold":true,"underlined":true,"color":"dark_red"},{"text":"=","bold":true,"underlined":true,"color":"dark_green"},{"text":"=","bold":true,"underlined":true,"color":"dark_red"},{"text":"=","bold":true,"underlined":true,"color":"dark_green"},{"text":"=","bold":true,"underlined":true,"color":"dark_red"},{"text":"=","bold":true,"underlined":true,"color":"dark_green"},{"text":"=","bold":true,"underlined":true,"color":"dark_red"},{"text":"=","bold":true,"underlined":true,"color":"dark_green"},{"text":"=","bold":true,"underlined":true,"color":"dark_red"},{"text":"==","bold":true,"color":"white"},{"text":"⭐","color":"yellow"},"\n","To our cherished modded Minecraft family,","\n","May your holidays be as unique and creative as our world.","\n","Together, we've built more than just blocks – we've built a community.","\n","Merry Christmas and a Happy New Year, from Craft Down Under!","\n",{"text":"⭐","color":"yellow"},{"text":"==","bold":true,"color":"white"},{"text":"=","bold":true,"underlined":true,"color":"dark_red"},{"text":"=","bold":true,"underlined":true,"color":"dark_green"},{"text":"=","bold":true,"underlined":true,"color":"dark_red"},{"text":"=","bold":true,"underlined":true,"color":"dark_green"},{"text":"=","bold":true,"underlined":true,"color":"dark_red"},{"text":"=","bold":true,"underlined":true,"color":"dark_green"},{"text":"=","bold":true,"underlined":true,"color":"dark_red"},{"text":"=","bold":true,"underlined":true,"color":"dark_green"},{"text":"=","bold":true,"underlined":true,"color":"dark_red"},{"text":"=","bold":true,"underlined":true,"color":"dark_green"},{"text":"=","bold":true,"underlined":true,"color":"dark_red"},{"text":"=","bold":true,"underlined":true,"color":"dark_green"},{"text":"=","bold":true,"underlined":true,"color":"dark_red"},{"text":"=","bold":true,"underlined":true,"color":"dark_green"},{"text":"==","bold":true,"color":"white"},{"text":"⭐","color":"yellow"}]
Any help is appreciated!