Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: remove outdated cookiecutter template #1483

Merged
Merged
Changes from all commits
Commits
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
125 changes: 48 additions & 77 deletions docs/src/Guides/01 Getting Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,102 +9,73 @@ Ready to get your Python on and create a Discord bot? This guide's got you cover
- [x] [A bot account](02 Creating Your Bot.md)
- [ ] An aversion to puns

## Installation Methods
## Installing and Setting up a Bot

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

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

We created a [cookiecutter template](https://github.com/Discord-Snake-Pit/Bot-Template) which you can use to set up your own bot faster.
With the template, your code will already have a well-defined structure which will make development easier for you.

We recommend newer devs to make use of this template.

### Template Feature
- Basic, ready to go bot
- Implementation of best practises
- General extensibility
- Example command, context menu, component, and event
- Logging to both console and file
- Pip and poetry config
- Pre-commit config
- Dockerfile and pre-made docker-compose

### Template Installation
1. Install cookiecutter - `pip install cookiecutter`
2. Set up the template - `cookiecutter https://github.com/Discord-Snake-Pit/Bot-Template`

And that's it!

More information can be found [here](https://github.com/Discord-Snake-Pit/Bot-Template).


=== "Manual Installation"

### Virtual-Environments

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

=== ":material-linux: Linux"
```shell
cd "[your bots directory]"
python3 -m venv venv
source venv/bin/activate
```
=== ":material-linux: Linux"
```shell
cd "[your bots directory]"
python3 -m venv venv
source venv/bin/activate
```

=== ":material-microsoft-windows: Windows"
```shell
cd "[your bots directory]"
py -3 -m venv venv
venv/Scripts/activate
```
=== ":material-microsoft-windows: Windows"
```shell
cd "[your bots directory]"
py -3 -m venv venv
venv/Scripts/activate
```

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

### Pip install
### Pip install

Now let's get the library installed.
Now let's get the library installed.

=== ":material-linux: Linux"
```shell
python3 -m pip install discord-py-interactions --upgrade
```
=== ":material-linux: Linux"
```shell
python3 -m pip install discord-py-interactions --upgrade
```

=== ":material-microsoft-windows: Windows"
```shell
py -3 -m pip install discord-py-interactions --upgrade
```
=== ":material-microsoft-windows: Windows"
```shell
py -3 -m pip install discord-py-interactions --upgrade
```

### Basic bot
### Basic bot

Now let's get a basic bot going, for your code, you'll want something like this:
!!! note
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)

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

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

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

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

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

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

bot.start("Put your token here")
```

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

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