Skip to content
This repository has been archived by the owner on Dec 13, 2024. It is now read-only.

Commit

Permalink
Add !!/issue close
Browse files Browse the repository at this point in the history
  • Loading branch information
gingershaped committed Nov 29, 2023
1 parent 001d505 commit 8023b47
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions vyxalbot2/commands/se.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,29 @@ async def issueOpenCommand(self, event: EventInfo, repo: str, title: str, body:
except BadRequest as e:
yield f"Failed to open issue: {e.args}"

async def issueCloseCommand(self, event: EventInfo, repo: str, num: int, body: str=""):
"""Close an issue in a repository."""
if body:
body = body + (
f"\n\n_Issue closed by {event.userName} [here]"
f'(https://chat.stackexchange.com/transcript/{self.room.roomID}?m={event.messageIdent}#{event.messageIdent})'
"_"
)
try:
await self.common.ghClient.gh.post(
f"/repos/{self.common.privateConfig['account']}/{repo}/issues/{num}/comments",
data={"body": body}
)
except BadRequest as e:
yield f"Failed to send comment: {e.args}"
try:
await self.common.ghClient.gh.patch(
f"/repos/{self.common.privateConfig['account']}/{repo}/issues/{num}",
data={"state": "closed"}
)
except BadRequest as e:
yield f"Failed to close issue: {e.args}"

async def prodCommand(self, event: EventInfo, repo: str = ""):
"""Open a PR to update production."""
if len(repo) == 0:
Expand Down

0 comments on commit 8023b47

Please sign in to comment.