bottleclip: Add better error handling
This commit is contained in:
parent
7fc04ccfa2
commit
3a721d9e29
1 changed files with 5 additions and 3 deletions
8
main.py
8
main.py
|
@ -72,7 +72,7 @@ async def state(ctx):
|
|||
|
||||
# !co2
|
||||
@HobbyBot.command(description="co2 levels")
|
||||
async def co2(ctx, where='hoofdruimte'):
|
||||
async def co2(ctx, where="hoofdruimte"):
|
||||
async with ctx.typing():
|
||||
try:
|
||||
msg = await mqtt_get_one(f"bitlair/climate/{where}/co2_ppm")
|
||||
|
@ -115,7 +115,7 @@ async def np(ctx):
|
|||
|
||||
# !bottleclip
|
||||
@HobbyBot.command(description="Generate a bottle-clip STL file suitable for printing")
|
||||
async def bottleclip(ctx, icon: str, ears: bool = False):
|
||||
async def bottleclip(ctx, icon: str = "", ears: bool = False):
|
||||
git_api = "https://git.bitlair.nl/api/v1"
|
||||
owner = "bitlair"
|
||||
repo = "bottle-clip"
|
||||
|
@ -139,7 +139,9 @@ async def bottleclip(ctx, icon: str, ears: bool = False):
|
|||
"pixel-cats/standing-right.svg",
|
||||
}
|
||||
if icon not in icons:
|
||||
await ctx.reply(f"arg1 must be one of {', '.join(icons)}")
|
||||
await ctx.reply(
|
||||
f"usage: `!bottleclip <icon> [<ears y|n>]`\n* `icon` must be one of {', '.join(icons)}"
|
||||
)
|
||||
return
|
||||
|
||||
async with ctx.typing():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue