Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
a93d9f8
fix(gateway): fix sub-function logic for options in subcommands by type.
i0bs Dec 19, 2021
44e5167
Merge branch 'unstable' of https://github.com/discord-py-interactions…
i0bs Dec 19, 2021
842053d
fix: Get rid of decimal residue in Timestamp computation.
FayeDel Dec 19, 2021
3d4c37b
docs: allow dark mode interpretation.
i0bs Dec 19, 2021
85f5b9b
docs: remove it. (no RTD reg theme ref)
i0bs Dec 19, 2021
bd651ad
fix(context)!: Fixed ability to send/edit multiple action rows
Toricane Dec 20, 2021
4b0614a
fix: Remove hardlock orjson version dependency for py 3.10, redo reas…
FayeDel Dec 20, 2021
780c87d
Merge remote-tracking branch 'origin/unstable' into unstable
FayeDel Dec 20, 2021
d8936a7
chore(context): organize multiple action-row sending into ternary ope…
Toricane Dec 21, 2021
9d5e511
fix(slots): Include undocumented slotted properties to suppress warni…
FayeDel Dec 21, 2021
02f84aa
fix!(components): Fix component menu invocation, select option value …
FayeDel Dec 21, 2021
4122426
feat: add helper methods to models.
EepyElvyra Dec 21, 2021
4736f04
feat: allow JetBrains Space internal building.
i0bs Dec 23, 2021
fd2345e
fix: `Thread` object being dispatched.
i0bs Dec 23, 2021
bd65b64
fix: `MessageReaction` object being dispatched.
i0bs Dec 23, 2021
dc8163f
chore: cleanup `@component` confusion.
i0bs Dec 23, 2021
3b2321a
fix: `Invite` missing attrs.
i0bs Dec 23, 2021
c6b0b91
fix: `EmbedField` improperly generating in `Embed`.
i0bs Dec 23, 2021
489fd6a
fix: command/components not firing from same name.
i0bs Dec 23, 2021
0671209
docs: Update `Guild`.
i0bs Dec 23, 2021
a377e7e
docs: Redo simultaneous d.py and interactions client startup doc supp…
FayeDel Dec 23, 2021
cbaccc8
chore: update Copyright License
i0bs Jan 1, 2022
d0d7e6b
[pre-commit.ci] pre-commit autoupdate (#402)
pre-commit-ci[bot] Jan 2, 2022
c5ab99b
docs(components): fix typo in `label`.
tagptroll1 Jan 2, 2022
ffc9865
fix: component sending/editing with context
Toricane Jan 2, 2022
8f743b3
feat!: Control `@autocomplete` by command/ID.
i0bs Jan 2, 2022
730e88d
chore: Update License.
i0bs Jan 2, 2022
4433f43
fix!: Fix Option and Choice _json/dict parsing and document channel_i…
FayeDel Jan 3, 2022
ced3441
docs/feat: added new functions, fixed typos
EepyElvyra Jan 3, 2022
f6fcda8
chore: refactor with Sourcery AI.
i0bs Jan 4, 2022
fc6bac2
Merge branch 'unstable' of https://github.com/discord-py-interactions…
i0bs Jan 4, 2022
64452a7
feat: implement @message_command and @user_command
Toricane Jan 4, 2022
8dd8795
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 4, 2022
67887f4
feat: add new helper methods
EepyElvyra Jan 5, 2022
bc3f4fb
fix(message)?: Partial fix for `EmbedField`.
i0bs Jan 5, 2022
c0cc983
fix(message): allow `EmbedAuthor` usage.
i0bs Jan 5, 2022
44a299e
added missing paremeters to docstrings
EepyElvyra Jan 5, 2022
b508bae
added missing paremeters to docstrings
EepyElvyra Jan 5, 2022
169b5ec
fix: more `Extension` cleanup
i0bs Jan 5, 2022
3e6719f
feat: more cool `Extension` stuff again.
i0bs Jan 5, 2022
0ca591a
more functions
EepyElvyra Jan 5, 2022
592eeb7
feat: move `HTTPException` to automatically trigger when an HTTP requ…
i0bs Jan 5, 2022
c8c9102
even more functions
EepyElvyra Jan 5, 2022
d5b0617
funcs
EepyElvyra Jan 5, 2022
3646c99
Merge branch 'goverfl0w:unstable' into unstable
EepyElvyra Jan 5, 2022
fe334da
typo
EepyElvyra Jan 5, 2022
6fef14c
typo
EepyElvyra Jan 5, 2022
9d747a1
Merge branch 'unstable' of https://github.com/EdVraz/discord-interact…
EepyElvyra Jan 5, 2022
16331fa
refactor: remove unnecessary =None calls
Toricane Jan 5, 2022
bcd0c1f
Merge branch 'unstable' of https://github.com/Toricane/discord-intera…
Toricane Jan 5, 2022
882c273
fix!: Fix context sending without components, HTTP error exception if…
FayeDel Jan 6, 2022
67b80ad
fix!: Fix context menu resolved data parsing, add default member avat…
FayeDel Jan 6, 2022
184cae3
Merge branch 'goverfl0w:unstable' into unstable
EepyElvyra Jan 7, 2022
f57c955
feat: Introduce embedded activity model, remove id in PresenceActivit…
FayeDel Jan 7, 2022
53d7a9f
docs: Fix typos in the EmbeddedActivity model.
FayeDel Jan 7, 2022
2aafb9d
feat: Implement GuildJoinRequest event, finish typehinting Integratio…
FayeDel Jan 7, 2022
99f3741
docs: correctly format docstring
Toricane Jan 8, 2022
0779821
fix: Implement cache safeguard on some requests that require ID check…
FayeDel Jan 8, 2022
8775bae
Merge branch 'goverfl0w:unstable' into unstable
Toricane Jan 8, 2022
052cf5c
Update interactions/api/models/channel.py
EepyElvyra Jan 8, 2022
2aef473
Update interactions/api/models/channel.py
EepyElvyra Jan 8, 2022
7056012
Update interactions/api/models/channel.py
EepyElvyra Jan 8, 2022
5ca6b9c
Update interactions/api/models/guild.py
EepyElvyra Jan 8, 2022
d00e498
Update interactions/api/models/guild.py
EepyElvyra Jan 8, 2022
2e859c6
Update interactions/api/models/guild.py
EepyElvyra Jan 8, 2022
eaea91f
Update interactions/api/models/message.py
EepyElvyra Jan 8, 2022
a0bfdc7
docs: fix typo in docstring
Toricane Jan 8, 2022
f0e71b5
fix: Fix embed field parsing and adjust documentation.
FayeDel Jan 9, 2022
d186ed3
refactor: change intents.py to flags.py
Catalyst4222 Jan 9, 2022
b8e405e
feat: create a Permissions IntFlag for use in Member.permissions
Catalyst4222 Jan 9, 2022
8ffad01
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 9, 2022
d5803e1
fix: Fix embed footer parsing, add Discord Status enum.
FayeDel Jan 9, 2022
6ec8224
fix: Stop configuring logging
LordOfPolls Jan 10, 2022
be2fdcb
fix: Remove additional logging references
LordOfPolls Jan 10, 2022
5318ae0
docs: Fix example in autocomplete documentation.
pwuertz Jan 11, 2022
89fa332
docs: Fix message docs, add banner attribute to channel
FayeDel Jan 11, 2022
56ecb3c
Merge pull request #417 from Toricane/unstable
FayeDel Jan 12, 2022
165b4b7
Merge branch 'unstable' into stable
Catalyst4222 Jan 12, 2022
7596812
Merge pull request #422 from pwuertz/fix/autocomplete_doc
FayeDel Jan 12, 2022
106344e
fix: Fix command cache by caching more attribute values.
FayeDel Jan 12, 2022
620792c
Merge pull request #421 from LordOfPolls/stable
FayeDel Jan 13, 2022
ec2bedb
Merge pull request #420 from Catalyst4222/stable
FayeDel Jan 13, 2022
ba28212
fix: Update cache for updated commands based on API result.
FayeDel Jan 13, 2022
e1b976b
Merge branch 'goverfl0w:unstable' into unstable
EepyElvyra Jan 13, 2022
ae0c226
fix!: Allow component sending in `Member.send()`
EepyElvyra Jan 13, 2022
f5b8893
fix!
EepyElvyra Jan 13, 2022
bfbaccb
fix: Add undocumented attributes, fix headers, fix efficiency of comm…
FayeDel Jan 13, 2022
592e4a8
fix!
EepyElvyra Jan 13, 2022
d988b29
Merge branch 'goverfl0w:unstable' into unstable
EepyElvyra Jan 13, 2022
3b22a8a
Merge pull request #418 from EdVraz/unstable
FayeDel Jan 13, 2022
e855a87
fix!: Reduce circular imports
EepyElvyra Jan 13, 2022
1cf2929
fix!: broken component logic
EepyElvyra Jan 13, 2022
4f50a06
fix: Add undocumented attributes, fix headers, fix efficiency of comm…
FayeDel Jan 13, 2022
6925303
Merge remote-tracking branch 'origin/unstable' into unstable
FayeDel Jan 13, 2022
743338f
Fix for corrupted command in cache
Jalancar Jan 15, 2022
5139717
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 15, 2022
5af782c
Merge pull request #437 from Jalancar/fix-command-sync
FayeDel Jan 15, 2022
d1d32be
fix: Fix edit global command endpoint.
FayeDel Jan 15, 2022
cdba706
docs:
EepyElvyra Jan 16, 2022
bb778ce
docs:
EepyElvyra Jan 16, 2022
e82b8a0
Merge pull request #438 from EdVraz/docfix
FayeDel Jan 16, 2022
49122ea
fix: change print to log.debug
snazzyfox Jan 19, 2022
cfadec0
docs: Add image support for scheduled events.
FayeDel Jan 19, 2022
4853c38
Merge remote-tracking branch 'origin/unstable' into unstable
FayeDel Jan 19, 2022
df3001f
Merge pull request #444 from snazzyfox/fix-debug-prints
FayeDel Jan 19, 2022
02dfe05
refactor(client, decor): Rewrite mapping conditions; synchronization …
i0bs Jan 20, 2022
2aef53b
fix: incorrect `guild_id` detection on bulk overwrite.
i0bs Jan 20, 2022
ec5f5a1
chore(client): update interfacing of attrs.
i0bs Jan 20, 2022
103a15d
feat: add sentinal value `MISSING`.
i0bs Jan 20, 2022
f599d41
chore(client): update all method returns.
i0bs Jan 20, 2022
e573bcf
fix: choice recursion failing on `Option` spinup.
i0bs Jan 20, 2022
ed59946
fix(gateway,component): SelectMenu parse per SelectOption
MeidoNoHitsuji Jan 20, 2022
368fd5a
refactor: Allow components during an edit; safeguard from missing HTT…
EepyElvyra Jan 20, 2022
b8b7856
chore: isolate dev dependencies into [dev] extra (#440)
snazzyfox Jan 20, 2022
d577cd0
fix: prevent NoneType closure during guild member check. (#439)
EepyElvyra Jan 20, 2022
7be091e
refactor(client,gateway,http): revert `NoReturn` types; implement san…
i0bs Jan 20, 2022
158df3a
fix(http): check bucket before sending a request for a cooldown.
i0bs Jan 20, 2022
c4846af
docs: correct broken ivar/param formatting. (#446)
EepyElvyra Jan 22, 2022
7cdd8d7
refactor(http): implement yet again another rate limiter.
i0bs Jan 22, 2022
76218e3
Merge branch 'unstable' of https://github.com/discord-py-interactions…
i0bs Jan 22, 2022
b51983d
fix!: Fix @client.event invocation and choice iteration if not given.
FayeDel Jan 22, 2022
c7e68a8
feat(http)!: Implement sane rate limiting locks, retries, and account…
FayeDel Jan 23, 2022
9568b6a
fix: Implement missing attributes for Application model.
FayeDel Jan 24, 2022
145d3c8
docs: Fix typehint for ratelimit dict.
FayeDel Jan 24, 2022
f0f857b
feat(http): Utilise per-bucket rate-limiting/locking.
FayeDel Jan 24, 2022
ca93602
fix: Suppress bucket cooldown warnings when cooldown is zero.
FayeDel Jan 24, 2022
f0e4d77
refactor: Logger parse structure (#431)
V3ntus Jan 24, 2022
ce62812
fix: Add Python 3.10 support to Limiter/Lock objects.
FayeDel Jan 24, 2022
50b0f15
fix!: allow ctx.edit to edit component responses when not deferred (#…
EepyElvyra Jan 24, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*.egg-info/
*.eggs/
*.pyc
.idea
.cache/
_build/
build/
Expand All @@ -11,5 +12,5 @@ dist/
.venv
.vscode
__pycache__

*.token
*.pypirc
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.1.0
hooks:
- id: requirements-txt-fixer
name: Requirements
Expand Down Expand Up @@ -39,7 +39,7 @@ repos:
name: flake8 Formatting
language: python
types: [file, python]
args: [--max-line-length=100, --ignore=E203 E501 E402 W503 W504]
args: [--max-line-length=100, --ignore=E203 E301 E302 E501 E402 E704 W503 W504]
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ the library off of pip:

.. code-block:: bash

pip install -U discord-py-interactions
pip install -U discord-py-interactions[dev]

Once you have the library installed in Python, you are able to instantiate and run a basic bot
with a logging level that is set for debugging purposes. This is recommend in order to make it easier
Expand Down
695 changes: 674 additions & 21 deletions LICENSE

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Ever since December 2019, this open-source project has become the culmination of
- Looking for a compatible library that implements all interactions?
- Itching to get your hands on slash commands, but in a simple manner?

Look no more! The goal of this library is to make all three of these questions go from possibilites to trivial matters.
Look no more! The goal of this library is to make all three of these questions go from possibilities to trivial matters.

What can we do?
***************
Expand Down
48 changes: 40 additions & 8 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,36 +48,48 @@ What does that mean? Well, we'll show you:
import interactions
from discord.ext import commands

interactions = interactions.Client(token="...")
client = interactions.Client(token="...")
dpy = commands.Bot(prefix="/")

@dpy.command()
async def hello(ctx):
await ctx.send("Hello from discord.py!")

@interactions.command(
@client.command(
name="test",
description="this is just a testing command."
)
async def test(ctx):
await ctx.send("Hello from discord-interactions!")

interactions.start()
dpy.run(token="...", bot=True)
loop = asyncio.get_event_loop()

task2 = loop.create_task(dpy.start(token="...", bot=True))
task1 = loop.create_task(client.ready())

gathered = asyncio.gather(task1, task2, loop=loop)
loop.run_until_complete(gathered)

Both of these variables ``interactions`` and ``dpy`` will be able to run in the same established environment, and additionally
will both function properly as their respective libraries intend them to. What about the models, though? That's a simple answer:
will both function properly as their respective libraries intend them to. This implementation uses asyncio.gather to execute
both starts simultaneously as asyncio tasks, and runs them under one singular loop.

Compared to traditional startup commands, ``interactions.ready()`` and ``dpy.start()`` is used instead of
the typical ``interactions.start()`` and ``dpy.run()`` methods because of synchronous/async functions.
``asyncio.gather()`` works with coroutines, hence the transition.

What about the models, though? That's a simple answer:

.. code-block:: python

import discord
from interactions.api.models.member import Member
import interactions

@dpy.command()
async def borrowing(ctx, member: Member):
async def borrowing(ctx, member: interactions.Member):
await ctx.send(f"Member ID: {member.id}")

@interactions.command(...)
@client.command(...)
async def second_borrowing(ctx, member: discord.Member):
await ctx.send(f"Member ID: {member.id}")

Expand Down Expand Up @@ -127,6 +139,26 @@ of discord.py bot developers frown upon doing, so this is at your own risk to co
can take a page out of discord.js' book if you want to do this, since they've never heard of an external command handler framework
before in their entire life.


I'm getting "``AttributeError: HTTPClient not found!``" when I try to execute helper methods!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Probably you are doing something like this:

.. code-block:: python

channel = interactions.Channel(**await bot.http.get_channel(channel_id))
await channel.send("...")

And the error occurs in the line where you try to send something. You can fix this easy by adding one argument:

.. code-block:: python

channel = interactions.Channel(**await bot.http.get_channel(channel_id), _client=bot.http)
await channel.send("...")

You have to add this extra argument for every object you instantiate by yourself if you want to use it's methods


My question is not answered on here!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please join our Discord server for any further support regarding our library and/or any integration code depending on it.
Expand Down
2 changes: 1 addition & 1 deletion interactions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
Co-authored by DeltaXW.
"""
from .api.models.channel import * # noqa: F401 F403
from .api.models.flags import * # noqa: F401 F403
from .api.models.guild import * # noqa: F401 F403
from .api.models.gw import * # noqa: F401 F403
from .api.models.intents import * # noqa: F401 F403
from .api.models.member import * # noqa: F401 F403
from .api.models.message import * # noqa: F401 F403
from .api.models.misc import * # noqa: F401 F403
Expand Down
11 changes: 3 additions & 8 deletions interactions/api/dispatch.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
from asyncio import get_event_loop
from logging import Logger, StreamHandler, basicConfig, getLogger
from logging import Logger
from typing import Coroutine, Optional

from ..base import CustomFormatter, Data
from interactions.base import get_logger

basicConfig(level=Data.LOGGER)
log: Logger = getLogger("dispatch")
stream: StreamHandler = StreamHandler()
stream.setLevel(Data.LOGGER)
stream.setFormatter(CustomFormatter())
log.addHandler(stream)
log: Logger = get_logger("dispatch")


class Listener:
Expand Down
8 changes: 4 additions & 4 deletions interactions/api/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class InteractionException(Exception):
and for extensive testing/review before integration.
Likewise, this will show the concepts before use, and will be refined when time goes on.

:ivar interactions.api.error.ErrorFormatter _formatter: The built in formatter.
:ivar interactions.api.error.ErrorFormatter _formatter: The built-in formatter.
:ivar dict _lookup: A dictionary containing the values from the built-in Enum.

"""
Expand Down Expand Up @@ -145,7 +145,7 @@ class GatewayException(InteractionException):
"""
This is a derivation of InteractionException in that this is used to represent Gateway closing OP codes.

:ivar ErrorFormatter _formatter: The built in formatter.
:ivar ErrorFormatter _formatter: The built-in formatter.
:ivar dict _lookup: A dictionary containing the values from the built-in Enum.
"""

Expand Down Expand Up @@ -178,7 +178,7 @@ class HTTPException(InteractionException):
"""
This is a derivation of InteractionException in that this is used to represent HTTP Exceptions.

:ivar ErrorFormatter _formatter: The built in formatter.
:ivar ErrorFormatter _formatter: The built-in formatter.
:ivar dict _lookup: A dictionary containing the values from the built-in Enum.
"""

Expand All @@ -204,7 +204,7 @@ class JSONException(InteractionException):
"""
This is a derivation of InteractionException in that this is used to represent JSON API Exceptions.

:ivar ErrorFormatter _formatter: The built in formatter.
:ivar ErrorFormatter _formatter: The built-in formatter.
:ivar dict _lookup: A dictionary containing the values from the built-in Enum.
"""

Expand Down
Loading