Skip to content

Commit bbae120

Browse files
committed
safer wii_connect command
1 parent 2143dbe commit bbae120

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

worlds/wsr/WSRClient.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,21 +293,25 @@ def __init__(self, ctx: CommonContext):
293293
super().__init__(ctx)
294294

295295

296-
def _cmd_wii_connect(self, wii_ip: str) -> None:
296+
def _cmd_wii_connect(self, wii_ip: str = -1) -> None:
297297
"""
298298
Configures the IP address of the Wii console.
299299
300300
@param wii_ip: IP address to use when communicating with the Wii
301301
"""
302302

303+
if wii_ip == -1:
304+
logger.info("Please enter a valid IP")
305+
return
306+
303307
assert isinstance(self.ctx, WSRContext)
304308

305309
# Terminate any existing connection
306310
Utils.async_start(self.ctx.disconnect())
307311

308312
self.ctx.wii_ip = wii_ip
309313

310-
314+
@mark_raw
311315
def _cmd_debug_item(self, item_name = "") -> None:
312316
"""
313317
Send an item command for debugging purposes.
@@ -323,8 +327,7 @@ def _cmd_debug_item(self, item_name = "") -> None:
323327

324328
# Defaults to a random item
325329
if not item_name:
326-
all_names = wsr_items.keys()
327-
item_name = all_names[randint(0, len(all_names) - 1)]
330+
item_name = "Bowling (Standard) - Moving"
328331

329332
Utils.async_start(self.ctx._give_item(item_name))
330333

0 commit comments

Comments
 (0)