bot.exts.info.github#

Get data from GitHub.

Module Contents#

Classes#

FoundIssue

Dataclass representing an issue found by the regex.

FetchError

Dataclass representing an error while fetching an issue.

IssueState

Dataclass representing the state of an issue.

Github

A Cog that fetches info from GitHub.

Functions#

setup(→ None)

Load the GithubInfo cog.

Attributes#

bot.exts.info.github.log[source]#
bot.exts.info.github.GITHUB_API_URL = 'https://api.github.com'[source]#
bot.exts.info.github.REQUEST_HEADERS[source]#
bot.exts.info.github.REPOSITORY_ENDPOINT = 'https://api.github.com/orgs/{org}/repos?per_page=100&type=public'[source]#
bot.exts.info.github.ISSUE_ENDPOINT = 'https://api.github.com/repos/{user}/{repository}/issues/{number}'[source]#
bot.exts.info.github.PR_ENDPOINT = 'https://api.github.com/repos/{user}/{repository}/pulls/{number}'[source]#
bot.exts.info.github.CODE_BLOCK_RE[source]#
bot.exts.info.github.MAXIMUM_ISSUES = 5[source]#
bot.exts.info.github.AUTOMATIC_REGEX[source]#
class bot.exts.info.github.FoundIssue[source]#

Dataclass representing an issue found by the regex.

organisation: str | None[source]#
repository: str[source]#
number: str[source]#
class bot.exts.info.github.FetchError[source]#

Dataclass representing an error while fetching an issue.

return_code: int[source]#
message: str[source]#
class bot.exts.info.github.IssueState[source]#

Dataclass representing the state of an issue.

repository: str[source]#
number: int[source]#
url: str[source]#
title: str[source]#
emoji: str[source]#
class bot.exts.info.github.Github(bot: bot.bot.Bot)[source]#

Bases: discord.ext.commands.Cog

A Cog that fetches info from GitHub.

static remove_codeblocks(message: str) str[source]#

Remove any codeblock in a message.

async fetch_issue(number: int, repository: str, user: str) IssueState | FetchError[source]#

Retrieve an issue from a GitHub repository.

Returns IssueState on success, FetchError on failure.

static format_embed(results: list[IssueState | FetchError]) discord.Embed[source]#

Take a list of IssueState or FetchError and format a Discord embed for them.

async github_group(ctx: discord.ext.commands.Context) None[source]#

Commands for finding information related to GitHub.

async on_message(message: discord.Message) None[source]#

Automatic issue linking.

Listener to retrieve issue(s) from a GitHub repository using automatic linking if matching <org>/<repo>#<issue>.

async fetch_data(url: str) tuple[dict[str], aiohttp.ClientResponse][source]#

Retrieve data as a dictionary and the response in a tuple.

async github_user_info(ctx: discord.ext.commands.Context, username: str) None[source]#

Fetch a user’s GitHub information.

async github_repo_info(ctx: discord.ext.commands.Context, *repo: str) None[source]#

Fetch a repositories’ GitHub information.

The repository should look like user/reponame or user reponame.

async bot.exts.info.github.setup(bot: bot.bot.Bot) None[source]#

Load the GithubInfo cog.