Skip to content

Commit

Permalink
Merge branch 'master' into task/3-12
Browse files Browse the repository at this point in the history
  • Loading branch information
davfsa authored Oct 3, 2023
2 parents 16ce2ab + 5af6142 commit b3ab62d
Show file tree
Hide file tree
Showing 51 changed files with 451 additions and 186 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup python
uses: actions/setup-python@v4
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup python
uses: actions/setup-python@v4
Expand All @@ -86,7 +86,7 @@ jobs:
coverage report
- name: Upload coverage to codeclimate
uses: paambaati/codeclimate-action@v4.0.0
uses: paambaati/codeclimate-action@v5.0.0
env:
CC_TEST_REPORTER_ID: d40e64ea0ff74713f79365fea4378ab51a2141ad4fcf0fb118496bbf560d4192
with:
Expand All @@ -97,7 +97,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup python
uses: actions/setup-python@v4
Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup python
uses: actions/setup-python@v4
Expand All @@ -171,12 +171,12 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: 3.9

- name: Setup node
uses: actions/setup-node@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fragments-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# `towncrier check` runs `git diff --name-only origin/main...`, which
# needs a non-shallow clone.
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ jobs:
steps:
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v1
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}

- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
steps:
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v1
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}

- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}

Expand All @@ -32,7 +32,7 @@ jobs:
python-version: 3.8

- name: Temporarily disable "include administrators" branch protection
uses: benjefferies/[email protected].8
uses: benjefferies/[email protected].9
with:
access_token: ${{ steps.generate_token.outputs.token }}
enforce_admins: false
Expand All @@ -46,7 +46,7 @@ jobs:
run: bash scripts/ci/release.sh

- name: Re-enable "include administrators" branch protection
uses: benjefferies/[email protected].8
uses: benjefferies/[email protected].9
if: always()
with:
access_token: ${{ steps.generate_token.outputs.token }}
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.8"
python: "3.9"

sphinx:
configuration: docs/conf.py
Expand Down
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
## 2.0.0.dev121 (2023-09-10)

### Features

- Add `approximate_member_count` and `approximate_presence_count` to `OwnGuild`. ([#1659](https://github.com/hikari-py/hikari/issues/1659))
- Add `CacheSettings.only_my_member` to only cache the bot member. ([#1679](https://github.com/hikari-py/hikari/issues/1679))
- Bots can now utilize `Activity.state`
- When used with `type` set to `ActivityType.CUSTOM`, it will show as the text for the custom status.
Syntactic sugar also exists to support simply using `name` instead of `state`.
- Can be used with other activity types to provide additional information on the activity. ([#1683](https://github.com/hikari-py/hikari/issues/1683))
- Add missing Audit Log event types to `AuditLogEventType` ([#1705](https://github.com/hikari-py/hikari/issues/1705))
- Add `approximate_guild_count` field to own `Application` ([#1712](https://github.com/hikari-py/hikari/issues/1712))

### Bugfixes

- Handle connection reset error on shards. ([#1645](https://github.com/hikari-py/hikari/issues/1645))
- Retry REST requests on connection errors ([#1648](https://github.com/hikari-py/hikari/issues/1648))
- Add support for text in stage channels ([#1653](https://github.com/hikari-py/hikari/issues/1653))
- Fix incorrect calculation for the default avatar of migrated users ([#1673](https://github.com/hikari-py/hikari/issues/1673))
- Fix attachments not being removed in message edits when `attachment` or `attachments` is `None` ([#1702](https://github.com/hikari-py/hikari/issues/1702))

---


## 2.0.0.dev120 (2023-06-08)

### Breaking Changes
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Hikari provides two different default bot implementations to suit your needs:

### GatewayBot

A [`GatewayBot`](https://docs.hikari-py.dev/en/stable/reference/hikari/impl/bot/#hikari.impl.bot.GatewayBot)
A [`GatewayBot`](https://docs.hikari-py.dev/en/stable/reference/hikari/impl/gateway_bot/#hikari.impl.gateway_bot.GatewayBot)
is one which will connect to Discord through the gateway and receive
events through there. A simple startup example could be the following:

Expand Down Expand Up @@ -194,7 +194,7 @@ bot.run(

Many other helpful options exist for you to take advantage of if you wish. Links to the respective docs can be seen
below:
- [GatewayBot.run](https://docs.hikari-py.dev/en/stable/reference/hikari/impl/bot/#hikari.impl.bot.GatewayBot.run)
- [GatewayBot.run](https://docs.hikari-py.dev/en/stable/reference/hikari/impl/gateway_bot/#hikari.impl.gateway_bot.GatewayBot.run)
- [RESTBot.run](https://docs.hikari-py.dev/en/stable/reference/hikari/impl/rest_bot/#hikari.impl.rest_bot.RESTBot.run)

---
Expand Down
1 change: 1 addition & 0 deletions changes/1720.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix optional connection "revoked" field KeyError when fetching connections.
2 changes: 1 addition & 1 deletion dev-requirements/build.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
setuptools>=65.2.0
wheel==0.40.0
wheel==0.41.2
2 changes: 1 addition & 1 deletion dev-requirements/codespell.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
codespell==2.2.4
codespell==2.2.6
2 changes: 1 addition & 1 deletion dev-requirements/coverage.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
coverage[toml]==7.2.7
coverage[toml]==7.3.2
8 changes: 4 additions & 4 deletions dev-requirements/flake8.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
flake8==6.0.0
flake8==6.1.0

# Plugins
# Ref: https://github.com/DmytroLitvinov/awesome-flake8-extensions
Expand All @@ -7,18 +7,18 @@ flake8-bandit~=4.1.1 # runs bandit
flake8-black==0.3.6 # runs black
flake8-builtins==2.1.0 # builtin shadowing checks
flake8-coding==1.3.2 # coding magic-comment detection
flake8-comprehensions==3.12.0 # comprehension checks
flake8-comprehensions==3.14.0 # comprehension checks
flake8-docstrings==1.7.0 # pydocstyle support
flake8-executable==2.1.3 # shebangs
flake8-fixme==1.1.1 # "fix me" counter
flake8-functions==0.0.8 # function linting
flake8-html==0.4.3 # html output
flake8-isort==6.0.0 # runs isort
flake8-isort==6.1.0 # runs isort
flake8-mutable==1.2.0 # mutable default argument detection
flake8-pep3101==2.0.0 # new-style format strings only
flake8-print==5.0.0 # complain about print statements in code
flake8-printf-formatting==1.1.2 # forbey printf-style python2 string formatting
flake8-pytest-style==1.7.2 # pytest checks
flake8-raise==0.0.5 # exception raising linting
flake8-use-fstring==1.4 # format string checking
flake8-noqa==1.3.1 # validate noqa commands
flake8-noqa==1.3.2 # validate noqa commands
2 changes: 1 addition & 1 deletion dev-requirements/formatting.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
black==23.3.0
black==23.9.1
isort==5.12.0
2 changes: 1 addition & 1 deletion dev-requirements/mypy.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mypy==1.3.0
mypy==1.5.1
2 changes: 1 addition & 1 deletion dev-requirements/pyright.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pyright==1.1.313
pyright==1.1.329
10 changes: 5 additions & 5 deletions dev-requirements/pytest.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# mock in the stdlib changes between versions of Python, so are not consistent in behaviour like the backport is
mock==5.0.2
mock==5.1.0

pytest==7.3.2
pytest-asyncio==0.21.0
pytest==7.4.2
pytest-asyncio==0.21.1
pytest-cov==4.1.0
pytest-randomly==3.12.0
pytest-randomly==3.15.0

async-timeout==4.0.2 # Used for timeouts in some test cases.
async-timeout==4.0.3 # Used for timeouts in some test cases.

-r coverage.txt # Consistent coverage version
2 changes: 1 addition & 1 deletion dev-requirements/slotscheck.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
slotscheck==0.16.5
slotscheck==0.17.0
10 changes: 5 additions & 5 deletions dev-requirements/sphinx.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
sphinx==6.2.1
sphinx==7.2.6

# Theme
furo==2023.5.20
furo==2023.9.10

# Autodocumentation
sphinx-autoapi==2.1.1
numpydoc==1.5.0
sphinx-autoapi==3.0.0
numpydoc==1.6.0

# Static files
myst-parser==1.0.0
myst-parser==2.0.0

# Misc extensions
sphinxext.opengraph==0.8.2
Expand Down
2 changes: 1 addition & 1 deletion hikari/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# SOFTWARE.
"""A sane Python framework for writing modern Discord bots.
To get started, you will want to initialize an instance of `hikari.impl.bot.GatewayBot`
To get started, you will want to initialize an instance of `hikari.impl.gateway_bot.GatewayBot`
for writing a gateway based bot, `hikari.impl.rest_bot.RESTBot` for a REST based bot,
or `hikari.impl.rest.RESTApp` if you only need to use the REST API.
"""
Expand Down
2 changes: 1 addition & 1 deletion hikari/_about.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@
__issue_tracker__: typing.Final[str] = "https://github.com/hikari-py/hikari/issues"
__license__: typing.Final[str] = "MIT"
__url__: typing.Final[str] = "https://github.com/hikari-py/hikari"
__version__: typing.Final[str] = "2.0.0.dev121"
__version__: typing.Final[str] = "2.0.0.dev122"
__git_sha1__: typing.Final[str] = "HEAD"
13 changes: 12 additions & 1 deletion hikari/api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class CacheComponents(enums.Flag):
"""Enables the guild stickers cache."""

GUILD_THREADS = 1 << 12
"""Enabled the guild threads cache."""
"""Enables the guild threads cache."""

ALL = (
GUILDS
Expand Down Expand Up @@ -199,3 +199,14 @@ class CacheSettings(abc.ABC):
@abc.abstractmethod
def components(self) -> CacheComponents:
"""Cache components to use."""

@property
@abc.abstractmethod
def only_my_member(self) -> bool:
"""Reduce the members cache to only the bot itself.
Useful when only the bot member is required (eg. permission checks).
This will have no effect if the members cache is not enabled.
Defaults to `False`.
"""
9 changes: 9 additions & 0 deletions hikari/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,12 @@ class OwnGuild(guilds.PartialGuild):
my_permissions: permissions_.Permissions = attrs.field(eq=False, hash=False, repr=False)
"""The guild-level permissions that apply to the current user or bot."""

approximate_member_count: int = attrs.field(eq=False, hash=False, repr=True)
"""The approximate amount of members in this guild."""

approximate_active_member_count: int = attrs.field(eq=False, hash=False, repr=True)
"""The approximate amount of presences in this guild."""


@attrs.define(hash=True, kw_only=True, weakref_slot=False)
class OwnApplicationRoleConnection:
Expand Down Expand Up @@ -626,6 +632,9 @@ class Application(guilds.PartialApplication):
install_parameters: typing.Optional[ApplicationInstallParameters] = attrs.field(eq=False, hash=False, repr=False)
"""Settings for the application's default in-app authorization link, if enabled."""

approximate_guild_count: int = attrs.field(eq=False, hash=False, repr=False)
"""The approximate number of guilds this application is part of."""

@property
def cover_image_url(self) -> typing.Optional[files.URL]:
"""Rich presence cover image URL for this application, if set."""
Expand Down
5 changes: 5 additions & 0 deletions hikari/audit_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,11 @@ class AuditLogEventType(int, enums.Enum):
GUILD_SCHEDULED_EVENT_UPDATE = 101
GUILD_SCHEDULED_EVENT_DELETE = 102
APPLICATION_COMMAND_PERMISSION_UPDATE = 121
THREAD_CREATE = 110
THREAD_UPDATE = 111
THREAD_DELETE = 112
CREATOR_MONETIZATION_REQUEST_CREATED = 150
CREATOR_MONETIZATION_TERMS_ACCEPTED = 151


@attrs.define(hash=False, kw_only=True, weakref_slot=False)
Expand Down
10 changes: 9 additions & 1 deletion hikari/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -1367,7 +1367,7 @@ class GuildVoiceChannel(PermissibleGuildChannel, TextableGuildChannel):


@attrs.define(hash=True, kw_only=True, weakref_slot=False)
class GuildStageChannel(PermissibleGuildChannel):
class GuildStageChannel(PermissibleGuildChannel, TextableGuildChannel):
"""Represents a stage channel."""

bitrate: int = attrs.field(eq=False, hash=False, repr=True)
Expand All @@ -1387,6 +1387,14 @@ class GuildStageChannel(PermissibleGuildChannel):
If this is `0`, then assume no limit.
"""

last_message_id: typing.Optional[snowflakes.Snowflake] = attrs.field(eq=False, hash=False, repr=False)
"""The ID of the last message sent in this channel.
.. warning::
This might point to an invalid or deleted message. Do not assume that
this will always be valid.
"""


@typing.final
class ForumSortOrderType(int, enums.Enum):
Expand Down
Loading

0 comments on commit b3ab62d

Please sign in to comment.