Just pass the argument directly?

This commit is contained in:
Nexus 2024-09-19 17:46:09 +01:00
parent ab2eb63330
commit a35d3e870e

View file

@ -14,12 +14,12 @@ if typing.TYPE_CHECKING:
class MSCGetter(niobot.Module): class MSCGetter(niobot.Module):
if TYPE_CHECKING:
bot: "NonsenseBot"
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
def __init__(self, bot): def __init__(self, bot):
super().__init__(bot) super().__init__(bot)
if TYPE_CHECKING:
self.bot: "NonsenseBot"
self.latest_msc = None self.latest_msc = None
self.msc_cache = Path.cwd() / ".msc-cache" self.msc_cache = Path.cwd() / ".msc-cache"
self.msc_cache.mkdir(parents=True, exist_ok=True) self.msc_cache.mkdir(parents=True, exist_ok=True)
@ -125,9 +125,10 @@ class MSCGetter(niobot.Module):
async def msc( async def msc(
self, self,
ctx: niobot.Context, ctx: niobot.Context,
number: Annotated[str, niobot.Argument("number", str, greedy=True)] number: niobot.Argument("number", str, greedy=True)
): ):
"""Fetches the given MSC""" """Fetches the given MSC"""
number: str
if number.startswith("?"): # search if number.startswith("?"): # search
msg = await ctx.respond("Searching for relevant MSCs...") msg = await ctx.respond("Searching for relevant MSCs...")
results = await self.search_for_msc(number[1:]) results = await self.search_for_msc(number[1:])