fix msc search
This commit is contained in:
parent
eaa195fb7b
commit
0fafbb4981
1 changed files with 9 additions and 3 deletions
|
@ -2,6 +2,7 @@ import json
|
|||
import logging
|
||||
import re
|
||||
import typing
|
||||
from typing import Annotated
|
||||
|
||||
import httpx
|
||||
from pathlib import Path
|
||||
|
@ -65,13 +66,13 @@ class MSCGetter(niobot.Module):
|
|||
response = await client.get(
|
||||
"https://api.github.com/search/issues",
|
||||
params={
|
||||
"q": query,
|
||||
"q": query + "+is:pull-request+repo:matrix-org/matrix-spec-proposals",
|
||||
"per_page": 10
|
||||
}
|
||||
)
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
for pr in data:
|
||||
for pr in data["items"]:
|
||||
found.append(pr)
|
||||
number = pr["number"]
|
||||
file = self.msc_cache / ("%d.json" % number)
|
||||
|
@ -119,7 +120,12 @@ class MSCGetter(niobot.Module):
|
|||
return f"* [{data['title']}]({data['html_url']})"
|
||||
|
||||
@niobot.command()
|
||||
async def msc(self, ctx: niobot.Context, number: str):
|
||||
async def msc(
|
||||
self,
|
||||
ctx: niobot.Context,
|
||||
*,
|
||||
number: Annotated[str, niobot.Argument("number", str, greedy=True)]
|
||||
):
|
||||
"""Fetches the given MSC"""
|
||||
if number.startswith("?"): # search
|
||||
msg = await ctx.respond("Searching for relevant MSCs...")
|
||||
|
|
Loading…
Reference in a new issue