11# SerialCord, serialize serial port from qemu into discord I/O
2+ import aiohttp
23import pexpect
34import discord
45import sys
@@ -14,7 +15,7 @@ def __init__(self, **options):
1415 self .no_category = 'General'
1516
1617
17- desc = 'SerialCord 2024 '
18+ desc = 'SerialCord 2026 '
1819intents = discord .Intents .default ()
1920intents .message_content = True
2021activity = discord .Game ('KenOS Pre-Alpha' )
@@ -39,6 +40,32 @@ async def on_ready():
3940 await tree .sync ()
4041
4142
43+ @tree .command (description = 'Pokaż publiczny adres IP (tylko właściciel)' )
44+ async def get_home_ip (interaction ):
45+ if config .get ('bot_owner_id' ) and interaction .user .id != config .get ('bot_owner_id' ):
46+ return await interaction .response .send_message (
47+ '❌ Ta komenda jest tylko dla właściciela bota.' ,
48+ ephemeral = True ,
49+ )
50+
51+ try :
52+ async with aiohttp .ClientSession () as session :
53+ async with session .get ('https://api.ipify.org' ) as r :
54+ public_ip = await r .text ()
55+ except Exception as e :
56+ return await interaction .followup .send (
57+ f'❌ Nie udało się pobrać IP: { e } ' ,
58+ ephemeral = True ,
59+ )
60+
61+ try :
62+ await interaction .user .send (f"Publiczny adres piwnicy w Gutkowie to { public_ip } " )
63+ except Exception as e :
64+ await interaction .followup .send (
65+ f'❌ Nie mogłem wysłać DM: { e } ' ,
66+ ephemeral = True ,
67+ )
68+
4269@tree .command (description = 'Kenify input to SerialCord' )
4370async def kenify (interaction , msg : str ):
4471 kenOS .sendline (msg [:8 ])
0 commit comments