Skip to content

Commit 738c0ad

Browse files
AstreaTSSkennhhi0bspre-commit-ci[bot]LordOfPolls
authored
5.9.0 (#1512)
* feat: add args, kwargs to task (#1478) * modified: interactions/models/internal/tasks/task.py * reset to set_last_call_time Signed-off-by: kennhh <133614589+kennhh@users.noreply.github.com> --------- Signed-off-by: kennhh <133614589+kennhh@users.noreply.github.com> * feat: add id attr to app perms update event * revert: commit signoff err * ci: show pre-commit diff on failure (#1484) * feat: add alt methods for multi-arg params for prefixed cmds (#1471) * feat: add alt methods for multi-arg params for prefixed cmds * fix: use empty if the typehint is just tuple * ci: correct from checks. * fix: support ConsumeRest without typehint --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat: cache channel data from interactions (#1479) * fix: account for BaseChannel for channel mentions (#1480) * feat: add default to delete/edit init interaction msg (#1481) * docs: remove outdated cookiecutter template (#1483) * docs: remove outdated cookiecutter template * docs: add boilerplate mention * feat: add id attr to app perms update event (#1485) * feat: add sort order for forums (#1488) * feat: add forum sort order * feat: cache layout and sort order for forums * feat: add rate limit per user where needed (#1489) Signed-off-by: LordOfPolls <dev@lordofpolls.com> * fix: use message channel for PrefixedContext (#1491) * fix: bound app_permissions for HybridContext (#1492) * feat: add start_time(s) for AutoShardedClient (#1482) * feat: add start_time(s) for AutoShardedClient * feat: make start_times a dict * docs: make start_times docstring clearer Co-authored-by: Sophia <41456914+i0bs@users.noreply.github.com> Signed-off-by: Astrea <25420078+AstreaTSS@users.noreply.github.com> --------- Signed-off-by: Astrea <25420078+AstreaTSS@users.noreply.github.com> Co-authored-by: Sophia <41456914+i0bs@users.noreply.github.com> * fix: correct listen typehint (#1495) * chore: move mutable class ref/attrs to ClassVar typing (#1497) * ci: weekly check. (#1460) * ci: weekly check. updates: - https://github.com/charliermarsh/ruff-pre-commithttps://github.com/astral-sh/ruff-pre-commit - [github.com/astral-sh/ruff-pre-commit: v0.0.272 → v0.0.278](astral-sh/ruff-pre-commit@v0.0.272...v0.0.278) - [github.com/psf/black: 23.3.0 → 23.7.0](psf/black@23.3.0...23.7.0) * ci: correct from checks. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat: add ability to use different arg name than option name (#1493) * feat: add ability to use different arg name than option name * feat: raise better error if arg name doesnt exist * fix: use ValueError instead of TypeError TypeError seems to be suppressed * fix: make sure exported auto_defer is deco, not module (#1496) * fix/feat: adjust invite obj to respect event variants (#1500) * fix/feat: adjust invite obj to respect event variants * docs: update docs for event object * revert: keep MISSING for backwards compatibility * style: consistency Co-authored-by: Sophia <41456914+i0bs@users.noreply.github.com> Signed-off-by: Astrea <25420078+AstreaTSS@users.noreply.github.com> --------- Signed-off-by: Astrea <25420078+AstreaTSS@users.noreply.github.com> Co-authored-by: Sophia <41456914+i0bs@users.noreply.github.com> * fix: address issues with tag usage for guild forums (#1499) * fix: address issues with tags for guild forums * fix: is this breaking? better be safe than sorry * docs💥: revamp extension guide (#1494) * docs💥: revamp extension guide * docs: update extension example * docs: oops, forgot a word Co-authored-by: Max <maxyolo01.ytb@gmail.com> Signed-off-by: Astrea <25420078+AstreaTSS@users.noreply.github.com> * docs: add section for loading all extensions in folder * docs: turns out ipy can load multi exts in one file * docs: lots of wording adjustments --------- Signed-off-by: Astrea <25420078+AstreaTSS@users.noreply.github.com> Co-authored-by: Max <maxyolo01.ytb@gmail.com> Co-authored-by: LordOfPolls <dev@lordofpolls.com> * feat: add `guild` & `channel` properties to `ThreadMembersUpdate` (#1504) * ci: weekly check. (#1503) * ci: weekly check. updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.278 → v0.0.280](astral-sh/ruff-pre-commit@v0.0.278...v0.0.280) * ci: correct from checks. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * fix(http): incorrect path for delete permission endpoint (#1506) * fix delete_permissions api endpoint fix API Endpoint in delete_channel_permission adding "permissions/" in Endpoint * ci: correct from checks. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * ci: weekly check. (#1511) updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.280 → v0.0.281](astral-sh/ruff-pre-commit@v0.0.280...v0.0.281) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * feat: Implement missing stuff for scheduled events (#1507) * feat: Implement gateway support for scheduled events * fix: add optional to user add/remove * refactor: pre-commit'ed * refactor: change attrs to props and add `attrs.field` * refactor: set repr to True * feat(client): add `get_scheduled_event` helper method * refactor: use cache helpers in methods * chore: replace typing * docs: clarify intents in example (#1516) * feat: infer modal/component callback names from coroutine (#1519) * feat: infer callback decor from coroutine name * docs: add new logic notation * chore: add doc notation to component callback definition * docs: clarify intents for extensions * ci: weekly check. (#1521) updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.281 → v0.0.282](astral-sh/ruff-pre-commit@v0.0.281...v0.0.282) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --------- Signed-off-by: kennhh <133614589+kennhh@users.noreply.github.com> Signed-off-by: LordOfPolls <dev@lordofpolls.com> Signed-off-by: Astrea <25420078+AstreaTSS@users.noreply.github.com> Co-authored-by: kennhh <133614589+kennhh@users.noreply.github.com> Co-authored-by: i0bs <41456914+i0bs@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: LordOfPolls <dev@lordofpolls.com> Co-authored-by: Max <maxyolo01.ytb@gmail.com> Co-authored-by: Damego <damego.dev@gmail.com> Co-authored-by: Donbur4156 <janpfister@t-online.de>
1 parent 5f7dc27 commit 738c0ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1095
-456
lines changed

.github/workflows/precommit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ jobs:
1717
pip install pre-commit
1818
- name: Run Pre-commit
1919
run: |
20-
pre-commit run --all-files
20+
pre-commit run --all-files --show-diff-on-failure

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ repos:
2929
name: TOML Structure
3030
- id: check-merge-conflict
3131
name: Merge Conflicts
32-
- repo: https://github.com/charliermarsh/ruff-pre-commit
33-
rev: 'v0.0.272'
32+
- repo: https://github.com/astral-sh/ruff-pre-commit
33+
rev: 'v0.0.282'
3434
hooks:
3535
- id: ruff
3636
args: [--fix, --exit-non-zero-on-fix]
3737
- repo: https://github.com/psf/black
38-
rev: 23.3.0
38+
rev: 23.7.0
3939
hooks:
4040
- id: black
4141
name: Black Formatting

docs/src/Guides/01 Getting Started.md

Lines changed: 48 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -9,102 +9,73 @@ Ready to get your Python on and create a Discord bot? This guide's got you cover
99
- [x] [A bot account](02 Creating Your Bot.md)
1010
- [ ] An aversion to puns
1111

12-
## Installation Methods
12+
## Installing and Setting up a Bot
1313

14-
There are two different ways to install this library and create your bot.
14+
### Virtual Environments
1515

16-
=== "Using a Template"
16+
We strongly recommend that you make use of Virtual Environments when working on any project.
17+
This means that each project will have its own libraries of any version and does not affect anything else on your system.
18+
Don't worry, this isn't setting up a full-fledged virtual machine, just small python environment.
1719

18-
We created a [cookiecutter template](https://github.com/Discord-Snake-Pit/Bot-Template) which you can use to set up your own bot faster.
19-
With the template, your code will already have a well-defined structure which will make development easier for you.
20-
21-
We recommend newer devs to make use of this template.
22-
23-
### Template Feature
24-
- Basic, ready to go bot
25-
- Implementation of best practises
26-
- General extensibility
27-
- Example command, context menu, component, and event
28-
- Logging to both console and file
29-
- Pip and poetry config
30-
- Pre-commit config
31-
- Dockerfile and pre-made docker-compose
32-
33-
### Template Installation
34-
1. Install cookiecutter - `pip install cookiecutter`
35-
2. Set up the template - `cookiecutter https://github.com/Discord-Snake-Pit/Bot-Template`
36-
37-
And that's it!
38-
39-
More information can be found [here](https://github.com/Discord-Snake-Pit/Bot-Template).
40-
41-
42-
=== "Manual Installation"
43-
44-
### Virtual-Environments
45-
46-
We strongly recommend that you make use of Virtual Environments when working on any project.
47-
This means that each project will have its own libraries of any version and does not affect anything else on your system.
48-
Don't worry, this isn't setting up a full-fledged virtual machine, just small python environment.
49-
50-
=== ":material-linux: Linux"
51-
```shell
52-
cd "[your bots directory]"
53-
python3 -m venv venv
54-
source venv/bin/activate
55-
```
20+
=== ":material-linux: Linux"
21+
```shell
22+
cd "[your bots directory]"
23+
python3 -m venv venv
24+
source venv/bin/activate
25+
```
5626

57-
=== ":material-microsoft-windows: Windows"
58-
```shell
59-
cd "[your bots directory]"
60-
py -3 -m venv venv
61-
venv/Scripts/activate
62-
```
27+
=== ":material-microsoft-windows: Windows"
28+
```shell
29+
cd "[your bots directory]"
30+
py -3 -m venv venv
31+
venv/Scripts/activate
32+
```
6333

64-
It's that simple, now you're using a virtual environment. If you want to leave the environment just type `deactivate`.
65-
If you want to learn more about the virtual environments, check out [this page](https://docs.python.org/3/tutorial/venv.html)
34+
It's that simple, now you're using a virtual environment. If you want to leave the environment just type `deactivate`.
35+
If you want to learn more about the virtual environments, check out [this page](https://docs.python.org/3/tutorial/venv.html)
6636

67-
### Pip install
37+
### Pip install
6838

69-
Now let's get the library installed.
39+
Now let's get the library installed.
7040

71-
=== ":material-linux: Linux"
72-
```shell
73-
python3 -m pip install discord-py-interactions --upgrade
74-
```
41+
=== ":material-linux: Linux"
42+
```shell
43+
python3 -m pip install discord-py-interactions --upgrade
44+
```
7545

76-
=== ":material-microsoft-windows: Windows"
77-
```shell
78-
py -3 -m pip install discord-py-interactions --upgrade
79-
```
46+
=== ":material-microsoft-windows: Windows"
47+
```shell
48+
py -3 -m pip install discord-py-interactions --upgrade
49+
```
8050

81-
### Basic bot
51+
### Basic bot
8252

83-
Now let's get a basic bot going, for your code, you'll want something like this:
53+
!!! note
54+
This is a very basic bot. For a more detailed example/template bot that demonstrates many parts of interactions.py, see [the boilerplate repository.](https://github.com/interactions-py/boilerplate)
8455

85-
```python
86-
from interactions import Client, Intents, listen
56+
Now let's get a basic bot going, for your code, you'll want something like this:
8757

88-
bot = Client(intents=Intents.DEFAULT)
89-
# intents are what events we want to receive from discord, `DEFAULT` is usually fine
58+
```python
59+
from interactions import Client, Intents, listen
9060

91-
@listen() # this decorator tells snek that it needs to listen for the corresponding event, and run this coroutine
92-
async def on_ready():
93-
# This event is called when the bot is ready to respond to commands
94-
print("Ready")
95-
print(f"This bot is owned by {bot.owner}")
61+
bot = Client(intents=Intents.DEFAULT)
62+
# intents are what events we want to receive from discord, `DEFAULT` is usually fine
9663

64+
@listen() # this decorator tells snek that it needs to listen for the corresponding event, and run this coroutine
65+
async def on_ready():
66+
# This event is called when the bot is ready to respond to commands
67+
print("Ready")
68+
print(f"This bot is owned by {bot.owner}")
9769

98-
@listen()
99-
async def on_message_create(event):
100-
# This event is called when a message is sent in a channel the bot can see
101-
print(f"message received: {event.message.content}")
10270

71+
@listen()
72+
async def on_message_create(event):
73+
# This event is called when a message is sent in a channel the bot can see
74+
print(f"message received: {event.message.content}")
10375

104-
bot.start("Put your token here")
105-
```
10676

107-
---
77+
bot.start("Put your token here")
78+
```
10879

10980
Congratulations! You now have a basic understanding of this library.
11081
If you have any questions check out our other guides, or join the

0 commit comments

Comments
 (0)