fix github spam

This commit is contained in:
Nexus 2024-09-20 01:19:57 +01:00
parent ea8ad39ac9
commit 9be4f0d55a

View file

@ -67,19 +67,16 @@ class MSCGetter(niobot.Module):
found.append(data)
if len(found) < 10 or force_fetch:
def get_first_page() -> list[dict]:
paginated_list: PaginatedList = self.gh.search_issues(
"presence",
**{
"is": "pull-request",
"repo": "matrix-org/matrix-spec-proposals"
}
)
page: list[Issue] = paginated_list.get_page(0)
return [x.raw_data for x in page]
try:
issues = await asyncio.to_thread(get_first_page)
async with httpx.AsyncClient() as client:
response = await client.get(
"https://api.github.com/search/issues",
params={
"q": "%s+is:pull-request+repo:matrix.org/matrix-spec-proposals" % query
}
)
response.raise_for_status()
issues = response.json()["items"]
except Exception:
return [
{